The overall case is that I am trying to make a macro that will allow for proper punctuation cleanse and titlecase for fields with names so it respects hyphenated names and double-barrel names.
In the third Multi-Field Formula i am using the option to "Copy Output Fields and Add" New_ as prefix.
In the fourth one I would then like to refer to that new field so that in the following code, in the two places where it refers to [Last] it would instead refer to the newly created variable.
IF REGEX_Match([_CurrentField_], "([\w]')([a-zA-Z]+)")
then
REGEX_Replace([_CurrentField_], "([\w]')([a-zA-Z]+)","$1"+[Last]+"")
ELSEIF REGEX_Match([_CurrentField_], "(\w*\-)([a-zA-Z]+)")
then REGEX_Replace([_CurrentField_], "(\w*\-)([a-zA-Z]+)","$1"+[Last]+"")
ELSE [_CurrentField_] ENDIF
Is there any expression like New__CurrentField__ or similar that I can use? Do I need to change something with the flow?
I am still working on perfecting the expression, but I am trying to work out how to get my current formula into a macro.
In the test file I have attached is the current formula process flow and a flow with the macro. I have also attached the macro (which i am aware doesn't work on anything but the test_field. but that's for another post)
The Dynamic Select tool is what you need to get the result you've described.
In the example above, we first add a Record Id so that we can split the logic and have a way to combine it again at the end. Next, we add a pair of the Dynamic Select tools with essentially opposite criteria to make sure every field is pulled into one or the other (with the new Record Id going through both).
1st Dynamic Select:
2nd Dynamic Select:
The 4th Multi-Field Formula tool then is applied only to those fields that had the "New_" prefixed field names. Finally, a Join tool is used to combine the "New_" fields back with the original fields using the Record Id field as the join field (be sure to uncheck the Record Id fields from the field list in the Join tool to keep them from flowing to the Output tool).
Thank you. I see what that does and have certainly learned something.
I'm still not sure how to change the code though to reference the New_ variable though.
The Dynamic Select tool in the top flow is removing all fields that aren't the "New_" fields (and the Record Id field). Therefore, there's no need to specifically reference the "New_" fields separate from other fields (since there are no others) in the 4th Multi-Field Formula tool (so just select all Text fields).