The Alteryx Community is a finalist in three 2026 CMX Awards! Help us win Customer Support Community, Most Engaged Community, and User Group Program of the Year - vote now! (it only takes about 2 minutes) before January 9.
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.
GELÖST

parse for a certain word or get value at certain string

eaglepath
Meteoroid

In the Data below i want to POL and corresponding value from Part so basically where ever is POL placed we need to get same number of value from part column:

 

Data:

 

OpsPart
key-ID-ISSUE-POL-COT856-658-985-963-458
key-ID-ISSUE-POL968-548-785-9635
key-ID-ISSUE-POL-COT-DT4563-568-475-96242-544

 

Result:

 

OpsPart
POL963
POL9635
POL96242
13 ANTWORTEN 13
Carolyn
12 - Quasar
12 - Quasar

This formula should work:

 

 

GetPart([Part], "-", REGEX_CountMatches(REGEX_Replace([Ops], "(.*)(POL).*", "$1$2"), "-"))

 

 

 

  1. REGEX_Replace([Ops], "(.*)(POL).*", "$1$2")
    1. Remove everything after "POL"
  2. REGEX_CountMatches([Output from #1], "-") )
    1. Count the number of "-". This will establish where "POL" is located. 
  3. GetPart([Part], "-", [Output from #2])
    1. In the Part # field, using a delimiter of "-", find what's in the location from #2
    2. Note, GetPart is 0 based. In your examples, "POL" is in the 4th spot, but in GetPart, to find the 4th spot, you would use "3". Since we're counting "-" in Step #2, this will work for the 0 based positioning

2024-08-28_12-44-11.png

 

Edit: 

 

Revised WF attached. I split up the 3 formula parts into separate formula spots. It'll be easier to see each step's output (vs the final combined formula, which is what's above)

 

2024-08-28_12-51-23.png

ChrisTX
16 - Nebula
16 - Nebula

One option attached

 

Screenshot 2024-08-28 144728.png

 

Chris

eaglepath
Meteoroid

Forumla 3 and 4 (get part) is having an issue please check

cristiane_dsc
Meteor

I have managed to get the desired output exactly as you wrote. I hope this is what you are looking for.

 

 

Captura de tela 2024-08-28 171404.jpg

 

eaglepath
Meteoroid

Christiane_DSC  is it doing by the position or if the position changes it will pick this regardless?

binu_acs
Polaris

@eaglepath another method

image.png

Carolyn
12 - Quasar
12 - Quasar

@eaglepath - What error are you seeing with my formulas 3 and 4? It's working fine for me - happy to help troubleshoot your error if you show it!

flying008
Aurora

Hi, @eaglepath 

 

There is a formula of dynamic position for you:   [ It can used in any version. ]

 

Spoiler
RegEx_Replace([Part], '^((?:[^-]*?\-){' + ToString(REGEX_CountMatches(Left([Ops], FindString([Ops], 'POL')),'-')) + '})(\d+?)(-.+|$)', '$2')

 

Yogesh1795
Asteroid

You use simple use (\d+ - \d+ - \d+ -) (.*) - (.*) and get the $2 Value in regex replace tool.

 

Beschriftungen
Top-Lösungs-Autoren