# Keep/Remove Columns by Condition

**URL:** <https://community.easymorph.com/t/keep-remove-columns-by-condition/1902>\
**Category:** General Q&A\
**Created:** [June 9, 2020, 3:30pm UTC](https://community.easymorph.com/t/keep-remove-columns-by-condition/1902 "2020-06-09T15:30:33Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![rebmanna](https://community.easymorph.com/user_avatar/community.easymorph.com/rebmanna/32/938_2.png) [@rebmanna](https://community.easymorph.com/u/rebmanna)\
**Post date:** [June 9, 2020, 3:30pm UTC](https://community.easymorph.com/t/keep-remove-columns-by-condition/1902/1 "2020-06-09T15:30:33Z")

</div>

Hi,

is it possible to remove Columns by Condition?

 ![KeepWantedColumns](https://community.easymorph.com/uploads/default/original/2X/1/19f9edc5c3b64fc5c45576b9ef05513b54a6ef3e.png)  
[KeepWantedColumnNamesWithValues.zip](https://community.easymorph.com/uploads/short-url/f8yxNEnf9eSYJisHqubrxRMnloM.zip) (8.0 KB)

It would be great, if the remove/Select Column Actions will get Partameters 🙂

Can I do it with a trick (Rename by lookup ...)

Regards,  
Adrian

---

<div class="post-metadata">

**Author:** ![dgudkov](https://community.easymorph.com/user_avatar/community.easymorph.com/dgudkov/32/5_2.png) [@dgudkov](https://community.easymorph.com/u/dgudkov)\
**Post date:** [June 9, 2020, 5:14pm UTC](https://community.easymorph.com/t/keep-remove-columns-by-condition/1902/2 "2020-06-09T17:14:18Z")

</div>

Hi Adrian,

you can already do this with EasyMorph. You can use the "Table metadata" action to produce a list of columns, filter it as necessary (e.g. using a condition), and the use the "Select by lookup" action to keep only the necessary columns.

I've updated your example to work like that.

[KeepWantedColumnNamesWithValues (2).zip](https://community.easymorph.com/uploads/short-url/uY6MNjzBRuQNtK7tQNe0v0dlaN5.zip) (8.3 KB)

 ![image](https://community.easymorph.com/uploads/default/original/2X/0/0c7ce5c3d09e0f73a347162fefe4068126530ba7.png)

---

<div class="post-metadata">

**Author:** ![rebmanna](https://community.easymorph.com/user_avatar/community.easymorph.com/rebmanna/32/938_2.png) [@rebmanna](https://community.easymorph.com/u/rebmanna)\
**Post date:** [June 10, 2020, 6:19am UTC](https://community.easymorph.com/t/keep-remove-columns-by-condition/1902/3 "2020-06-10T06:19:37Z")

</div>

Hi Dmitry,

really great, thanks 👍😊

But now i have another problem in my process if i want to stay generic 🥴

Only certain rows should be returned for one wanted column ("where WantedCol1='WantedVal1')

The table should be filled down for the respective value. Somehow I can't get there

is it possible to "filldown" the wanted Columns **without specifying the column name** , so that the Outputable looks like this picture

 ![WantedOutputTableWantedVals](https://community.easymorph.com/uploads/default/original/2X/f/fa42076f250193502e60fa00f716e85dd2bc4228.jpeg)

That would be great because it would be the solution for my last post:

> [@Generic XML Import](https://community.easymorph.com/t/generic-xml-import/1895):
>
> Hi, I would like to import an XML area generically (subset of the file). The input parameter contains the XML node and the value of the data area. I got the start, but what's next? slight_smile Iterate ...! The returned data area should be a table, so i think i have to create a subproject/module … :-thinking [DynamicXML] Sampleproject [GetDynamicXMLNodes.zip](https://community.easymorph.com/uploads/short-url/caNz9Y8cwlHGggWFqIbW5QMAB6G.zip) (1.8 KB)

best regards and thanks again,

Adrian

---

<div class="post-metadata">

**Author:** ![dgudkov](https://community.easymorph.com/user_avatar/community.easymorph.com/dgudkov/32/5_2.png) [@dgudkov](https://community.easymorph.com/u/dgudkov)\
**Post date:** [June 10, 2020, 4:05pm UTC](https://community.easymorph.com/t/keep-remove-columns-by-condition/1902/4 "2020-06-10T16:05:16Z")

</div>

In this case the "Iterate column" action should help.

See the updated example below.  
[KeepWantedColumnNamesWithValues (3).zip](https://community.easymorph.com/uploads/short-url/ulKEqA0PCf1ixnapvTagWi0ojra.zip) (8.8 KB)

---

<div class="post-metadata">

**Author:** ![rebmanna](https://community.easymorph.com/user_avatar/community.easymorph.com/rebmanna/32/938_2.png) [@rebmanna](https://community.easymorph.com/u/rebmanna)\
**Post date:** [June 10, 2020, 7:23pm UTC](https://community.easymorph.com/t/keep-remove-columns-by-condition/1902/5 "2020-06-10T19:23:30Z")

</div>

Hi Dmitry,

I will try this. Thank you for this great support 👏🙏

Best regards,

Adrian

---

<div class="post-metadata">

**Author:** ![dgudkov](https://community.easymorph.com/user_avatar/community.easymorph.com/dgudkov/32/5_2.png) [@dgudkov](https://community.easymorph.com/u/dgudkov)\
**Post date:** [June 10, 2020, 10:33pm UTC](https://community.easymorph.com/t/keep-remove-columns-by-condition/1902/6 "2020-06-10T22:33:52Z")

</div>

You're welcome 🙂

---

<div class="post-metadata">

**Author:** ![rebmanna](https://community.easymorph.com/user_avatar/community.easymorph.com/rebmanna/32/938_2.png) [@rebmanna](https://community.easymorph.com/u/rebmanna)\
**Post date:** [June 16, 2020, 8:59am UTC](https://community.easymorph.com/t/keep-remove-columns-by-condition/1902/7 "2020-06-16T08:59:36Z")

</div>

Hi Dmitry,  
unfortunately it don't works.  
The "generic Filldown" should start after the first match of "WantedVal1" and only Rows with "WantedVal1". So WantedVal1 (or "WantedVal2") should be a generic Filter in Filldown-Iteration.  
Your solution gifs me OutputTable in Top but it should be the bottom one.  
Sorry i was 3 days out, Therefore I could test only now.

 ![KeepWantedColumnsStartsWithWantedValues](https://community.easymorph.com/uploads/default/original/2X/6/61526a8a51dc6860665564e072001314c58c26aa.png)

regards,

Adrian

---

<div class="post-metadata">

**Author:** ![rebmanna](https://community.easymorph.com/user_avatar/community.easymorph.com/rebmanna/32/938_2.png) [@rebmanna](https://community.easymorph.com/u/rebmanna)\
**Post date:** [June 16, 2020, 2:50pm UTC](https://community.easymorph.com/t/keep-remove-columns-by-condition/1902/8 "2020-06-16T14:50:49Z")

</div>

Hi,  
here another example of the same problem.  
I would like to fill the column with filldown, but only if a certain criterion is met.

In the example, only the area should be filled with the value until the criterion is no longer met or changes (only Data in Green Box should me modified)

 ![FillDownDepending](https://community.easymorph.com/uploads/default/original/2X/4/466678cfdb9ffdefc4dafdb61c4a83cf3bdc27cc.png)

[FillDownFromAboveDependingValue.morph](https://community.easymorph.com/uploads/short-url/uECbi20yvryTEOPoW1xAeO9gM8j.morph) (4.3 KB) [FillDownFromAboveDependingValue.zip](https://community.easymorph.com/uploads/short-url/MuNsioLUgVdh4ERJZHCth2oywi.zip) (9.9 KB)

I hope this example is better for understanding my Problem.

best regards,

Adrian

---

<div class="post-metadata">

**Author:** ![dgudkov](https://community.easymorph.com/user_avatar/community.easymorph.com/dgudkov/32/5_2.png) [@dgudkov](https://community.easymorph.com/u/dgudkov)\
**Post date:** [June 16, 2020, 4:27pm UTC](https://community.easymorph.com/t/keep-remove-columns-by-condition/1902/9 "2020-06-16T16:27:56Z")

</div>

How about this one?

[FillDownFromAboveDependingValue (2).zip](https://community.easymorph.com/uploads/short-url/dQ5WFq9lfNbv81ryGdCszLuZ4Pi.zip) (10.2 KB)

---

<div class="post-metadata">

**Author:** ![rebmanna](https://community.easymorph.com/user_avatar/community.easymorph.com/rebmanna/32/938_2.png) [@rebmanna](https://community.easymorph.com/u/rebmanna)\
**Post date:** [June 17, 2020, 4:54am UTC](https://community.easymorph.com/t/keep-remove-columns-by-condition/1902/10 "2020-06-17T04:54:34Z")

</div>

Hi Dmitry,

it works, thanks. I also tried with filldown, but dont't wanted to change existing data. But it should work, because data is rewritten to old value after filldown. 😌

By the way. I sometime miss a "previous" or "above"-Funktion 😉  
Is it planed?

best regards and thanks again,

Adrian

---

<div class="post-metadata">

**Author:** ![dgudkov](https://community.easymorph.com/user_avatar/community.easymorph.com/dgudkov/32/5_2.png) [@dgudkov](https://community.easymorph.com/u/dgudkov)\
**Post date:** [June 17, 2020, 8:19am UTC](https://community.easymorph.com/t/keep-remove-columns-by-condition/1902/11 "2020-06-17T08:19:58Z")

</div>

> [@rebmanna](#):
>
> By the way. I sometime miss a “previous” or “above”-Funktion 😉  
> Is it planed?

Above/below values can be obtained using the "Shift column" action.

---

<div class="post-metadata">

**Author:** ![rebmanna](https://community.easymorph.com/user_avatar/community.easymorph.com/rebmanna/32/938_2.png) [@rebmanna](https://community.easymorph.com/u/rebmanna)\
**Post date:** [June 17, 2020, 9:10am UTC](https://community.easymorph.com/t/keep-remove-columns-by-condition/1902/12 "2020-06-17T09:10:50Z")

</div>

ok, thank you, i'll test it 👍
