Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
nihhalmca
Specialist II
Specialist II

How to Drop field values while loading script

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.

11 Replies
Anonymous
Not applicable

any specific reason for not using where/ where exists?

Anonymous
Not applicable

hi.,

just comment the unnecessary fields....

then they don't come to front end.

Anonymous
Not applicable

Is there any reason for not using any functions..

marcus_sommer

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

vishsaggi
Champion III
Champion III

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

];

rupamjyotidas
Specialist
Specialist

in script

Drop fields A,B from <Yourtablename>;

vishsaggi
Champion III
Champion III

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."

rupamjyotidas
Specialist
Specialist

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;

bkn
Contributor II
Contributor II

Use PURGECHAR

Syntax:

PurgeChar(text, remove_chars)