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

Logic in Scripting

Hi,

I need when I select credit date between 1st till 15th of every month then I  should get value for  ' Packing slip date field' as 18th for each month and when I select date between 16th to 31st then I should get value against ' Packing slip date field'. as 3rd of every month

Few eg are given below:-(Please refer screenshot attached for more clarity)

when I select

1.credit date 2.12.2019  I should get date  as 18.12.2019 under field name 'Packing slip date'

2. Similarly if credit date is selected as 3.12.2019 then I should get date  as 18.12.2019 under field name 'Packing slip date' 

3. if credit date is selected as 6.1.2020 then  I should get date  as 18.1.2020 under field name 'Packing slip date'

4. and in else condition if I select credit date as  30-12-2019 then  I should get date  as  03.1.2020 under field name 'Packing slip date' 

Regards

sakshi 

2 Solutions

Accepted Solutions
sakshikaul
Creator II
Creator II
Author

Thanks...I was able to implement the same ....

View solution in original post

Saravanan_Desingh

Are you looking something like this?

SET DateFormat='DD.MM.YYYY';

tab1:
LOAD *, If(tmpD<16, MakeDate(tmpY, tmpM, 18), AddMonths(MakeDate(tmpY, tmpM, 3),1)) As [Packing slip date];
LOAD *, Day([Credit Note Date]) As tmpD, Month([Credit Note Date]) As tmpM, Year([Credit Note Date]) As tmpY;
LOAD * INLINE [
    Batch, Batch_No, Credit Note Date
    A, 2019-12-A, 02.12.2019
    A, 2020-02-A, 03.02.2020
    A, 2020-01-A, 06.01.2020
    A, 2020-02-A, 10.02.2020
    A, 2020-01-A, 13.01.2020
    B, 2019-12-B, 16.12.2019
    B, 2020-02-B, 17.02.2020
    B, 2020-01-B, 20.01.2020
    B, 2019-12-B, 23.12.2019
    B, 2020-02-B, 24.02.2020
    B, 2020-01-B, 27.01.2020
    B, 2019-12-B, 30.12.2019
];

Drop Field tmpY, tmpM, tmpD;

commQV51.PNG

View solution in original post

5 Replies
sunny_talwar

Day 18 is not even an option under packing_slip_date... Are you able to share this qvw?

Brett_Bleess
Former Employee
Former Employee

Maybe the following Design Blog post may provide an idea on how to get things into the buckets, but you will still need to attach those to the correct dates then, so the link after the specific one is the base blog URL you can use to search further for other posts that may help.

https://community.qlik.com/t5/Qlik-Design-Blog/IntervalMatch/ba-p/1464547

https://community.qlik.com/t5/Qlik-Design-Blog/bg-p/qlik-design-blog

Regards,
Brett

To help users find verified answers, please do not forget to use the "Accept as Solution" button on any post(s) that helped you resolve your problem or question.
I now work a compressed schedule, Tuesday, Wednesday and Thursday, so those will be the days I will reply to any follow-up posts.
sakshikaul
Creator II
Creator II
Author

Thanks...I was able to implement the same ....

Saravanan_Desingh

Are you looking something like this?

SET DateFormat='DD.MM.YYYY';

tab1:
LOAD *, If(tmpD<16, MakeDate(tmpY, tmpM, 18), AddMonths(MakeDate(tmpY, tmpM, 3),1)) As [Packing slip date];
LOAD *, Day([Credit Note Date]) As tmpD, Month([Credit Note Date]) As tmpM, Year([Credit Note Date]) As tmpY;
LOAD * INLINE [
    Batch, Batch_No, Credit Note Date
    A, 2019-12-A, 02.12.2019
    A, 2020-02-A, 03.02.2020
    A, 2020-01-A, 06.01.2020
    A, 2020-02-A, 10.02.2020
    A, 2020-01-A, 13.01.2020
    B, 2019-12-B, 16.12.2019
    B, 2020-02-B, 17.02.2020
    B, 2020-01-B, 20.01.2020
    B, 2019-12-B, 23.12.2019
    B, 2020-02-B, 24.02.2020
    B, 2020-01-B, 27.01.2020
    B, 2019-12-B, 30.12.2019
];

Drop Field tmpY, tmpM, tmpD;

commQV51.PNG

Saravanan_Desingh

commQV52.PNG