Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
I would need to conditional load same table with different parameters depending on vPriceType variable's value
i.e.
Let vPriceType = Pick(Input('Would you please choose Price Type','Caption'),'Distri','Street');
IF '$(vPriceType)' = Distri
Load:
AllPrices:
LOAD ID,
Country,
Source,
Price,
Date(Date) AS Date
FROM
AllPrices.csv
(txt, codepage is 1252, embedded labels, delimiter is ',', msq)
Where Country = 'UK';
Elseif '$(vPriceType)' = Street
Load:
AllPrices:
LOAD ID,
Country,
Source,
Price,
Date(Date) AS Date
FROM
AllPrices.csv
(txt, codepage is 1252, embedded labels, delimiter is ',', msq)
Where Country = 'DE';
Else Let vPriceType = Pick(Input('Would you please choose Price Type','Caption'),'Distri','Street');
Thanks in advance for your help.
Amko
Perhaps like this:
Switch '$(vPriceType)'
Case 'Distri'
SET vCountry = 'UK';
Case 'Street'
SET vCountry = 'DE';
Case '...something else...'
SET vCountry = '...whatever...';
Default
SET vCountry = '...a default fallback value...';
End Switch
AllPrices:
LOAD ID,
Country,
Source,
Price,
Date(Date) AS Date
FROM
AllPrices.csv
(txt, codepage is 1252, embedded labels, delimiter is ',', msq)
Where Country = '$(vCountry)';
Perhaps like this:
Switch '$(vPriceType)'
Case 'Distri'
SET vCountry = 'UK';
Case 'Street'
SET vCountry = 'DE';
Case '...something else...'
SET vCountry = '...whatever...';
Default
SET vCountry = '...a default fallback value...';
End Switch
AllPrices:
LOAD ID,
Country,
Source,
Price,
Date(Date) AS Date
FROM
AllPrices.csv
(txt, codepage is 1252, embedded labels, delimiter is ',', msq)
Where Country = '$(vCountry)';
LOAD ID,
Country,
Source,
Price,
Date(Date) AS Date
FROM
AllPrices.csv
(txt, codepage is 1252, embedded labels, delimiter is ',', msq)
where
Country = pick(wildmatch('$(vPriceType)', 'Distri','Street'), 'UK', 'DE')
;
Thank you Gysbert
Grazie Massimo