Alteryx Designer Desktop Discussions

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

Check if a column exist

taher1992
7 - Meteor

Hi there - i have files which may contain a column. i want to create a formula which checks if it exist. if it does it should delete the column, if it doesnt then it should continue as normal

 

i am wondering what is the best approach for this 

10 REPLIES 10
Balders
11 - Bolide

Hey If you use a Select tool on an instance that has the column in the data, then deselect it in the check box as shown for "Unwanted Col" below, whenever data comes through this select tool it will drop the column if it exists.

 

Select Unwanted Column.PNG

BenMoss
ACE Emeritus
ACE Emeritus

Further to Balders's suggestion, another option would be to use the dynamic select tool.

 

Using the 'select via formula' method and returning a formula that looks something like...

 

[Name] != "FieldName"

 

Which will essentially filter out the column with that name. The example configuration is shown in the image.

 

Ben

 

2017-05-24_10-47-11.png

taher1992
7 - Meteor

Thanks Guys 

Inactive User
Not applicable

I have same issue except if the column is missing then it should created the column with null values till rest of columns of that table. Can you please guide?

Balders
11 - Bolide
Inactive User
Not applicable

Thanks. This is solved.

dkma
8 - Asteroid

Can we create a new Column in this case. Like wise.... 

 

 

if [Name] != "FieldName" then [NewFiledname] else [FieldName] endif

Jean-Balteryx
16 - Nebula
16 - Nebula

Hi @dkma, what would that column contains as values ?

dkma
8 - Asteroid

Any Values...

 

 

let's say... 

 

The Data would b like. When I Transpose the Data First Column will turn into Row and Columns will be from 1 - 10.. But There in case the numbers from 1 - 11 the Columns would be 1-11. 

 

So. I wanted to check if the columns are 1- 11. if there are no columns from 1 -11 and only from 1-10 , I would like to create a new column 11.

 

in power query. We can check. the Table.HasColumns([col], TableName) with the use of If condition

 

1

2.5
23
32
41
56
78
85.6
94
102.3
  

Labels