Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
Can anyone explain why the Script Editor is giving me a syntax error on the following:
UNIQUECITYSUPPS:
load
distinct CITYSUPPLIER as CITYSUPPLIERA
Resident
CONTRACTHEADERS;
let vCSRecords = NoOfRows('UNIQUECITYSUPPS');
let vSDRecords = NoOfRows('SMASTERCALENDAR');
let vCHRecords = NoOfRows('CONTRACTHEADERS');
// set up blank table.
CONTRACTDATA:
LOAD * INLINE [
CITYSUPPLIERA, SDATEA, CONTRACTNUMBERA
];
for i = 1 to $(vCSRecords)
let vCitySupplier = chr(39) & Peek('CITYSUPPLIERA', $(i), 'UNIQUECITYSUPPS') & chr(39);
for j = 1 to $(vSDRecords)
//let vCitySupplierA = Peek('CITYSUPPLIERA', $(i), 'UNIQUECITYSUPPS');
let vThisDate = chr(39) & Peek('SDATE', $(j),'SMASTERCALENDAR') & chr(39);
TEMPTABLE:
noconcatenate load
CONTRACTNUMBER,
FAIRID,
CITYSUPPLIER,
VALIDFROM,
VALIDTO
Resident
CONTRACTHEADERS
where
CITYSUPPLIER = $(vCitySupplier)
and (VALIDFROM >= $(vThisDate) and VALIDTO <= $(vThisDate));
let vTempRecords = NoOfRows('TEMPTABLE');
if($(vTempRecords)=0,1,2);
drop table TEMPTABLE;
next;
next;
For some reason it's complaining about the first comma in the if statement at the end. Take out that if statement and everything is OK...
Thanks,
Rory.
if ... then ... else ...
// if($(vTempRecords)=0,1,2);
if $(vTempRecords)=0 then
seta=1;
ELSE
set a=2;
endif;
Hi Massimo,
II'm in the standard Qlikview script editor, even the help on that screen defines the if statement as 'dual If (condition, then_expr [, else_expr])'
Rory
That if statement doesn't make sense there. What do you expect it to do? I'd expect something like:
if( $(vTempRecords)=0 then
// do stuff
else
// do other stuff
end if
if(condition , then , else) is a function
if ... then
...
else
...
endif
is a control statement
I tkhink you need the second one