If you are unable to create a new account, please email support@bspsoftware.com

 

News:

MetaManager - Administrative Tools for IBM Cognos
Pricing starting at $2,100
Download Now    Learn More

Main Menu

#prompt('Filter Criteria', 'token','0=0')#.....what does it really mean?

Started by Prajam, 25 Apr 2013 07:38:16 AM

Previous topic - Next topic

Prajam

HI folks,


Can anyone explain " #prompt('Filter Criteria', 'token','0=0')# " what does in report level?

Thanks in advance

siyad

This tells to prompt for a value when running report. T

The #prompt()# is a macro function for accepting a prompt value
'Filter Criteria' is the prompt parameter
'token' is a key word to accept any type of data, instead of specifying the data type
'0=0' will retunrr 1(true) if you have not selected anything when the report is prompted. This 3rd parameter is for you to give a default value when the user is not selected anything

hope this will help and all the best


Lynn

Quote from: siyad on 25 Apr 2013 08:01:51 AM
This tells to prompt for a value when running report. T

The #prompt()# is a macro function for accepting a prompt value
'Filter Criteria' is the prompt parameter
'token' is a key word to accept any type of data, instead of specifying the data type
'0=0' will retunrr 1(true) if you have not selected anything when the report is prompted. This 3rd parameter is for you to give a default value when the user is not selected anything

hope this will help and all the best

I'm not sure your explanation is correct.

Per the documentation: "Token is not an actual data type. It is a way to pass SQL. A token does not pass values." It is not a way to pass any type of data without specifying data type.

Also, you correctly identified that '0=0' is the default value to use if nothing is selected, but it will not return a boolean 1 or true. It will return 0=0.

Looks to me like this is a prompt token that would allow a user to specify different filter conditions when running a report and is mostly used in conjunction with a prompt control that has static choices assigned.

siyad

Thanks Lynn. You are correct to say that it is not a data type , I may have generalized my answer a bit more.

Though, I am not sure about the second suggestion to say that it returns 0=0 when nothing is selected. I have ran this in Cognos 10.1 and it returned a 1 when nothing is selected for this prompt

Lynn

It will evaluate to True because 0=0 is what gets passed if no other value is specified. Look at the generated SQL.

It is the overall expression that evaluates to a boolean and not the 0=0 portion alone that dictates that. If you specified 0=0 as the default for a prompt with a string data type it would not pass 'true'...it would pass 0=0.

If you changed it to something like below then it would evaluate to whatever that query item contains if no other value were entered.


#prompt('Select an Item', 'token','[YourNamespace].[YourQuerySubject].[YourQueryItem]')#


Perhaps I'm just picking at semantics here :)

siyad

My initial thought was the report studio returns a 0=0 for #prompt('Filter Criteria', 'token','0=0')# .  But itreturned a 1 instead of a 0=0. Yes the Cognos SQL query generated is

select         (0 = 0)  as  Data_Item1
from         (values('all_level')) "Query1.0"(c1)

for both, with using string and token the final output returned is 1 in this case.

But If you change the '0=0' with as the default parameter on this filter. Cognos returns a 0.So yes it is evaluating a Cognos SQL, but end of the day is returning a 0 or 1. Looks like a boolean expression as a result...I still dont know what kind of rules is applied in this case by Cognos

Good to see your in depth analysis on the posts and I would apreciate that

Lynn

You are right about the string data type, the 0=0 would need to be wrapped in single quotes sq() to be interpreted as a string.

Thanks for ensuring accuracy!

inu

Quote from: Lynn on 29 Apr 2013 12:38:38 PM
I'm not sure your explanation is correct.

Per the documentation: "Token is not an actual data type. It is a way to pass SQL. A token does not pass values." It is not a way to pass any type of data without specifying data type.

Also, you correctly identified that '0=0' is the default value to use if nothing is selected, but it will not return a boolean 1 or true. It will return 0=0.

Looks to me like this is a prompt token that would allow a user to specify different filter conditions when running a report and is mostly used in conjunction with a prompt control that has static choices assigned.
HI Lyn,
What is the meaning of token keyword, why we use it.
If TOKEN is not an actual data type.
How can we know that, it is a way to pass SQL. Is there any way to see function of TOKEN.
Please tell me Lyn.

Cheers!
Inam

MFGF

Quote from: inu on 08 Sep 2014 07:58:00 AM
HI Lyn,
What is the meaning of token keyword, why we use it.
If TOKEN is not an actual data type.
How can we know that, it is a way to pass SQL. Is there any way to see function of TOKEN.
Please tell me Lyn.

Cheers!
Inam

Hi,

See pages 154 and 157 of the Framework Manager User Guide:

http://public.dhe.ibm.com/software/data/cognos/documentation/docs/en/10.2.1/ug_fm.pdf

MF.
Meep!