Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi guys, I was wondering if you could help me with something that I need to develop.
I have several straight loads from csv files, which have the same structure,
and one of the differences between them is the country value.
Example:
//Mexico load:
FlatFile:
LOAD
*
FROM [lib://data/Mexico_$(vMonthToLoad)$(vYearToLoad).csv]
(txt, codepage is 28591, embedded labels, delimiter is ',', msq)
;
//Australia load:
FlatFile:
LOAD
*
FROM [lib://data/Australia_$(vMonthToLoad)$(vYearToLoad).csv]
(txt, codepage is 28591, embedded labels, delimiter is ',', msq)
;
After the successful load, I save the results of the load as successTable in qvd with the structure:
Country | Status | Month | Year
Mexico | Success |Oct | 2021
Australia | Success |Oct | 2021
Malta | Failure | Oct | 2021
How would I make the script to execute the load only for country "Malta"
if the script for Malta is following the same structure as the loads before:
//Malta load:
FlatFile:
LOAD
*
FROM [lib://data/Malta_$(vMonthToLoad)$(vYearToLoad).csv]
(txt, codepage is 28591, embedded labels, delimiter is ',', msq)
;
I was thinking something along the way of Peek() and to make some kind of loop, but I was hopping that you can point me in right direction 😄
Thanks
You could add the Country into the script as a field using:
//Mexico load:
FlatFile:
LOAD
*,
'Mexico' as Country
FROM [lib://data/Mexico_$(vMonthToLoad)$(vYearToLoad).csv]
(txt, codepage is 28591, embedded labels, delimiter is ',', msq)
;
//Australia load:
FlatFile:
LOAD
*,
'Australia' as Country
FROM [lib://data/Australia_$(vMonthToLoad)$(vYearToLoad).csv]
(txt, codepage is 28591, embedded labels, delimiter is ',', msq)
;
//Malta load:
FlatFile:
LOAD
*,
'Malta' as Country
FROM [lib://data/Malta_$(vMonthToLoad)$(vYearToLoad).csv]
(txt, codepage is 28591, embedded labels, delimiter is ',', msq)
;
Then to create a QVD with only Malta at that as a condition in the Store statement:
STORE successTable into .....
Where Country='Malta';