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: 
rohitians
Creator III
Creator III

Script error help required.

Hello,

I have scenario where in i have to make report fot inventory ageing depending upon the expiry as on date,

following is the code i have written but it shows script error please help it is urgent task for me.

If(num(Date(floor(max(EDATE)))-Date('$(vDateForAgeing)'))>=1 and num(Date(floor(max(EDATE)))-Date('$(vDateForAgeing)'))<=30,'1-30',
if(num(Date(floor(max(EDATE)))-Date('$(vDateForAgeing)'))>=31 and num(Date(floor(max(EDATE)))-Date('$(vDateForAgeing)'))<=60,'31-60',
if(num(Date(floor(max(EDATE)))-Date('$(vDateForAgeing)'))>=61 and num(Date(floor(max(EDATE)))-Date('$(vDateForAgeing)'))<=90,'61-90',
if(num(Date(floor(max(EDATE)))-Date('$(vDateForAgeing)'))>=91 and num(Date(floor(max(EDATE)))-Date('$(vDateForAgeing)'))<=180,'91-180',
if(num(Date(floor(max(EDATE)))-Date('$(vDateForAgeing)'))>=181,'181+',
if(num(Date(floor(max(EDATE)))-Date('$(vDateForAgeing)'))<1 ,'Expired',
if(IsNull(date(max(EDATE))) OR Date(max(EDATE))='','Date NA'))))))) AS InvDaysSelection

vDateForAgeing=

=IF(ISNULL(GetFieldSelections($(vMonthName)))=0 OR ISNULL(GetFieldSelections($(vFinancialYear)))=0,DATE(MAX($(vPostingDate))),DATE(Today())) 

Please help it doesnt shows the bucket at all....

1 Solution

Accepted Solutions
sushil353
Master II
Master II

Hi Rohit..

in text object the function GetFieldSelections($(vMonthName)) will work because the text object is created on  UI..

but in the edit script the variable vDateForAgeing will not take value from GetFieldSelections function.

instead of GetfieldSelections try to calculate the vDateForAgeing variable using Let statement.

Hope you understand the issue with GetFieldSelections in edit script.

Sushil

View solution in original post

6 Replies
sushil353
Master II
Master II

Hi rohit,

where are you using this expression... in edit script or in chart expression..

if it is in edit script then please think that how GetFieldSelections function will work in the script...it will work only in UI.

HTH

Sushil

rohitians
Creator III
Creator III
Author

Hi Sushil

I am using this in edit script i used that expression in text object it is giving proper results...

Thanks

sushil353
Master II
Master II

Hi Rohit..

in text object the function GetFieldSelections($(vMonthName)) will work because the text object is created on  UI..

but in the edit script the variable vDateForAgeing will not take value from GetFieldSelections function.

instead of GetfieldSelections try to calculate the vDateForAgeing variable using Let statement.

Hope you understand the issue with GetFieldSelections in edit script.

Sushil

rohitians
Creator III
Creator III
Author

Hello,

Untill now the logic was as off date means

If(num(Date(floor(EDATE))-Date(today()))>=1 and num(Date(floor(EDATE))-Date(today()))<=30,'1-30',

//               if(num(Date(floor(EDATE))-Date(today()))>=31 and num(Date(floor(EDATE))-Date(today()))<=60,'31-60',

//                         if(num(Date(floor(EDATE))-Date(today()))>=61 and num(Date(floor(EDATE))-Date(today()))<=90,'61-90',

//                                   if(num(Date(floor(EDATE))-Date(today()))>=91 and num(Date(floor(EDATE))-Date(today()))<=180,'91-180',

//                                             if(num(Date(floor(EDATE))-Date(today()))>=181,'181+',

//                                                       if(num(Date(floor(EDATE))-Date(today()))<1 ,'Expired',

//                                                                 if(IsNull(date(EDATE)) OR Date(EDATE)='','Date NA'))))))) AS InvDaysSelection

means here i was calculating as of but now the requirement is as on means any gven date,

so i am using this logic..

How would i would write let

sushil353
Master II
Master II

Please post the sample app

rohitians
Creator III
Creator III
Author

Hey,

I found out solution instead of using in in script i used it as an expression ...

Thanks for your patirnce buddy,

keep helping me..

Thanks and Regards,

Rohit