Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi
I'm use an "if statement" to check a condition in load script, but I got this syntax error
this is the if statement:
IF count([Calendar year])= 0 THEN
DROP TABLE Data;
Else
Load data…
ENDIF
The error I got is :
Unexpected token: '=', expected: 'THEN'
IF (count([Calendar year])>>>>>>=<<<<<< 0) THEN
I also tried to put count([Calendar year])= 0 inside (), but still getting the same error.
any idea why?
Thanks
Yvonne
Change variable and assign vTotalYear to random value when Calendar Year field not exists.
Let vTotalYear = IF(Len(Trim(Peek('TotalYear',0,'Temp')))=0,100000,Peek('TotalYear',0,'Temp'));
You can do something like below..
First load your original table...
Temp:
Load Count(Distinct Year) as TotalYear;
Load FieldValue('Calendar year',RecNo()) as Year
AutoGenerate FieldValueCount('Calendar year');
Let vTotalYear = Peek('TotalYear',0,'Temp');
Drop Table Temp;
IF vTotalYear = 0 THEN
Drop Table Data;
Else
Load your data.....
Hi Manish
Thanks for your code. I think it's working when vTotalYear = 0 is tested true. However, it's possible that there's the field 'Calendar year' doesn't exist. and under that condition, it should go to else statement.. But the code is giving a field not found error. Any idea how to adjust the code?
Change variable and assign vTotalYear to random value when Calendar Year field not exists.
Let vTotalYear = IF(Len(Trim(Peek('TotalYear',0,'Temp')))=0,100000,Peek('TotalYear',0,'Temp'));