Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I am using SubField() while loading to get separate rows for a field separated by comma(,).
Ex: Sample data as below.
Devices | Slot | Value
-----------------------------
ABC1,ABC2,ABC3 | 1 | 4345
ABC2 | 3 | 3r545r3
ABC4,ABC7 | 5 | 3435r45
Load Script that I am using:
LOAD
SubField(Devices,',') as Device,
Slot,
Value
I need to add a condition to this load something like WildMatch(Device,'ABC1','ABC2','ABC3').
Can anyone help how this match condition be applied for a subfield?
Thanks
I got the solution. I used preceding LOAD as below.
LOAD * where WildMatch(Device,'ABC1','ABC2','ABC3');
LOAD
SubField(Devices,',') as Device,
Slot,
Value
You can use a preceding load
Data:
LOAD * INLINE [
Devices| Slot| Value
ABC1,ABC2,ABC3 | 1 | 4345
ABC2 | 3 | 3r545r3
ABC4,ABC7 | 5 | 3435r45
] (delimiter is '|');
Output:
LOAD
*
WHERE
WildMatch(Device,'ABC1','ABC2','ABC3');
LOAD
SubField(Devices,',') as Device,
Slot,
Value
RESIDENT Data;
Drop table Data;
Hi @nigharikkha ,
May be try like this,
LOAD
If(Wildmatch(SubField(Devices,','),'ABC1','ABC2','ABC3'),Your Output,0) as Device,
Slot,
Value
FROM XXX;
Hope this helps!
What is your expected output??
@SaraK Hi I tried this but there the function does not allow subfield inside.
I got the solution. I used preceding LOAD as below.
LOAD * where WildMatch(Device,'ABC1','ABC2','ABC3');
LOAD
SubField(Devices,',') as Device,
Slot,
Value
You can use a preceding load
Data:
LOAD * INLINE [
Devices| Slot| Value
ABC1,ABC2,ABC3 | 1 | 4345
ABC2 | 3 | 3r545r3
ABC4,ABC7 | 5 | 3435r45
] (delimiter is '|');
Output:
LOAD
*
WHERE
WildMatch(Device,'ABC1','ABC2','ABC3');
LOAD
SubField(Devices,',') as Device,
Slot,
Value
RESIDENT Data;
Drop table Data;
Thanks @maxgro