Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Unexpected token: '<=', expected one of: '(', 'ZTestw_z', 'OPERATOR_PLUS', 'OPERATOR_MINUS', 'not',

Hi Team,

I am ruuning the below Script. But I am getting below Issue:

 

//Duplicate entfernen
NoConcatenate
Duplikate:
LOAD
RowNo() as No,
[Event ID] as EVENT_ID,
[Create date] ,
count([Event ID]) as EVENT_COUNT,
VIN as VINOrdered,
if(lower(trim([Service type])) = 'accident_info', 'info',[Trigger type]) as TriggerTypeOrdered,
TIMESTAMP_TEMP as CreateDateOrdered

Resident ACALL_DATA_PROD
Group by [Event ID], VIN, [Service type], [Trigger type], TIMESTAMP_TEMP,[Create date]
Order By VIN, ORDER_TIME asc
;


DUBLICATES:

LOAD * INLINE [VINDuplicate];

let vCreateDate = now();

for vI = 1 to (NoOfRows('Duplikate') - 1)

let vDateC = Peek('CreateDateOrdered', vI, 'Duplikate');
Let vEventId = Peek('EVENT_ID', vI, 'Duplikate');
Let vNo = Peek('No', vI, 'Duplikate');

let vInterval = interval(vDateC - vCreateDate, 'ss');

if Peek('VINOrdered', vI, 'Duplikate') = Peek('VINOrdered', (vI - 1), 'Duplikate') and lower(Peek('TriggerTypeOrdered', vI, 'Duplikate')) = 'automatic' and 'info' <> lower(Peek('TriggerTypeOrdered', (vI - 1), 'Duplikate')) and MakeDate(year(vDateC),Month(vDateC),day(vDateC)) = MakeDate(year(vCreateDate),Month(vCreateDate),day(vCreateDate)) and $(vInterval) <= '3600' THEN
Concatenate(DUBLICATES)


LOAD
'$(vEventId)'
as VINDuplicate,
'$(vDateC)'
as CreateDateDuplicate,
'YES'
as FlagDuplicate
AUTOGENERATE (1)
;

else
if lower(Peek('TriggerTypeOrdered', vI, 'Duplikate')) = 'automatic' then
let vCreateDate = Peek('CreateDateOrdered', vI, 'Duplikate');
endif
endif

next

let vCreateDate = now();

for vI = 1 to (NoOfRows('Duplikate') - 1)
let vDateC = Peek('CreateDateOrdered', vI, 'Duplikate');
Let vEventId = Peek('EVENT_ID', vI, 'Duplikate');

let vInterval = interval(vDateC - vCreateDate, 'ss');

if Peek('VINOrdered', vI, 'Duplikate') = Peek('VINOrdered', (vI - 1), 'Duplikate') and lower(Peek('TriggerTypeOrdered', vI, 'Duplikate')) = 'manual' and MakeDate(year(vDateC),Month(vDateC),day(vDateC)) = MakeDate(year(vCreateDate),Month(vCreateDate),day(vCreateDate)) and $(vInterval) <= '3600' THEN
Concatenate(DUBLICATES)

LOAD
'$(vEventId)'
as VINDuplicate,
'$(vDateC)'
as CreateDateDuplicate,
'YES'
as FlagDuplicate
AUTOGENERATE (1)
;

else
if lower(Peek('TriggerTypeOrdered', vI, 'Duplikate')) = 'manual' THEN
let vCreateDate = Peek('CreateDateOrdered', vI, 'Duplikate');

endif
endif

next

left join(ACALL_DATA_PROD)


LOAD
distinct
VINDuplicate as [Event ID],
FlagDuplicate
Resident DUBLICATES;

ACALL_DATA_tmp:
LOAD*,
If(isNull(FlagDuplicate), 'NO', FlagDuplicate) AS FlagDuplicate_tmp

Resident ACALL_DATA_PROD;

Drop Tables DUBLICATES, Duplikate;

 

Could some one help me on the below error Code:

Unexpected token: '<=', expected one of: '(', 'ZTestw_z', 'OPERATOR_PLUS', 'OPERATOR_MINUS', 'not', 'bitnot', 'LITERAL_NUMBER', ...

6 Replies
Or
MVP
MVP

Typically this suggests one of your variables isn't getting the expected value, and when the result of that variable is input into a statement, it is generating an incorrect statement.

While it is possible that some people here might be able to spot the exact problem just by reading your code, I can't. I recommend running the script in debug mode, one step at a time, and checking the variables just before the problem pops up to see which one(s) are problematic. If you can pinpoint the issue further, you can hopefully either resolve it yourself or post here with additional information.

lblumenfeld
Partner Ambassador
Partner Ambassador

I agree with the previous comment. It's likely that one of your date variables contains something other than what it should. Place a breakpoint on each of the two places where you're doing the MakeDate .... <= , and look at what is in each date component variable.

Post the values for us to see if you're still not sure after looking at them, and we'll try to help you.

manojciti
Contributor III
Contributor III

HI ,

 

Were you able to fix this issue ? I also getting same error in QV April 2020 

when running app from QMC, same app reload successfully when run locally.

 

Thanks

Or
MVP
MVP

See my original response from 2018 - the same still applies. This is a fairly generic message which typically suggests something is wrong with the contents of one of your variables. Given that it happens from QMC but not locally, it may be related to a file-related function which works from the local context but not from the server context.

manojciti
Contributor III
Contributor III

Appreciate your response and I think you are right its something to do with FileTime function. 

Below is what I'm doing and its throwing error  at  check  of  >= at last line below

SET Source='https://icgshare.nam.xyz.net/sites/blaroc/Shared Documents/Scorecard Source Static Data (Restricted Entry)/ ALLOCATIONS.xlsx';

let s_ft = Num(FileTime('$(Source)'));


SET Target= '//H51010000/Production/Imports/PANO/DEV/CLARITY/FTE_ALLOCATIONS.csv';

let t_ft = Num(alt(FileTime('$(Target)'), 0));

 

if $(s_ft) >= $(t_ft) Then

TRACE SAVE FILE INTO DEV/Import;

 

Can you please help if any changes i can do to solve this

 

Thanks 

Or
MVP
MVP

Unfortunately, there's no way I can help you since this code won't run without access to your files, which I don't have. Check that the server has access to the file linked in the Source and Target variables, both in the sense that nothing limits access to the files from the server itself and that the user running the Qlik services has access to these files/locations. Odds are the crash is a result of one of these functions returning null, but it's up to you to figure out why this is happening.