Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

if not exists and applymap coexists?

Hi Can anyone tell me if there is anything wrong with this if condition

            If(not exists(Key, AutoNumberHash256([Transaction Invoice Date]),'MMM-YYYY') , [Transaction SAP Account Id] , [RO Id] ,[Transaction Product Code])), ApplyMap('Monthly_Manual_Rebates',Date(MonthStart([Transaction Invoice Date]),'MMM-YYYY') & '|' & [Transaction PAS Account Id] & '|' & [RO Id] & '|' & [Transaction Product Code],0)) as [Transaction Manual Rebates],

I get an error

Script error: Error in expression:If exists takes 1-2 parameters

Capture.PNG

also if you look at ths if condition in the picture there is a red for one of the brackets indicating that it is confused

1 Solution

Accepted Solutions
swuehl
MVP
MVP

I assume this:

If(

not exists(Key, AutoNumberHash256(Date(Monthstart([Transaction Invoice Date]),'MMM-YYYY') , [Transaction SAP Account Id] , [RO Id] ,[Transaction Product Code])),

ApplyMap(

  'Monthly_Manual_Rebates'

  ,Date(MonthStart([Transaction Invoice Date]),'MMM-YYYY') & '|' & [Transaction PAS Account Id] & '|' & [RO Id] & '|' & [Transaction Product Code]

  ,0)

)

  as [Transaction Manual Rebates],



View solution in original post

4 Replies
sunny_talwar

AFAIK exists/not exists only work with Where. What exactly are you trying to do? May be there is another way to do this?

Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Looks like you're missing a 'Date(' somewhere because I see a date format string without a date function

If(not exists(Key, AutoNumberHash256([Transaction Invoice Date]),'MMM-YYYY') , [Transaction SAP Account Id] , [RO Id] ,[Transaction Product Code])),


And check that all the parentheses match up.


talk is cheap, supply exceeds demand
swuehl
MVP
MVP

I assume this:

If(

not exists(Key, AutoNumberHash256(Date(Monthstart([Transaction Invoice Date]),'MMM-YYYY') , [Transaction SAP Account Id] , [RO Id] ,[Transaction Product Code])),

ApplyMap(

  'Monthly_Manual_Rebates'

  ,Date(MonthStart([Transaction Invoice Date]),'MMM-YYYY') & '|' & [Transaction PAS Account Id] & '|' & [RO Id] & '|' & [Transaction Product Code]

  ,0)

)

  as [Transaction Manual Rebates],



Anonymous
Not applicable
Author

Thanks Stefan , I probably pasted my applymap incorrectly, so did it in steps, matched your response. thx again