So I admit to being a total noob here, and I am trying to get used to the lingo and concepts. I could have written this in C# probably 50 times for the amount of time I have spent trying to figure this out lol… I apologize in advance for my ignorance.
I have a list of categories in a flat file, I’ve managed to turn into a string array. I also have a bundle with JSON line items in it with a field we’ll call description. what I want to do is add a category field to my json structure so I can use number aggregator to get subtotals for each category on the invoice.
What I’ve managed so far with various create json, parse json, iterators, etc. is to get it all working but it is executing each line item of the invoice as a separate operation (probably one of the many iterators in this workflow)… here is what I have, which I know probably could be pared down to like 3 modules if I knew what I was doing lol:
I guess what I am not really grasping is how to do this without just using javascript or c# I have tried taking several courses in make academy and I have looked through help, employed the AI and even paid for chatgpt plus, all to no avail.
Any help is greatly appreciated!
Sample categories array:
Category A
Category B
Category C
Sample line item descriptions:
Category A Some Expense
Category A Another Expense
Category C A third expense
A fourth, uncategorized, expense
Thanks in advance!
Details of each operation in the pic:
The two dropbox ops at the beginning just read a) the json of the invoice (output from the AI Invoice tool from PDF.co), and b) the flat file of categories.
I feed the output of the categories read into a text aggregator, into an iterator to turn it into bundles, then back into a text aggregator to turn it into a comma separated list I can later use "split(…;,) on to get it into a regular string array – I will probably change this in the future if I stick with this scenario
The create json turns it into a json array which is probably not needed, but chatgpt told me ot do it at one point so i did, the next parse json parses the invoice into a structure.
Text match extracts a value from the name of the bill to in the invoice
Set multiple variables extracts values (and the text match) into variables for later processing
Next iterator turns the line items into bundles
Create JSON then does some basic text processing in module to set a flag on each item based on the contents of the description, etc.
Parse JSON turns it back into properties I can access in the following modules
The iterator iterates all the categories for each line item, and filters for only the ones that match the start (indexOf(description, value) = 0), and then store that value into the category in the create json, parse json, and then aggregate the array – which does nothing because it’s in separate operations now, and the numeric aggregator also does nothing…