Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello Experts,
I got a requirement to provide alerts to user when a product is near to expire. my requirement is i have send alerts to user 45days before my expire data i.e sending alerts that product will be expire soon
I have calculated like below
vDays = (date(date#(Expire_date, 'DD MMM YYYY'),'DD/MM/YYYY') - date(date#(Manf_date, 'DD MMM YYYY'),'DD/MM/YYYY'))
count({<$(vDays) ={'<= [45]'}>}Product)
The data is like below
Manf_date, Expire_date, Product
1/01/2021, 12/07/2021,A
02/11/2020, 31/12/2021,B
11/07/2021, 16/08/2021, C
But unable to get the output with above calculation , kindly let me know the how to resolve this issue.
Thank you inadvance.
Try this,
SET DateFormat='D/MM/YYYY';
tab1:
LOAD * INLINE [
Manf_date, Expire_date, Product
1/01/2021, 12/07/2021,A
02/11/2020, 31/12/2021,B
11/07/2021, 16/08/2021, C
];
SET vDays = Expire_date- Manf_date;
Try like this,
vDays = (date(date#(Expire_date, 'DD MMM YYYY'),'DD/MM/YYYY') - date(date#(Manf_date, 'DD MMM YYYY'),'DD/MM/YYYY'))
count({<Product={"(date(date#(Expire_date, 'DD MMM YYYY'),'DD/MM/YYYY') - date(date#(Manf_date, 'DD MMM YYYY'),'DD/MM/YYYY'))<=[45]"}>}Product)
Thanks Saran for quick response.
is it not possible to use variable instead of complete calculation?
Also the solution is not working , getting 0 as answer
Try this,
SET DateFormat='D/MM/YYYY';
tab1:
LOAD * INLINE [
Manf_date, Expire_date, Product
1/01/2021, 12/07/2021,A
02/11/2020, 31/12/2021,B
11/07/2021, 16/08/2021, C
];
SET vDays = Expire_date- Manf_date;
Exp: =count({<Product={"=$(vDays)<=45"}>}Product)
Output:
Thank you so much, it is working now.