Get Inspire insights from former attendees in our AMA discussion thread on Inspire Buzz. ACEs and other community members are on call all week to answer!

Alteryx Designer Desktop Discussions

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

REGEX_Match in Dynamic Select Tool

Lifesigns
6 - Meteoroid

Hi All,

 

I'm working on a large dataset extracted from an API and I am unable to specify what fields are returned.

 

I have tried the Dynamic Select tool to only get back the fields I know I'll need in the database.

 

An example field is:

 

knownAssociates_1_dossierID

 

Tough there could be up to 99 of them with the 1 changing hence my alternative approach.

 

My dynamic tool expression is: 

 

REGEX_Match([Name], 'knownAssociates\.*?\d{1,2}\.dossierID')

 

also tried:

 

REGEX_Match([Name], 'knownAssociates\d+dossierID')

 

also

 

REGEX_Match([Name], 'knownAssociates\d+dossierID')

 

The syntax is likely not right but I've tried various things and can't get it to work so I'd appreciate any input.

 

Thx

 

3 REPLIES 3
Maskell_Rascal
13 - Pulsar

Hi @Lifesigns 

 

If the fields are constant in that they always start with "knownAssociates" and end with "dossierID", then there are a number of ways you can go about this. If you want to use REGEX_Match, then you can modify the first formula you provided to look like this:

 

REGEX_Match([Name], 'knownAssociates.\d{1,2}.dossierID')

 

Incoming Data:

Maskell_Rascal_0-1623425122979.png

 

Output after Dynamic Select:

Maskell_Rascal_1-1623425147154.png

 

 

Cheers!

Phil 

Lifesigns
6 - Meteoroid

Thanks!

apathetichell
18 - Pollux

you're close but the match for

knownAssociates_1_dossierID

 

where the 1 can be any number is:

regexmatch([name],"knownAssociates_\d+_dossierID") - the second underscore is key to the match and missing from your try \d{1,2} will only grab a number from 0 to 99.

 

the \d+ means a number - any number of times. So if the file is knownAssociates_10101001_dossierID - it should still match.

 

If that doesn't work your naming convention is off and you should use a field info to look at your fieldnames and then see where your pattern goes wrong. In the alternative if you have see more changes with field info - you can drop the data source and output of the field names you want in the field info into a batch macro with the field info as the control and select the records/fields you want that way.

Labels