COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Active Reports => Topic started by: noreply on 03 Oct 2012 11:15:36 PM

Title: Using images as button
Post by: noreply on 03 Oct 2012 11:15:36 PM
hi everyone,

i'm trying to use an image to act as a filter button on the active report but figure out cognos don't have this function, the image just only allow us to put a hyperlink to it. Is there anyway to go about doing it?  please advice. many thanks.


regards
lex
Title: Re: Using images as button
Post by: wyconian on 04 Oct 2012 02:10:18 AM
Hi

I think you need to use one of the prompt buttons from the insertable objects pane.  You can then add a background image to the prompt button.

Title: Re: Using images as button
Post by: noreply on 07 Oct 2012 11:29:10 PM
thank for the tips, i'll give it a try  8)
Title: Re: Using images as button
Post by: MFGF on 08 Oct 2012 03:43:36 AM
If you want to do things like switch cards of a deck by pressing an image, then you should place a list within a repeater table, add the images to the list, then use the Interactive Behaviour feature of the List to set the relevant variable.

Cheers!

MF.
Title: Re: Using images as button
Post by: sally on 22 Oct 2012 03:24:29 AM
Hi MF.,

The list method are works, the button was shown as  below:

                  [A] [pic]
                  [pic]
                  [C] [pic]

Is that anyway to make the button change to horizontal view

                  [A]        [C]
                  [pic] [pic]  [pic]

Please advice.

Regards,
Sally

Title: Re: Using images as button
Post by: CognAsh on 22 Oct 2012 03:32:05 PM
Use a repeater table - 1 deep by X wide (depending on number of buttons...)
Title: Re: Using images as button
Post by: sally on 22 Oct 2012 10:19:34 PM
Hi,

I have tested with the repeater table, the "A","B","C" all will fit into 1 column and cannot match each button for each photo

    List View
===========       
   column |  PIC             
  ===========         
    A         |   PIC1         
  ----------  --------         
    B         |  PIC2
  ---------    --------
   C          |  PIC3


    List View (Repeater Table)
  ========
     Column
  ========
    A   B   C
  --------------


Please Advice.

Regards,
Sally
Title: Re: Using images as button
Post by: CognAsh on 24 Oct 2012 10:47:19 AM
OK - this is gonna be pretty tricky to explain...

A list report in a repeater table enables the user to create custom button both vertical and horizontally

The steps are:

1. Create the data for a list report - see below for Using Virtual Tables for Button Bars
2. List in a Repeater Table - with a image value and a data item value columns
3. Master Detail between list and repeater table
4. Remove classes on the list and columns
5. Hide the headers of the columns
6. Change the visibility of the data value column to hide

Summary: Use lists with no column headers in a repeater table of lists to build up a structure based on the data hierarchy


Notes for Using Virtual Tables for Button Bars
==============================================

Main Steps

1. Build Button Query & SQL (named ButtonQuery) - from query explorer drag new SQL from toolbox and use SQL below
2. Build Deck (static)
3. Build Repeater Table & List (both on ButtonQyery) set orientation/rows/columns properties & Master Detail relationship
4. Finally make Connection between List and Deck (or whatever) it is controlling
5. Cosmetics

Details

1. New Query - call it "ButtonQuery"

Properties:

Syntax = IBM Cognos
Data_Source = great_outdoors_sales (or your data source)
Name = ButtonQueryVirtualTable
SQL =

select * from (
values
(     cast('http://mymachine.ibm.com/graphics/image1.png' as varchar(60)), cast('ONE' as varchar(10))    ),
      (    'http://mymachine.ibm.com/graphics/image2.png', 'TWO'    ),
      (    'http://mymachine.ibm.com/graphics/image3.png', 'THREE'    ),
      (    'http://mymachine.ibm.com/graphics/image4.png', 'FOUR'    )
)      
MainButtonImages (imageName, buttonValue )
Title: Re: Using images as button
Post by: sally on 24 Oct 2012 10:51:57 PM
Hi,

Thanks for the reply.

when i insert the SQL code, got error message, my code are

select * from (
Values

(cast('\\cognos10\d$\cognos\c10\Pictures\A01.gif' as varchar(1)), cast('A' as varchar(1))),
(cast('\\cognos10\d$\cognos\c10\Pictures\B01.gif' as varchar(1)), cast('B' as varchar(1))),
(cast('\\cognos10\d$\cognos\c10\Pictures\C01.gif' as varchar(1)), cast('C' as varchar(1))),
(cast('\\cognos10\d$\cognos\c10\Pictures\D01.gif' as varchar(1)), cast('D' as varchar(1))),
(cast('\\cognos10\d$\cognos\c10\Pictures\E01.gif' as varchar(1)), cast('E' as varchar(1))),
(cast('\\cognos10\d$\cognos\c10\Pictures\F01.gif' as varchar(1)), cast('F' as varchar(1)))

)

is that got any problem with my code above?
Title: Re: Using images as button
Post by: MFGF on 12 Nov 2012 06:30:40 AM
Quote from: sally on 24 Oct 2012 10:51:57 PM
Hi,

Thanks for the reply.

when i insert the SQL code, got error message, my code are

select * from (
Values

(cast('\\cognos10\d$\cognos\c10\Pictures\A01.gif' as varchar(1)), cast('A' as varchar(1))),
(cast('\\cognos10\d$\cognos\c10\Pictures\B01.gif' as varchar(1)), cast('B' as varchar(1))),
(cast('\\cognos10\d$\cognos\c10\Pictures\C01.gif' as varchar(1)), cast('C' as varchar(1))),
(cast('\\cognos10\d$\cognos\c10\Pictures\D01.gif' as varchar(1)), cast('D' as varchar(1))),
(cast('\\cognos10\d$\cognos\c10\Pictures\E01.gif' as varchar(1)), cast('E' as varchar(1))),
(cast('\\cognos10\d$\cognos\c10\Pictures\F01.gif' as varchar(1)), cast('F' as varchar(1)))

)

is that got any problem with my code above?

Hi Sally,

You appear to be missing the last line from your query - as per Ashley's example:

MainButtonImages (imageName, buttonValue )

You probably also need to use Image URLs as Ash suggested, rather than Windows filepaths.

Regards,

MF.