COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: zaib on 17 Oct 2013 11:41:06 AM

Title: Parameter Expression
Post by: zaib on 17 Oct 2013 11:41:06 AM
When I use following expression in a query item
#'[GOSALES].[COUNTRY].[COUNTRY_' + $Language_Lookup{$runLocale} + ']' #

Report Studio throws error

RQP-DEF-0058

             Unable to resolve the expression '#'[GOSALES].[SALES_REGION].[SALES_REGION_' +$Language_Lookup{$runLocale} +']' #' in the object '[Transformation View].[Sales Staff].[Sales Region]'.

Is anything wrong with my expression? It tests fine when I test it from calculation definition window in FrameWork.
Title: Re: Parameter Expression
Post by: MFGF on 17 Oct 2013 12:03:16 PM
I know it's an obvious question, but I will ask anyway :)

Do you have a Parameter Map called Language_Lookup defined? It's not by any chance called Language_lookup is it?

MF.
Title: Re: Parameter Expression
Post by: zaib on 17 Oct 2013 12:10:35 PM
yes Language_Lookup parameter maps is defined.

Title: Re: Parameter Expression
Post by: zaib on 17 Oct 2013 12:34:48 PM
Attachment shows it working in FM and error in RS.
Title: Re: Parameter Expression
Post by: CognosPaul on 17 Oct 2013 12:51:55 PM
First question: Since you made the parameter map, have you republished the model?

Second, are there any other parts of the expression?

In a new query, try running:

#sq('[GOSALES].[COUNTRY].[COUNTRY_' + $Language_Lookup{$runLocale} + ']')#
That should return the expression as a string. If that doesn't work, then there are more serious issues.

Try running

#sq($Language_Lookup{$runLocale} ) #

Try also running
#sq($Language_Lookup{%runLocale} ) #

(Off the top of my head, I can't remember exactly when you need the percent sign)

Next, try
#sb('GOSALES].[COUNTRY].[COUNTRY_' + $Language_Lookup{$runLocale}))#
Title: Re: Parameter Expression
Post by: zaib on 17 Oct 2013 01:16:52 PM
First question: Since you made the parameter map, have you republished the model?
Yes I republished the model

Second, are there any other parts of the expression?
No I copied the whole Expression

In a new query, try running:

#sq('[GOSALES].[COUNTRY].[COUNTRY_' + $Language_Lookup{$runLocale} + ']')#
That should return the expression as a string. If that doesn't work, then there are more serious issues.
Yes Return [GOSALES].[COUNTRY].[COUNTRY_EN]

Try running

#sq($Language_Lookup{$runLocale} ) #
yes return EN

Try also running
#sq($Language_Lookup{%runLocale} ) #

(Off the top of my head, I can't remember exactly when you need the percent sign)

Nothing is returned with %

Next, try
#sb('[GOSALES].[COUNTRY].[COUNTRY_' + $Language_Lookup{$runLocale}))#

Parsing error
QE-DEF-0260 Parsing error before or near position: 69 of: "#sb('[GOSALES].[COUNTRY].[COUNTRY_' + $Language_Lookup{$runLocale}))"

Title: Re: Parameter Expression
Post by: CognosPaul on 17 Oct 2013 02:23:50 PM
I put too many closing parens in the last expression, it should just be #sb('[GOSALES].[COUNTRY].[COUNTRY_' + $Language_Lookup{$runLocale})#

Title: Re: Parameter Expression
Post by: zaib on 17 Oct 2013 02:33:25 PM
Expression
#sb('[GOSALES].[COUNTRY].[COUNTRY_' + $Language_Lookup{$runLocale})#

Here is what I get

[[GOSALES]].[COUNTRY]].[COUNTRY_EN]



QE-DEF-0030 Expression parsing error.
QE-DEF-0359 The query contains a reference to at least one object '[[GOSALES]].[COUNTRY]].[COUNTRY_EN]' that does not exist.


[[GOSALES]].[COUNTRY]].[COUNTRY_EN]
Title: Re: Parameter Expression
Post by: CognosPaul on 17 Oct 2013 02:38:54 PM
hmm, annoying that it's doing that to the country. how about:


