Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Problem with if into a where

Hi everyone,

I have a script problem to adapt my "where" to the value of a dynamic variable.

More explicitly :

I have the variable "v_Payment_Reserve" that could be equal to "Payment" or to "Reserve".

So with a if condition, I would like to adapt my "where" to this variable.

That means that I would like something like that (in red):

TEMP_CRE_ISIE :

NoConcatenate

REPLACE LOAD

     [TPA Number] as [Claim Folder Number],

     [Month Report] as [Accounting cut-off date],

L_FLEET_NAME_CRE as [Product code],

'l1' as [Line product] ,

[Risk code] ,

'112' as TCA,

'ITL' as Country,

Date([Date of accident] ,'YYMM')&'ITF' as [Occurrence date],

sum(account_Amount_139) as [Total recoveries reserve]

RESIDENT TEMP_CAL_CRE

where

if ( '$(v_Payment_Reserve)' = 'Payment' ,

[Month Report] = '$(v_Month_report)' ,

[Month Report] < '$(v_Month_report)' )

group by [TPA Number] , [Month Report] ,  [Risk code] , [Date of accident] , L_FLEET_NAME_CRE , L_FLEET_START_PERIOD , type_benificiary;

But, of course, my red code doesn't work.

Do you have the solution please ?

Thanks a lot.

1 Reply
a_mullick
Creator III
Creator III

Hi,

I think you can remove the quotes from around the variables:

if ( $(v_Payment_Reserve) = 'Payment' ,

[Month Report] = $(v_Month_report) ,

[Month Report] < $(v_Month_report) )