Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.

Alteryx Designer Desktop Discussions

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

Replace string after text

bsolove
8 - Asteroid

I have values that contain a decimal and I want to remove the decimal and the text after the decimal.  I would prefer to use a formula vs parsing the text first because I only want it to apply to records that have Texas as a jurisdiction and where the description field contains the word credits.  Is there anyway to do this as one formula vs filter the data, parsing and then unioning back together?

3 REPLIES 3
RolandSchubert
16 - Nebula
16 - Nebula

Ho @bsolove ,

 

you can use a formula:
Left([Field1], STRCSPN([Field1],'.'))

 

STRCSPN counts the number of characters to '.' (if there is no decimal separator, the length is returned). LEFT takes the characters left to '.'

 

If you want to apply the formula only to specific records, you can use an IF clause:

IF CONTAINS([Field2], 'Texas') THEN

Left([Field1], STRCSPN([Field1],'.'))

ELSE

[Field1]

ENDIF

 

Hope this is helpful

 

Best,

 

Roland

 

markcurry
12 - Quasar

I think this formula should do it...

 

LEFT([Data],FindString([Data], "."))

 

Find the position of the . and then read from the left to that value.

VianneyM
Alteryx
Alteryx

hi @bsolove,

 

I found this way to solve it with the formula tool

 

VianneyM_0-1578593431066.png

 

Let me know what do you think

 

Best,

Vianney

Best,
Vianney
Labels