Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I am trying to load data from several data sources that is in identical format in each source. Each time I load the data I need to tag it with the product type. The file name to load from and the product type to tag the data with are stored as a variables. I want to be able to loop through my load code for the various variable names.
So for each of the multiple product types I want to load the following code, using variables varProduct1, varFile1, varProduct2, varFile2, varProduct3...
TableX:
Add LOAD
$(varProduct1) as Product,
*
FROM
[$(varFile1)]
(biff, embedded labels, header is 1 lines, table is ProdData$);
Something like -
For a = 1 to 9
TableX:
Add LOAD
$('varProduct'&$(a)) as Product,
*
FROM
[$('varFile'&$(a))]
(biff, embedded labels, header is 1 lines, table is ProdData$);
Next a
However QlikView doesn't like $('varProduct'&$(a)) or $('varFile'&$(a)). Is it possible to string together text and a variable value and get QlikView to recognise it as a variable?
hi,
use it like this.
For a = 1 to 9
TableX:
Add LOAD
'varProduct'&$(a) as Product,
*
FROM
['varFile'&$(a)]
(biff, embedded labels, header is 1 lines, table is ProdData$);
Next a
No need to use strings within dollar expansions.
Celambarasan
hi,
use it like this.
For a = 1 to 9
TableX:
Add LOAD
'varProduct'&$(a) as Product,
*
FROM
['varFile'&$(a)]
(biff, embedded labels, header is 1 lines, table is ProdData$);
Next a
No need to use strings within dollar expansions.
Celambarasan
Thank you!
I also managed to use this (without ampersand):
For a = 1 to 9
TableX:
Add LOAD
'$(varProduct$(a))' as Product,
*
FROM
[$(varFile$(a))]
(biff, embedded labels, header is 1 lines, table is ProdData$);
Next a