Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
FrankC
Creator
Creator

Help with NOT Exists

My logic is not working.  I am not sure why

What I am expecting to see is 2 records in the autopay table, but I am only seeing 1 (from the currentrecord table)  I am trying to use AutoKey and the value to compare against.

AutoPayCustomersDB:
LOAD
1 as t
,LastCustKey
,RecDate
,AutoKey
,CustKey
,PKID
,UnitsID
,CustomerID
,DateStart
,DateEnd
,AutoPay
,AutoPayID
,AutoPayInfo
,CSRentalID
,AutopayON
,AutopayOFF
Resident CurrentRecord;

Concatenate (AutoPayCustomersDB)
Load *
Where NOT ( Exists(AutoKey, AutoKey))
;

Load
'$(vDate)' as RecDate
,CustomerID&UnitsID&'-'&fabs(AutoPay) as AutoKey
,AutoPay
,if (AutoPay = -1, 1,0) as AutopayON
,if (AutoPay <> -1, 1,0) as AutopayOFF
,CustomerID&UnitsID as CustKey
,CustomerID&UnitsID&'-'&'$(vDateNum)' as LastCustKey
,PKID
,UnitsID
,CustomerID
,DateStart
,DateEnd
,AutoPayID
,AutoPayInfo
,CSRentalID

 

Labels (1)
2 Replies
Saravanan_Desingh

Where NOT ( Exists(AutoKey, AutoKey))

If you use the above code, it eliminate the duplicate population of the row for AutoKey. If there are two rows with same AutoKey, only the first loaded will be there.

FrankC
Creator
Creator
Author

I have the not exist logic, but it is not getting any new rows. And I know that there should be