COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Framework Manager => Topic started by: Ammus1234 on 09 May 2014 06:17:54 AM

Title: toupper macro function giving error
Post by: Ammus1234 on 09 May 2014 06:17:54 AM
Hello All,

I am trying to get the username in uppercase for using it in a filter in FM.

I am using the below expression.

# toupper (sq($account.personalInfo.userName))#

This works in report studio but gives me an error QE-DEF-0406 Unknown function 'toupper' in macro expression in FM.

My cognos version is 10.2.1 FP2.

Any help would be appreciated.

Thanks in advance
Title: Re: toupper macro function giving error
Post by: navissar on 09 May 2014 06:49:32 AM
I cannot verify this at the moment but I;m almost certain the macro function is "upper", not "toupper".
Title: Re: toupper macro function giving error
Post by: MFGF on 09 May 2014 12:06:21 PM
I'm looking at the list of functions and I'm not seeing either 'upper' or 'ToUpper' as a macro function.

MF.
Title: Re: toupper macro function giving error
Post by: navissar on 10 May 2014 03:27:51 PM
This should work:
# 'upper ('+sq($account.personalInfo.userName)+')'#
Title: Re: toupper macro function giving error
Post by: Ammus1234 on 12 May 2014 12:27:52 AM
Thanks Nimrod and MFGF for looking into it.

Please see the screenshot. toupper is available in the macro functions. It is a filter creation window.

I am not very sure how could I use this  # 'upper ('+sq($account.personalInfo.userName)+')'#
in the below expression.

#sq($PARAM_MAP{$account.personalInfo.userName})# contains [Database view].[TBL_XX].[CLM]

The parameter map 'PARAM_MAP' has the login in uppercase. So I need to pass the session parameter also in upper case.

Title: Re: toupper macro function giving error
Post by: navissar on 12 May 2014 01:28:27 AM
Right,
I don't have access to 10.2.1.FP2 at the moment, but on my 10.2.1 FP1 that function is simply not there. I can however see it in IBM documentation - weird.
Check that your FP is installed for your framework server as well as your BI server (You'll need a 32 bit version of the FP).
Title: Re: toupper macro function giving error
Post by: Ammus1234 on 12 May 2014 01:36:37 AM
Yes, I installed 10.2.1 FP2 32 bit on FM also. Restarted server.

I tried to create a calculation upper(#sq($account.personalInfo.userName)#) and insert inside the Parameter map. But it shows error. It looks like parameter map needs the exact string inside it.

I am wondering how it is normally done in the previous versions :o
Is it required to have exactly the same id in the DB as in the active directory!!
Title: Re: toupper macro function giving error
Post by: CognosPaul on 12 May 2014 06:20:26 AM
I've had a similar issue. The user needed do a lookup on the uppercase version of the username. You can't embed a database function in a param map. The solution was done in framework manager.

Create a new namespace, call it session params and hide it from your packages. In it, create a new query with two data items:
1. Name: key expression: 1
2. Name: userName expression: upper(#sq($account.personalInfo.userName)#)

Create a parameter map, call it upperUserNameLookup on that query, with key as the key and userName as the value.
Next, create a session parameter called upperUserName with the expression #$upperUserNameLookup{1}#
Now you can use the upperUserName session param in place of the account.personalInfo.userName session param. I'm not sure if there's any optimizations in Cognos when using a session param instead of a simple param map, so you could probably skip that step and just call the parameter map.
Title: Re: toupper macro function giving error
Post by: Ammus1234 on 13 May 2014 05:21:38 AM
Thank you Paul  :).
I will try and update you.