Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in NYC Sept 4th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

FOR EACH load error

Hi,

i'm trying to use a FOR EACH statement in a load script but the scrip fails. Any ideas what's wrong?


FOR EACH region in 'A','B','D','E','F','G','H','J','K'
OLATPOSTCODE:
Load @1 as Seven_digit_Postcode,
@2 as Eight_digit_PostCode,
trim(replace(@2,' ' , '')) as Short_Postcode,
@4 as Term_Date,
@5 as County_Code,
@6 as LA_Code,
@7 as Ward_Code,
@9 as OS_Lat,
@10 as OS_Long,
@12 as SHA,
@14 as Country,
@17 as Region_Code

FROM

(txt, codepage is 1252, no labels, delimiter is ',', msq)
WHERE @4 = '' and @17 = 'region';
Store OLATPOSTCODE into 'C:\Userwork\OLAT\May 2010 Development\Postcode QVDs\OLATPOSTCODE' & '$(region)';
drop table OLATPOSTCODE;
NEXT


Thanks.

3 Replies
biester
Specialist
Specialist

Which error?

The path

C:\Userwork\OLAT\May 2010 Development\Postcode data\Copy of OMSAS CD (to be left unchanged, so that information is backup up)\Data\NSPDF_MAY_2007_EN_100M\NSPDF_MAY_2007_EN_100M.csv]

is rather, well, unconventional. Have you tried with a more simple path?

Rgds,
Joachim

Not applicable
Author

It is unconventional but worked fine without the FOR EACH loop. It isn't error message - the script hangs and then the pop up appears saying that the load has failed.

Thanks again

Not applicable
Author

May be the file name in the store command is the reason for this error message.

Try

Store OLATPOSTCODE into 'C:\Userwork\OLAT\May 2010 Development\Postcode QVDs\OLATPOSTCODE$(region)';


instead of

Store OLATPOSTCODE into 'C:\Userwork\OLAT\May 2010 Development\Postcode QVDs\OLATPOSTCODE' & '$(region)';


I guess you want to have a file named OLATPOSTCODEA if your region is 'A'. But the result of the file name in your script is OLATPOSTCODE' & 'A. May be the characters are a problem for your file system.

Rgds,
Jonas