Alert: There is a planned Community maintenance outage October 16th from approximately 10 - 11 PM PST. During this time the Alteryx Community will be inaccessible. Thank you for your understanding!

Alteryx Designer Desktop Discussions

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

Using Left in IF statement_Alteryx

SakshiBan
7 - Meteor

I m working on a IF statement , however for One of my parameter , as a result i want only Account no's first digit starting with 4, so i thought of applying Left within IF statement-

 

Is this correct?

 

IF Contains([ACCOUNT NBR],1="4")THEN [A]+[B]ELSE [A]-[B) ENDIF

 

 

4 REPLIES 4
DavidP
17 - Castor
17 - Castor

Hi @SakshiBan 

 

I would use the Left() statement for this, but you have to make sure that your account number is a Text datatype. If this is the case your if statement will look like this:

 

IF Left([ACCOUNT NBR],1)="4" THEN...

 

If the Account number field is a number data type, you can modify the statement like so:

 

IF Left(ToString([ACCOUNT NBR]),1)="4" THEN...

binuacs
21 - Polaris

@SakshiBan 

 

IF LEFT([ACCOUNT NBR],1) = '4' THEN [A] + [B]
ELSE [A] - [B]
ENDIF



OR

IF StartsWith([ACCOUNT NBR], '4') THEN [A] + [B]
ELSE [A] - [B]
ENDIF

 

SakshiBan
7 - Meteor

Thanks so much that was a great help!

SakshiBan
7 - Meteor

Thanks so much that was a great help!

Labels