Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
jim_chan
Specialist
Specialist

Why failed in QlikView Server, ETL failed with error - Unexpected Token

Hi there, 

I have tried below srcipt running on my laptop for more then 10 times and it successful. but when i deploy this to qlikview server. it failed with error "Error: Unexpected token: ',', expected one of: 'OPERATOR_PLUS', 'OPERATOR_MINUS', 'OPERATOR_MULTIPLICATION', 'OPERATOR_DIVISION', 'OPERATOR_STRING_CONCAT', 'like', 'and', ..."

I dont know what else to be fixed. below is my script.

Month:
Load Distinct
num(Month(BIOMETRIC_DT), '00')as NumMonth
From
D:\QlikView\QVD\REPORT_HIST.qvd(qvd);

Let vCount = noofrows('Month');

For i=0 to $(vCount) -1
Let y = If($(x) = 0, 0, $(x) * -1);
Let vMonth = peek('NumMonth',$(i),'Month');
Let vYYYY = Year(MonthStart(AddMonths((Date(Today (), 'DD/MM/YYYY')), $(y))));

$(vMonth):

Load * from
D:\QlikView\QVD\REPORT_HIST.qvd(qvd)
where Month(BIOMETRIC_DT) = $(vMonth) AND year(BIOMETRIC_DT) = $(vYYYY);

Store $(vMonth) into D:\QlikView\QVD\DAILY_REPORT_$(vYYYY)$(vMonth).qvd(qvd);

Drop Table $(vMonth);

Next

 

And the error ended with:

2019-12-05 08:23:29 2469 Let vCount = noofrows('Month')
2019-12-05 08:23:29 2471 For i=0 to 4 -1
2019-12-05 08:23:29 Error: Unexpected token: ',', expected one of: 'OPERATOR_PLUS', 'OPERATOR_MINUS', 'OPERATOR_MULTIPLICATION', 'OPERATOR_DIVISION', 'OPERATOR_STRING_CONCAT', 'like', 'and', ...
2019-12-05 08:23:29 Execution Failed
2019-12-05 08:23:29 Execution finished.

2 Replies
Arthur_Fong
Partner - Specialist III
Partner - Specialist III

How does the variable $(x) looks like?

Brett_Bleess
Former Employee
Former Employee

Jim, did you get things figured out on your own, or are you still looking for help?  Arthur posted a question for you, and that would seem to be the row causing the issue here, so if you were able to figure out what the problem was, please consider posting the solution yourself, and once posted, you can then use the Accept as Solution button on that post to mark it, that way others will know what the problem was too.

The only strange thing I see is in the row prior things are 0 to 4 -1 instead of 0 to 3, the -1 seems to not be taken into account, which may be same issue in the following line...  Here is a Design Blog post that might be of some use:

https://community.qlik.com/t5/Qlik-Design-Blog/Loops-in-the-Script/ba-p/1473543

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.