Alteryx Designer Desktop Discussions

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

IF a Field Starts with the Value from Another Field then use it to Create a New Field

hellyars
13 - Pulsar

My source is XML or TXT (from XML).  My fields are trapped in a single field -- I have to separate the wheat from the chaff.

 

In the example below, the TITLE of an article is trapped in the EVERYTHING FIELD.  TITLE always begins with the name of a state.   

 

I want to say if EVERYTHING FIELD starts with a value that appears in STATE then it is TITLE else Null.  The hyphen is not a reliable indicator (as it may not be present or may appear in other non-relevant values).

 

How can I do this?

 

 

FILE NUMBERSTATEEVERYTHING FIELD
2019-325134

Missouri

Missouri - Passes Bill to Do Something
2019-325134MissouriAnnex
2019-134513TexasItem No.
2019-325134TexasTexas - Increases Taxes
2019-325134TexasNotice
2019-124145AlaskaAlaska - Requests Federal Funds
2019-124145AlaskaPolicy

 

 

2 REPLIES 2
jrgo
14 - Magnetar

@hellyars 

 

IF STARTSWITH([EVERYTHING FIELD], [STATE])
THEN [EVERYTHING FIELD]
ELSE NULL()
ENDIF
kelsey_kincaid
12 - Quasar

Hi @hellyars ,

Similar to @jrgo 's answer but adjusted to show how you'd do it to set the new field to the word 'Title' instead of 'Everything Field'.

 

Screenshot of an example is below

 

kayers_0-1578070426886.png

 

 

Labels