Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
krishna_venkata
New Contributor II

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
MVP
MVP

Re: if not exists and applymap coexists?

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],



4 Replies

Re: if not exists and applymap coexists?

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

Re: if not exists and applymap coexists?

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
MVP
MVP

Re: if not exists and applymap coexists?

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],



krishna_venkata
New Contributor II

Re: if not exists and applymap coexists?

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

Community Browser