#'[GOSALES].[COUNTRY].[COUNTRY_' + sb($Language_Lookup{$runLocale})#
or
[GOSALES].[COUNTRY].[COUNTRY_#sb($Language_Lookup{$runLocale})#
Title: Re: Parameter Expression
Post by: zaib on 17 Oct 2013 03:23:59 PM
Expression
#'[GOSALES].[COUNTRY].[COUNTRY_' + sb($Language_Lookup{$runLocale})#

Here is what I get

[GOSALES].[COUNTRY].[COUNTRY_[EN]



QE-DEF-0030 Expression parsing error.
QE-DEF-0359 The query contains a reference to at least one object '[GOSALES].[COUNTRY].[COUNTRY_[EN]' that does not exist.


[GOSALES].[COUNTRY].[COUNTRY_[EN]



Expression
[GOSALES].[COUNTRY].[COUNTRY_#sb($Language_Lookup{$runLocale})#

This is what I get

QE-DEF-0260 Parsing error before or near position: 64 of: "[GOSALES].[COUNTRY].[COUNTRY_#sb($Language_Lookup{$runLocale})#"
Title: Re: Parameter Expression
Post by: zaib on 17 Oct 2013 03:26:11 PM
Attaching the screen shot of parameter map... may be helpful
Title: Re: Parameter Expression
Post by: CognosPaul on 17 Oct 2013 10:08:42 PM
Remind me not to try to find solutions late at night.

The reason that it's failing is sb is wrapping the EN in brackets, when it should wrap the segment:

#'[GOSALES].[COUNTRY].' + sb('COUNTRY_' + $Language_Lookup{$runLocale})#
or
[GOSALES].[COUNTRY].+#sb('COUNTRY_' + $Language_Lookup{$runLocale})#

Title: Re: Parameter Expression
Post by: zaib on 21 Oct 2013 03:08:17 PM
Running this expression #'[GOSALES].[COUNTRY].' + sb('COUNTRY_' + $Language_Lookup{$runLocale})#

Returns

QE-DEF-0030

             Expression parsing error.

         Details

QE-DEF-0359 The query contains a reference to at least one object '[GOSALES].[COUNTRY].[COUNTRY_]' that does not exist.RSV-SRV-0042 Trace back:RSReportService.cpp(826): QFException: CCL_CAUGHT: RSReportService::process()RSReportServiceMethod.cpp(259): QFException: CCL_RETHROW: RSReportServiceMethod::process(): asynchRunSpecification_RequestRSASyncExecutionThread.cpp(789): QFException: RSASyncExecutionThread::checkExceptionRSASyncExecutionThread.cpp(250): QFException: CCL_CAUGHT: RSASyncExecutionThread::runImpl(): asynchRunSpecification_RequestRSASyncExecutionThread.cpp(842): QFException: CCL_RETHROW: RSASyncExecutionThread::processCommand(): asynchRunSpecification_RequestExecution/RSRenderExecution.cpp(616): QFException: CCL_RETHROW: RSRenderExecution::executeAssembly/RSDocAssemblyDispatch.cpp(289): QFException: CCL_RETHROW: RSDocAssemblyDispatch::dispatchAssemblyAssembly/RSLayoutAssembly.cpp(79): QFException: CCL_RETHROW: RSLayoutAssembly::assembleAssembly/RSDocAssemblyDispatch.cpp(356): QFException: CCL_RETHROW: RSDocAssemblyDispatch::dispatchChildrenAssemblyForwardAssembly/RSReportPagesAssembly.cpp(179): QFException: CCL_RETHROW: RSReportPagesAssembly::assembleAssembly/RSDocAssemblyDispatch.cpp(306): QFException: CCL_RETHROW: RSDocAssemblyDispatch::dispatchAssemblyAssembly/RSPageAssembly.cpp(303): QFException: CCL_RETHROW: RSPageAssembly::assembleAssembly/RSDocAssemblyDispatch.cpp(306): QFException: CCL_RETHROW: RSDocAssemblyDispatch::dispatchAssemblyAssembly/RSTableRowAssembly.cpp(175): QFException: CCL_RETHROW: RSTableRowAssembly::assembleAssembly/RSDocAssemblyDispatch.cpp(306): QFException: CCL_RETHROW: RSDocAssemblyDispatch::dispatchAssemblyAssembly/RSTableCellAssembly.cpp(137): QFException: CCL_RETHROW: RSTableCellAssembly::assembleAssembly/RSDocAssemblyDispatch.cpp(356): QFException: CCL_RETHROW: RSDocAssemblyDispatch::dispatchChildrenAssemblyForwardRSQueryMgr.cpp(1164): QFException: CCL_RETHROW: RSQueryMgr::getResultSetIteratorRSQueryMgr.cpp(1324): QFException: CCL_RETHROW: RSQueryMgr::createIteratorRSQueryMgr.cpp(1624): QFException: CCL_RETHROW: RSQueryMgr::executeRsapiCommandRSQueryMgr.cpp(1614): QFException: CCL_RETHROW: RSQueryMgr::executeRsapiCommandRSQueryMgrExecutionHandlerImpl.cpp(189): QFException: CCL_RETHROW: RSQueryMgrExecutionHandlerImpl::execute()RSQueryMgrExecutionHandlerImpl.cpp(173): QFException: CCL_RETHROW: RSQueryMgrExecutionHandlerImpl::execute()QFSSession.cpp(1066): QFException: CCL_RETHROW: QFSSession::ProcessDoRequest()QFSSession.cpp(1064): QFException: CCL_CAUGHT: QFSSession::ProcessDoRequest()QFSSession.cpp(1021): QFException: CCL_RETHROW: QFSSession::ProcessDoRequest()QFSSession.cpp(997): QFException: CCL_RETHROW: QFSSession::ProcessDoRequest()QFSConnection.cpp(788): QFException: CCL_RETHROW: QFSConnection::ExecuteQFSQuery.cpp(213): QFException: CCL_RETHROW: QFSQuery::Execute v2CoordinationQFSQuery.cpp(4452): QFException: CCL_THROW: CoordinationPlanner





Running this expression [GOSALES].[COUNTRY].+#sb('COUNTRY_' + $Language_Lookup{$runLocale})#

Returns


[GOSALES].[COUNTRY].+[COUNTRY_EN]



QE-DEF-0260 Parsing error before or near position: 22 of: "[GOSALES].[COUNTRY].+"


[COUNTRY_EN]
Title: Re: Parameter Expression
Post by: CognosPaul on 21 Oct 2013 03:58:10 PM
[GOSALES].[COUNTRY].#sb('COUNTRY_' + $Language_Lookup{$runLocale})#


According to the first parsing error, the language lookup isn't returning a value when it's being concatenated with 'COUNTRY_', does your parameter map have a default value?
Title: Re: Parameter Expression
Post by: zaib on 21 Oct 2013 07:09:41 PM
CognosPaul   8) you are a genius....... Parameter map did not have a default value. Once I set a default value it worked.