ACT NOW: The Alteryx team will be retiring support for Community account recovery and Community email-change requests Early 2026. Make sure to check your account preferences in my.alteryx.com to make sure you have filled out your security questions. Learn more here
Start Free Trial

Alteryx Designer Desktop Discussions

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

Create a new field based on certain criteria

hash_89
アステロイド

I have a table which looks like this

CodeGroup
X123A
Y123AA
Z345D
G34EE

 

I want to create another column 'Final_Code' combining both the columns.

Condition: If "Code" doesn't have an alphabet in the end, then the value in the new column should be a concatenation of  columns 'Code' & 'Group'

CodeGroupFinal_Code
X123AX123A
Y123AAY123A
Z345DZ345D
G34EEG34E

 

Can someone help me how to proceed further?

 

thankyou.

3件の返信3
JoBen
ボリード

Hi @hash_89, why don't you try using this formula? IIf(Regex_CountMatches(Right([Code],1), "[a-z]")>0,[Code], [Code]+[Group])

mmenth
ボリード

You could try this formula:

 

IF REGEX_Match(Right([Code], 1), "[a-zA-Z]") THEN [Code] ELSE
[Code] + ToString([Group]) ENDIF

 

Capture.PNG

ivoller
クエーサー

How about a formula like

 

[Code] + iif(regex_match(right([Code],1),"\d"),[Group],"")

ラベル
トップのソリューション投稿者