Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all,
I have a sample data and I want to flag to 1 all values that contains 4 or 5 or 6 and 7 or 8 or 9.
...4..7 or ...4..8 or ...4..9
...5..7 or ...5..8 or ...5..9
...6..7 or ...6..8 or ...6..9
Thank for your help.
Hi,
Try like this
LOAD
*,
If(WildMatch(DATA, '*4*7','*4*8', '*4*9', '*5*7', '*5*8', '*5*9', '*6*7', '*6*8', '*6*9'), 1, 0) AS FLAG_1,
If(WildMatch(DATA, '1*6','1*7','1*8','1*9','2*6','2*7','2*8','2*9') AND NOT WildMatch(DATA, '*4*', '*5*'), 1, 0) AS FLAG_2;
LOAD
*
FROM DataSource;
Regards,
Jagan.
Hi,
You can add this flag in the load script
LOAD
*, if(findoneof(DATA,456789) > 0,1,0) as FlagTest;
Load * Inline
Regards
Anand
Hi Anand,
Thank you for your reply. I use the findoneof function but how can I get values
that contains 1..6 or 1..7 or 1..8 or 1..9 or 2..6 or 2..7 or 2..8 or 2..9
if(findoneof(DATA,126789) > 0,1,0) as FlagTest don't give me the good result.
can you please post sample data together with expected result to clarify your requirements
Try the following expression
If(Match(Data,'4','5','6') > 0 and Match(Data,'7','8','9') > 0,1,0) as Flag
Hi Marco,
I want to create 2 FLAG:
- FLAG_1 : all values that contains the string : ....4..7 or ....4..8 or ....4..9 or ....5..7 or ....5..8 or ....5..9 or ....6..7 or ....6..8 or ....6..9
- FLAG_2 : all values that contains the string : 1..6 or 1..7 or 1..8 or 1..9 or 2..6 or 2..7 or 2..8 or 2..9 without 4 and 5 in the string.
Hi,
Try like this
LOAD
*,
If(WildMatch(DATA, '*4*7','*4*8', '*4*9', '*5*7', '*5*8', '*5*9', '*6*7', '*6*8', '*6*9'), 1, 0) AS FLAG_1,
If(WildMatch(DATA, '1*6','1*7','1*8','1*9','2*6','2*7','2*8','2*9') AND NOT WildMatch(DATA, '*4*', '*5*'), 1, 0) AS FLAG_2;
LOAD
*
FROM DataSource;
Regards,
Jagan.
if( match(Fieldname ,4 , 5 , 6 ) and match(Fieldname ,7 , 8 , 9),1,0) as Flag
or
if( (Fieldname=4 or Fieldname=5 or Fieldname=6 ) and (Fieldname=7 or Fieldname=8 or Fieldname=9 ) ,1,0)
hope thia helps
Try This
if(findoneof(DATA,456) > 0 AND findoneof(DATA,789)>0,1,0 ) as FLAG;
Hi Nagaiank,
Thank for your response but all values are selected. I have a flag with 0 and not 1.
The value 12 is selected but not contains 4,5,6 and 7,8,9