Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
load * inline [
Region,Sales
A,10
B,20
C,30
D,40
];
Now here I want to load only Region 'C' data using only Where Exists function.Please help me in doing that. I am also trying like this.
load *,1 as flag
Resident A
Where Exists(Region,'C');
Thanks
It would be something like this
LOAD * INLINE [
Region
C
];
LOAD * INLINE [
Region,Sales
A,10
B,20
C,30
D,40
]
Where Exists(Region);
It would be something like this
LOAD * INLINE [
Region
C
];
LOAD * INLINE [
Region,Sales
A,10
B,20
C,30
D,40
]
Where Exists(Region);
Try to introduce single inline table
LOAD * Inline
[
RegionToload
C
];
load * inline [
Region,Sales
A,10
B,20
C,30
D,40
] Where Exists(RegionToload,Region);
Thanks
Find the attached for the sample example for the explain of the Where Exists
//In this inline table we add single field RegionToload which has only field with Region C to load
ToloadTable:
LOAD * Inline
[
RegionToload
C
];
//In this we are loading only Region C data by this line Where Exists(RegionToload,Region);
Table1:
load * inline [
Region,Sales
A,10
B,20
C,30
D,40
] Where Exists(RegionToload,Region);
Regards
Anand
Where Exists() will filter an ongoing load by analysing a specific column in the current row and checking whether the value in that column exists in a named field ( ! )
The single parameter version of Exists() will check whether the value in column FieldName is present in the field with the same name. That field may not exist before starting the current load, for example if you you want to avoid loading duplicates.
The two-parameter version will check the field specified in the first parameter for existence of the value specified in the second parameter. Usually this second parameter consists of a differently named cell in the current row, or of a concatenation of multiple cells in the current row.
Your code won't do anything useful because you are checking for a static value in a field that has been created before and does contain value 'C' for sure. Which lmeans that all rows will be loaded anyway.
Thanks Anand
Kaushal,
There is a simple way also as i seen you are trying by adding some table you can do another way also see the inline load by using Where with Like key wod
Where Region like 'C'
load * inline [
Region,Sales
A,10
B,20
C,30
D,40
] Where Region like 'C' ;
Regards
Anand