Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Join this live chat April 6, 10AM EST - QlikView to Qlik Sense REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
hartleyr
Contributor III
Contributor III

Field not Found in For Each statement but found when hard-coded

Hi All

I have an incredibly frustrating issue with my script.  I'm trying to use a for each statement with a where clause, and it doesn't matter how i write it, I'm getting 'field not found - LINL1'.  If I hard code this information into the script, it works fine.

I'm assuming I'm doing something stupid... If anyone can help shed any light, it'd be greatly appreciated....

Here is my script.  FlowRate works fine, but Results doesn't;

For Each vSchema in '5', '2';
FlowRate:
LOAD @1 as DateTime,
@2 as [Flow Rate],
$(vSchema) as Pump
FROM
$(vInputPath)Environmental\Renewi - Pump Station $(vSchema)*.csv
(txt, codepage is 28591, no labels, delimiter is ',', msq, header is 1 lines);
next

store * from FlowRate into $(vOutputPath)Flow Rates.qvd (qvd);
drop table FlowRate;

 

For each vSample in 'LINL1','LINL2','LINSD';
Results:

LOAD [Parameter:],
[Date:],
[Operator ID:],
[Sample ID:],
[Sample ID:]&'_'&Program AS %SampleKey,
[Sample Number],
Program,
Result,
Unit,
Name,
Error,
Wavelength,
Value,
Unit1,
Dilution
FROM
$(vInputPath)Environmental\Lingerton*.xlsm
(ooxml, embedded labels, table is Raw_data)
where Program = 302 and upper([Sample ID:])= $(vSample)
;
next

store * from Results into $(vOutputPath)Ammonia Results.qvd (qvd);
drop table Results;

 

Change the script to this and it works???

 

//For each vSample in 'LINL1','LINL2','LINSD';

Results:

LOAD [Parameter:],
[Date:],
[Operator ID:],
[Sample ID:],
[Sample ID:]&'_'&Program AS %SampleKey,
[Sample Number],
Program,
Result,
Unit,
Name,
Error,
Wavelength,
Value,
Unit1,
Dilution
FROM
$(vInputPath)Environmental\Lingerton*.xlsm
(ooxml, embedded labels, table is Raw_data)
where Program = 302 and [Sample ID:]= 'LINL1'
;

//Next
store * from Results into $(vOutputPath)Ammonia Results.qvd (qvd);
drop table Results;

 

Thanks in advance

Labels (4)
1 Solution

Accepted Solutions
jochem_zw
Partner
Partner

the where statement should be:

where Program = 302 and upper([Sample ID:])= '$(vSample)'

so add the quotes

View solution in original post

2 Replies
jochem_zw
Partner
Partner

the where statement should be:

where Program = 302 and upper([Sample ID:])= '$(vSample)'

so add the quotes

View solution in original post

hartleyr
Contributor III
Contributor III
Author

Thanks Jochem_zw.  I knew it would be something silly I was missing (though could have sworn I'd tried that already!)