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

IF and Else Statement with DATE = MAXIMUM(DATE) for ID

Started by gosoccer, 20 Mar 2017 04:09:15 PM

Previous topic - Next topic

gosoccer

Hi guys,
I'm stuck big time and I have to have this done by tomorrow. I have to come up with the following in FM Model Subject Q,

IF ([LTDATE IS NULL) THEN
(LTDATE = MAXIMUM[LDDATE] for ID)
ELSE
(SFDATE= MAXIMUM[SFDATE] for ID)

I'm getting a parsing error.

Please help if you can..


gosoccer

Ok, I created two max columns using the calculations as maxltdate and maxsfdate.
and then I have the following if statement but I'm getting Highlighted expression has Wrong Type

if (XXXX.XXXX.[LTDATE] IS  NULL) then
(XXXX.XXXXX.[MAXLTDATE])
else (XXXX.XXXX.[MAXSFDATE])

I Thought if I create the column under the subject query calculation without using the FOR Clause, it would help but
I think there is a data mismatch of some sort.

Any help, is greatly appreciate it.




tjohnson3050

The syntax for maximum is maximum(XX for YY)

IF ([LTDATE IS NULL) THEN
(LTDATE = MAXIMUM([LDDATE] for ID))
ELSE
(SFDATE= MAXIMUM([SFDATE] for ID))

gosoccer

Hi there, Thanks of the reply,

Well, let me share this with you and let me know what you think since I'm so soo stuck in Framework Manager.

This query contains an error and can not be executed.

It is recommended that you view the query feedback on the "Query Information" tab.

RQP-DEF-0177 An error occurred while performing operation 'sqlPrepareWithOptions' status='-16'.
UDA-SQL-0358 Line 129: Syntax error near "=".


Here is the Filter Statement under the Framework Model subject query,
case
when XXXX.[REC_TYPE_CD] = 1
then  (XXXX.[Max Updated]  = maximum(XXXX.[Max Updated] for XXXX.[Record ID 1]))
when XXXX.[REC_TYPE_CD] = 4
then (XXXX.[Max Updated]  = maximum(XXXX.[Max Updated] for XXXX.[Record ID 4]) )
end

and [Max Updated] is a Expression under the Query Items and Calculation of the Subject Query listing of items with the following,

case
when (xxxx.[DT_TS]  IS NULL) then xxxx.[Last Date]
else xxxx.[DT_TS]   
end

This error is very annoying.

I have to perhaps shift to using just OR and AND statements  but not sure how to establish that. I think using the FOR as a par :) :)t of the above is causing this issue.


bus_pass_man


If you got rid of the XXXX.[Max Updated]  = bits what happens?

gosoccer

Thank you for replying. Since I was getting error no matter what i tried, I end up using the

(Statement) AND (Statement)
OR
(Statement) AND (Statement)
OR
(Statement) AND (Statement)

it's working absolutely great. We validated all the data and it was successful.

::) ::)

bus_pass_man

In general you want filter expressions to resolve to a boolean.   Your expression wasn't doing that.  It was more of a calculation type expression.