We are celebrating the 10-year anniversary of the Alteryx Community! Learn more and join in on the fun here.
Start Free Trial

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Select columns based on another column value

rachana19
8 - Asteroid

Hi All,

 

I am working on a use case where I need to select some columns based on value of one of the column in row.

The sample example shown below:

Reference IDNameIndicatorStore1Address1Store2Address2
ID1A1StoreXAddressXStoreAAddressX
ID2B1StoreYAddressYStoreBAddressY
ID3C2StoreZAddressZStoreCAddressZ

 

So, when the indicator is 1, I need to take forward columns Reference ID, Name, Store1 and Address1,

and when the indicator is 2, I need to take forward columns Reference ID, Name, Store2 and Address2.

 

Then I have big business logic to work on these columns.

 

Is there any simple way to achieve this? Thanks much in advance.

 

6 REPLIES 6
grossal
15 - Aurora
15 - Aurora

Hi @rachana19,

 

here is a quick way to do this:

 

grossal_0-1587973080221.png

 

 

Result:

grossal_1-1587973104876.png

 

 

Workflow attached. Let me know what you think.

 

Best

Alex

DavidP
17 - Castor
17 - Castor

I would use a filter tool to split the data to 2 different streams based on the value of [Indicator], then use a Select tool to select the correct fields for each stream.

 

You can recombine the streams with a Union Tool, but would have to rename the different fields in each select tool.

rachana19
8 - Asteroid

Hi Alex,

 

Thanks a lot for this. This works as expected.

rachana19
8 - Asteroid

Hi David,

 

Thanks a lot for this. This works as expected.

grossal
15 - Aurora
15 - Aurora

That's great! @rachana19 

 

Would you mind accepting the post as a solution? 😃

rachana19
8 - Asteroid

Done. Thanks again.

Labels
Top Solution Authors