Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi ! I am trying to load the scripts mentioned in page 296 of Qlikview 11 for developers. I am getting some errors. I understand that
some errors for missin fields occur because I commented the fields as per the book. But, what is the reason for the errors ?
Thanks.
Syntax error, missing/misplaced FROM:
[Employment Statistics]:
LOAD Period
& ' | ' & [%Airline ID]
& ' | ' & [%Unique Carrier Code]
& ' | ' & [%Carrier Group ID] as [%Key Field],
[%Airline ID],
[%Unique Carrier Code],
[%Carrier Group ID],
[# Full Time Employees],
[# Part Time Employees],
[# Total Employees],
[# Equivalent FTEs], Characters:
Load Chr(RecNo()+Ord('A')-1) as Alpha, RecNo() as Num autogenerate 26
[Employment Statistics]:
LOAD Period
& ' | ' & [%Airline ID]
& ' | ' & [%Unique Carrier Code]
& ' | ' & [%Carrier Group ID] as [%Key Field],
[%Airline ID],
[%Unique Carrier Code],
[%Carrier Group ID],
[# Full Time Employees],
[# Part Time Employees],
[# Total Employees],
[# Equivalent FTEs], Characters:
Load Chr(RecNo()+Ord('A')-1) as Alpha, RecNo() as Num autogenerate 26
next -
Unknown statement
[Unique Carrier],
[Carrier Code],
[Carrier Name],
Period
(I commented the some of the fields, so this is blank)
FROM
[..\Data Files\QVDs\T_F41SCHEDULE_P1A_EMP.qvd]
(qvd)
Field not found - <Year>
[Link Table]:
Load Distinct
[%Key Field],
[%Key Field] as [%TEMP Key Field],
Year,
Period,
[Month (#)],
Month,
Quarter,
[%Airline ID],
[%Unique Carrier Code],
[%Carrier Group ID],
[Unique Carrier],
[Carrier Code],
[Carrier Name]
Resident [Main Data]
next -
Table not found
Concatenate ([Link Table])
Load Distinct
[%Key Field],
Year,
Period,
[Month (#)],
Month,
'Q' & Ceil([Month (#)]/3, 1) as Quarter,
[%Airline ID],
[%Unique Carrier Code],
[%Carrier Group ID],
[Unique Carrier],
[Carrier Code],
[Carrier Name]
Resident [Employment Statistics]
Where Not Exists([%TEMP Key Field], [%Key Field])
next -
Field not found
Did not find the field "%TEMP Key Field" from the DROP FIELD statement
next -
Field not found
Did not find the field "Month (#)" from the DROP FIELD statement
next -
Field not found
Did not find the field "Month (#)" from the DROP FIELD statement
could you
post your script (from the beginning)
post your first error
Do I have to post the whole script ? It is so long ! I think I might have to use the solution qvw files from the book instead of my qvw to get it right.
Pleas could you attach the complete script or log error txt
Thanks. Log file is attached.
3/21/2014 8:22:50 PM: 0213 [Employment Statistics]:
3/21/2014 8:22:50 PM: 0214 LOAD Period
3/21/2014 8:22:50 PM: 0215 & ' | ' & [%Airline ID]
3/21/2014 8:22:50 PM: 0216 & ' | ' & [%Unique Carrier Code]
3/21/2014 8:22:50 PM: 0217 & ' | ' & [%Carrier Group ID] as [%Key Field],
3/21/2014 8:22:50 PM: 0218 [%Airline ID],
3/21/2014 8:22:50 PM: 0219 [%Unique Carrier Code],
3/21/2014 8:22:50 PM: 0220 [%Carrier Group ID],
3/21/2014 8:22:50 PM: 0221 [# Full Time Employees],
3/21/2014 8:22:50 PM: 0222 [# Part Time Employees],
3/21/2014 8:22:50 PM: 0223 [# Total Employees],
3/21/2014 8:22:50 PM: 0224 [# Equivalent FTEs], Characters:
3/21/2014 8:22:50 PM: 0225 Load Chr(RecNo()+Ord('A')-1) as Alpha, RecNo() as Num autogenerate 26
3/21/2014 8:22:50 PM: Error: Syntax error, missing/misplaced FROM:
Thanks. I am new to QV so I don't know what is the mistake. How do I fix it ?
the text I put in bold in my previous post doesn't work because
***** after comma you need another field
LOAD field1, field2, fieldn
FROM ......... ;
So I guess the missing fields are [Unique Carrier], etc, .....
***** characters is the name of a table
so
Characters:
LOAD ........................;
[Employment Statistics]:
LOAD Period
& ' | ' & [%Airline ID]
& ' | ' & [%Unique Carrier Code]
& ' | ' & [%Carrier Group ID] as [%Key Field],
[%Airline ID],
[%Unique Carrier Code],
[%Carrier Group ID],
[# Full Time Employees],
[# Part Time Employees],
[# Total Employees],
[# Equivalent FTEs],
[Unique Carrier],
[Carrier Code],
[Carrier Name],
Period
FROM
[..\Data Files\QVDs\T_F41SCHEDULE_P1A_EMP.qvd]
(qvd);
Characters:
Load Chr(RecNo()+Ord('A')-1) as Alpha, RecNo() as Num autogenerate 26;
and also
1) you can use the statement
exit script;
to terminate the script;
if you have an error use that statement to identify up to where your script is syntactically correct
2) I usually save before reload
3) there is a debug to follow the execution
but I think you probably already know 1) 2) 3) if you read the good (IMHO the best) book Qlikview for developers