Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
ferha_jafri
Partner - Creator III
Partner - Creator III

Remove fields from a table mentioned in other table

Hello Experts,

I have a requirement in which I want to exclude columns present in a table in one column and remove them from the main table.

I am attaching a sample in which I have a MainTable from which I want to exclude fields present in other table RemoveColumns in Columns Field. So the Final table will have columns as

ProductID , Product, Shape, Price, Order.

Thanks in advance

Ferha

1 Solution

Accepted Solutions
tresesco
MVP
MVP

Try like:

RemoveColumns:

LOAD

Concat(Columns, ',') as ConcatCols

INLINE [

    Columns

    Quantity

    SalePerson

    OrderDetail

];


Let vCols=Peek('ConcatCols');


DROP Fields $(vCols), ConcatCols;


View solution in original post

3 Replies
andrey_krylov
Specialist
Specialist

Hi, maybe like this

FOR vCounter = 0 to NoOfRows('RemoveColumns')-1

  CurrentField = Peek('Columns', vCounter,'RemoveColumns');

  Drop Field [$(CurrentField)] From [MainTable];

NEXT

tresesco
MVP
MVP

Try like:

RemoveColumns:

LOAD

Concat(Columns, ',') as ConcatCols

INLINE [

    Columns

    Quantity

    SalePerson

    OrderDetail

];


Let vCols=Peek('ConcatCols');


DROP Fields $(vCols), ConcatCols;


marcus_sommer

By large datasets the reverse way of just loading the needed fields might be more suitable as loading everything and removing than the unwanted fields. Take a look on the suggestion from Tresesco which will also work for the load-statement.

- Marcus