I imported a PDF and separated each row into its own record. The field is called "txt". There's some info in the header of each page that I need to keep and have repeated in each record. It looks like this "PERIODMM-YY". I'm trying to repeat the MM-YY in front of each record, until it changes to the next period - then I want to repeat THAT period in front of each record. I'm trying to use a Multi-Row Formula tool, add a new field and use the following expression:
IF RegEx_Match([Row-1:txt],'PERIOD(\d\d-\d\d)')
THEN RegEx_Match([Row-1:txt],'PERIOD(\d\d-\d\d)')
ELSE [Row-1:New Field]
ENDIF
So basically, if the pattern is found in the prior row, I want to capture the subgroup \d\d-\d\d and put it in a New Field. If it doesn't match the pattern, I want to output the value in New Field from the previous row.
I'm not getting an error, but the New Field is not returning any data.
Solved! Go to Solution.
I think the issue might be in the second row. Try the following instead:
IF RegEx_Match([Row-1:txt],'PERIOD(\d\d-\d\d)')
THEN RegEx_Replace([Row-1:txt],'PERIOD(\d\d-\d\d)','$1')
ELSE [Row-1:New Field]
ENDIF
RegEx_Match returns a boolean (true/false), which if you put into a text field it will return a -1 or a 0. Use RegEx_Replace to pull out a single piece of information from a string.
Does that fix the issue? If not, can you post some sample data?
Ok I figured it out. I used a RegEx tool to Tokenize the MM-YY using the expression: PERIOD(\d\d-\d\d). I then used a Multi-Row Formula tool to update that new field using the expression: IF IsEmpty([1]) THEN [Row-1:1] ELSE [1]
ENDIF.