Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
解決済み

Multiple Conditions

Chirag_Gandhi07
アステロイド

Hi, I am trying to create a conditional statement where I output "Stage 2" for assets that fall between months 4 - 32. The problem is that I want it for assets with lease terms of 36 months. In my data set, I have assets with lease terms of both 36 and 48 months. Is this possible using a conditional statement? This is what I have but I am getting an error: IF [Term] == "36" && [Asset Period] >= "4" && [Asset Period] <= "32" THEN "Stage 2" ELSE "Stage 3" ENDIF

10件の返信10
DavidP
17 - Castor
17 - Castor

Hi there,

 

Just change your syntax:

 

IF [Term] = "36" and ([Asset Period] >= "4" and  [Asset Period] <= "32") THEN "Stage 2" ELSE "Stage 3" ENDIF

Chirag_Gandhi07
アステロイド

I am still getting the same error message. "Invalid type in operator =="

Kenda
16 - Nebula
16 - Nebula

@Chirag_Gandhi07 Are your fields numeric or strings? If they're numeric, get rid of the quotes.

Chirag_Gandhi07
アステロイド

So the conditional statement is running but it is not outputting correctly.

Chirag_Gandhi07
アステロイド

The column next to the 3's should output Stage 1 but for some reason it isn't

DavidP
17 - Castor
17 - Castor

Could you attach your Alteryx workflow, then we'll be in a better position to help

Chirag_Gandhi07
アステロイド

Here is the workflow

Chirag_Gandhi07
アステロイド

And the output

Kenda
16 - Nebula
16 - Nebula

@Chirag_Gandhi07 When you create your Asset Period field, make it a numeric data type. You will have to change the "0" to just 0 for this to work.

 

Additionally, do you want your fields to equal the string "Null" or be null? As of now, you are assigning the string value of "Null" to your fields. If this is not what you want, use Null() instead.

ラベル