Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
How to Drop field values while loading script
Ex: Field has values like A,B,C,D,E,F.....Z, i want to drop filelds 'C','D','E' from the field without using of WHERE/WHERE exists condition.
Thanks,
Nihhal.
any specific reason for not using where/ where exists?
hi.,
just comment the unnecessary fields....
then they don't come to front end.
Is there any reason for not using any functions..
You could also use a keep/join to filter a table like:
load KEY, further fields ... from MainTable;
inner join
load KEY from FilterTable;
But what speaks against using a where-condition?
- Marcus
Use a preceding load with an If but any links to those deleted values will have Nulls. For Example:
Value column 3, 4,5 values will have Nulls in their respective Name field.
LOAD Col1,
IF(Not Match(Name, 'C', 'D', 'E'), Name) AS NameFiltered;
LOAD * INLINE [
Value, Name
1, A
2, B
3, C
4, D
5, E
6, F
];
in script
Drop fields A,B from <Yourtablename>;
Hello Das,
I believe what Nihhal meant here is Field values rather than Fields. It might be typo!
"Ex: Field has values like A,B,C,D,E,F.....Z, i want to drop filelds (should have been drop values) 'C','D','E' from the field without using of WHERE/WHERE exists condition."
Oops. Main question would be why not use Where clause. Any reason for not using it??
Another solution
Table:
Load distinct
IF(Not Match(Name, 'C', 'D', 'E'), Name) AS NameFiltered;
From yourtablename
left Join
Load *
Name as NameFiltered
from yourtablename;
Use PURGECHAR
Syntax:
PurgeChar(text, remove_chars)