Alteryx Designer Desktop Discussions

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

Create a new Field (column) with a value based on a condition

arsalanzaki
6 - Meteoroid

Hi champs,

 

I want to create a new field and populate the value in this new field (column) based on rest of the fields in a record.

 

I have created a logic in the workflow, if one of the field name contains LOD, than it will write 1 against it, for all others field names it will write 0.

 

I want to create a new field called Site Type and the value should be based on the following possible scenarios

 

Scenarios

 

1. There is a field with the name that contains LOD (it can be anything which contains LOD, example HCLOD), the value populated in the new field should be "DEM".

2. If there is no field with the name that contains LOD, the value populated in the new field should be "NON DEM".

 

 

I have attached the sample extracted for clarity, please note that the number of fields can be different each time and the position of the field names containing LOD can be different each time as well.

3 REPLIES 3
usmanbashir
11 - Bolide

@arsalanzaki - Please see attached workflow. Hope this is what you were looking for!

arsalanzaki
6 - Meteoroid

Thanks for providing the workflow.

 

In my sample data (DEM Logic), I have included the field "Site Type" however in the actual input data, the field "Site Type" is not present, this field has to be created with either "DEM" or "NON DEM" as the value.

 

I think your solution assumes that the field "Site Type" is part of the input data, can you please suggest the change to your workflow to create "Site Type" as the new field?

usmanbashir
11 - Bolide

@arsalanzaki - the workflow I provided actually doesn't use provided [Site Type] in the logic. It uses the Field Info tool to look at all the field header to see if 'LOD' exists in any of the fields. It then adds in [Site Type] in the formula tool. Let me know if that help clarifies!

Labels