Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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
Try like:
RemoveColumns:
LOAD
Concat(Columns, ',') as ConcatCols
INLINE [
Columns
Quantity
SalePerson
OrderDetail
];
Let vCols=Peek('ConcatCols');
DROP Fields $(vCols), ConcatCols;
Hi, maybe like this
FOR vCounter = 0 to NoOfRows('RemoveColumns')-1
CurrentField = Peek('Columns', vCounter,'RemoveColumns');
Drop Field [$(CurrentField)] From [MainTable];
NEXT
Try like:
RemoveColumns:
LOAD
Concat(Columns, ',') as ConcatCols
INLINE [
Columns
Quantity
SalePerson
OrderDetail
];
Let vCols=Peek('ConcatCols');
DROP Fields $(vCols), ConcatCols;
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