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

Unexpected token error (12.60)

i get a unexpected token error for the following lines. it works well in 12.10

Let RowCount = NumMax(NoOfRows('Event'),0)-1;
For i=0 to '$(RowCount)'
Let vTempVarName = eventvar & peek('Event_id', $(i));
Let vTempVarValue = peek('Event_Name', $(i));
Let $(vTempVarName) ='$(vTempVarValue)';
Let $(vTempMsgName) = '$(NoteText)';
Let $(vTempMsgid) = '$(noteID)';
Next

The debug data displays the following. and the error is happening in the above bold line.

Let 52 =''

Unexpected token: '52', expected one of: ':', 'IDENTIFIER', 'LITERAL_STRING', 'LITERAL_FIELD'

 

logs in 12.10 below:

 

2021-10-25 18:53:47 0174 Let vTempVarName = eventvar & peek('Event_id', 1)
2021-10-25 18:53:48 0175 Let vTempVarValue = peek('Event_Name', 1)
2021-10-25 18:53:48 0176 Let 52 =''
2021-10-25 18:53:49 0177 Let = ''
2021-10-25 18:53:50 0178 Let = ''

Logs in 12.60 below:

20211025T171408.854+1100 0174 Let vTempVarName = eventvar & peek('Event_id', 1)
20211025T171408.873+1100 0175 Let vTempVarValue = peek('Event_Name', 1)
20211025T171408.888+1100 Error: Unexpected token: '52', expected one of: ':', 'IDENTIFIER', 'LITERAL_STRING', 'LITERAL_FIELD'
20211025T171409.644+1100 0177 Let = ''

 

Can i expect any solution with this issue?

Labels (2)
1 Solution

Accepted Solutions
marcus_sommer

I could imagine that your issue is caused from the wrong syntax of peek(). If peek() is used outside from a load you need to specify the table-name as third parameter. Earlier releases just took the last loaded table but that's not really conform to the rules - maybe they are now more strict or you may have further changes between this loop-statement and the load of the event-table.

This means you need to specify:

Let vTempVarName = eventvar & peek('Event_id', $(i), 'Event');
Let vTempVarValue = peek('Event_Name', $(i), 'Event');
Let $(vTempVarName) ='$(vTempVarValue)';

- Marcus

View solution in original post

4 Replies
NadiaB
Support
Support

Hi Venkatkp

 

There were some mayor changes in Set Analysis from 12.10 to newer versions, pleaser refer to the following article:

 

https://community.qlik.com/t5/Knowledge/Quotes-in-Set-Analysis-change-in-behavior-quot-error-in/ta-p...

 

Kind Regards,

Don't forget to mark as "Solution Accepted" the comment that resolves the question/issue. #ngm
venkatkp
Contributor
Contributor
Author

I can see the major changes from a Set analysis perspective. I can't see any information around the script changes. do you have any other references?

Pitts451
Contributor
Contributor


@liteblue wrote:

i get a unexpected token error for the following lines. it works well in 12.10

Let RowCount = NumMax(NoOfRows('Event'),0)-1;
For i=0 to '$(RowCount)'
Let vTempVarName = eventvar & peek('Event_id', $(i));
Let vTempVarValue = peek('Event_Name', $(i));
Let $(vTempVarName) ='$(vTempVarValue)';
Let $(vTempMsgName) = '$(NoteText)';
Let $(vTempMsgid) = '$(noteID)';
Next

The debug data displays the following. and the error is happening in the above bold line.

Let 52 =''

Unexpected token: '52', expected one of: ':', 'IDENTIFIER', 'LITERAL_STRING', 'LITERAL_FIELD'

 

logs in 12.10 below:

 

2021-10-25 18:53:47 0174 Let vTempVarName = eventvar & peek('Event_id', 1)
2021-10-25 18:53:48 0175 Let vTempVarValue = peek('Event_Name', 1)
2021-10-25 18:53:48 0176 Let 52 =''
2021-10-25 18:53:49 0177 Let = ''
2021-10-25 18:53:50 0178 Let = ''

Logs in 12.60 below:

20211025T171408.854+1100 0174 Let vTempVarName = eventvar & peek('Event_id', 1)
20211025T171408.873+1100 0175 Let vTempVarValue = peek('Event_Name', 1)
20211025T171408.888+1100 Error: Unexpected token: '52', expected one of: ':', 'IDENTIFIER', 'LITERAL_STRING', 'LITERAL_FIELD'
20211025T171409.644+1100 0177 Let = ''

 

Can i expect any solution with this issue?


An "unexpected token" is likely some illegal character code. Such a code is likely not to show up when you print to console. Therefore, print out the string one character at a time or use a protocol analyzer or debugger etc. to see the actual bytes of the string
marcus_sommer

I could imagine that your issue is caused from the wrong syntax of peek(). If peek() is used outside from a load you need to specify the table-name as third parameter. Earlier releases just took the last loaded table but that's not really conform to the rules - maybe they are now more strict or you may have further changes between this loop-statement and the load of the event-table.

This means you need to specify:

Let vTempVarName = eventvar & peek('Event_id', $(i), 'Event');
Let vTempVarValue = peek('Event_Name', $(i), 'Event');
Let $(vTempVarName) ='$(vTempVarValue)';

- Marcus