Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
bharatkishore
Creator III
Creator III

Remove columns data

HI All,

I have written the below condition to get flag in script:

if(Equipment=Equipment_Sales_LookUp

and Posting.Date>=Start_DT_New and Posting.Date<=End_DT_New,'Contract Period','Outside Contract Period' )as Contract_Flag

Now the problem is when  i have data as Outside Contract Period i want to get the few fields data as null. i don't want to see any records . Can you please suggest me on this. 

This should happen in script and all the fields are in 1 table.

Thanks,

Bharat

12 Replies
PrashantSangle

can you explain with some sample data??

Regards,
Prashant Sangle
Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
bharatkishore
Creator III
Creator III
Author

HI Prashant ,T.PNG

In the above image i want Start date , End date , Salesdocument and Item columns as null because here the below condition is not matching

Posting.Date>=Start_DT_New and Posting.Date<=End_DT_New,'Contract Period','Outside Contract Period' )

where ever my posting date is <start end i want Start date , End date , Salesdocument and Item fields to be null. 

These columns i bought in through mapping.

Please let me know if you need anything more.

PrashantSangle

Is your posting date, start date and end date in proper date format??? debug your flag expression
try to use num()
try below.

if(num(Posting.Date)>=num(Start_DT_New) and num(Posting.Date)<=num(End_DT_New),'Contract Period','Outside Contract Period' )

Regards,
Prashant Sangle
Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
bharatkishore
Creator III
Creator III
Author

I have changed while mapping them it-self as in the format of Posting date:
The below is the example:
Date(Date#(Start_DT_New,'YYYY/MM/DD'),'MM/DD/YYYY') as Start_DT_New
Date(Date#(End_DT_New,'YYYY/MM/DD'),'MM/DD/YYYY') as End_DT_New
will try with your one and let you know
bharatkishore
Creator III
Creator III
Author

I tried with your expression but the result is same..
PrashantSangle

if(posting.date>start_date_new,'New','Old') as Flag1
if(posting.date<end_date_new,'New','Old') as Flag2

check this flag is evaluating properly or not

Regards,
Prashant Sangle
Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
bharatkishore
Creator III
Creator III
Author

I tried with your conditions and the flag is evaluating properly.

Below image for reference:

T.PNGI

Please let me know if you need anything more. 

PrashantSangle

Now combine both expression and try
if(posting.date>start_date_new and posting.date<end_date_new,'New','Old') as Flag1

Regards,
Prashant Sangle
Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
bharatkishore
Creator III
Creator III
Author

Sure but that is the same expression i have written earlier:

if(Equipment=Equipment_Sales_LookUp

and num(Posting.Date)>=num(Start_DT_New) and num(Posting.Date)<=num(End_DT_New),'Contract Period','Outside Contract Period' )as Contract_Flag,

Please let me know if  i need to change any where