Hi all,
I find myself constantly parsing through raw data and adding in the same fields to adhere to a format time and time again. Initially, I had thought it'd be easy enough to create a macro that'll add these fields regardless of the underlying data's fields (i.e. if I want to add a "Customer" field since that's recognized by the system but there's already a "Customer" field within the raw data), but to take it a step further, would anyone know how to add fields if certain conditions are met? I'll lay out the base scenario I'm running into and how I imagine the macro would act:
Raw data source contains the following fields [I'll call this "raw fields"]:
Invoice Number
Customer ID
Parent Customer
Quantity
Amount
Revenue
Required fields that system needs to upload [I'll call this "required fields"]:
1: Company ID
2: Customer ID
3: Amount
4: Quantity
How macro would act:
IF any of [raw fields] equals any of [required fields] THEN keep field(s) as they are ELSE add any missing [required field]s with a formula node ENDIF
Please feel free to reply with any questions and thanks in advance, community!
Im sure a macro could be created, but you may be able to get away with a union and text input tool.
If you have the default fields in a text input with no rows, you can union that to the workflow and any of the default fields will get added.
Just to take it a step further and tackle the original ask of doing it via macro where it decides what fields to add, I came up with this.
This version will compare the actual fields with the expected ones and only union the missing fields.
I still believe that a simple union will do the trick, but there isnt anything stopping us from putting that into a macro either.
Both macros will give the same result of adding the missing fields.