COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: jasmina on 13 Nov 2014 06:31:07 AM

Title: Error in Converting a lableLevel using CAST function - Cognos DMR
Post by: jasmina on 13 Nov 2014 06:31:07 AM
Hi,

We have created date item and put the following expression to get the level value from hierarchy for each level.

Data Item 1:  roleValue('_levelLabel',[HIER ALL])

This is working fine but I need to append this value with string value so I am trying to convert using CAST function but it raising an error.

We are trying to achieve : 'TEST MESSAGE'+ CAST(roleValue('_levelLabel',[HIER ALL]),VARCHAR(50)).

Although we have used similar expression to get the member caption with CAST and it is working as expected. -->  'TEST MESSAGE'+ CAST(roleValue('_memberCaption',[HIER ALL]),VARCHAR(50))

Please let me know if you have any idea about solution.

Thanks.


Title: Re: Error in Converting a lableLevel using CAST function - Cognos DMR
Post by: Francis aka khayman on 17 Nov 2014 01:27:47 AM
you have a second expression that is working as expected. may i ask why not use it instead?
Title: Re: Error in Converting a lableLevel using CAST function - Cognos DMR
Post by: navissar on 17 Nov 2014 01:39:51 AM
Quote from: jasmina on 13 Nov 2014 06:31:07 AM

This is working fine but I need to append this value with string value so I am trying to convert using CAST function but it raising an error.

It's usually a lot easier to help when we know what the error is... :)
Anyway, you don't need to cast it - level label is already a string. You also don't need to cast member caption.
Title: Re: Error in Converting a lableLevel using CAST function - Cognos DMR
Post by: jasmina on 17 Nov 2014 04:32:57 AM
Hi,

We need current member and it immediate parent value at same hierarchical level, which will be used  as input parameter in generating URL to launch third party application.

So CAST(roleValue('_memberCaption',[Level 1]),VARCHAR(50)) will give me the current value of the member and CAST(roleValue('_levelLabel',[HIER ALL]),VARCHAR(50)) will give the immediate parent but the real issue is arise when we tried append to other static string value while generating URL.

is you try to append roleValue('_memberCaption',[Level 1]) with any string then it won't work and will give an error. Try Data Item 1: roleValue('_memberCaption',[Level 1])||' - '||'TEST MESSAGE' .

Hope you have clear understating of what we are trying to achieve.

Thanks
Title: Re: Error in Converting a lableLevel using CAST function - Cognos DMR
Post by: navissar on 17 Nov 2014 04:35:42 AM
Quote from: jasmina on 17 Nov 2014 04:32:57 AM


is you try to append roleValue('_memberCaption',[Level 1]) with any string then it won't work and will give an error. Try Data Item 1: roleValue('_memberCaption',[Level 1])||' - '||'TEST MESSAGE' .

...
What. is. the. error?
Title: Re: Error in Converting a lableLevel using CAST function - Cognos DMR
Post by: jasmina on 17 Nov 2014 11:29:32 PM
Hi,

XQE-GEN-0002 : An unexpected exception occurred: com.cognos.xqe.runtree.olap.mdx.dmrprovider.DMRMemberProxy incompatible with com.cognos.xqe.data.values.Value

This Type Of Error i get.