Calculate amount

Post Reply
User avatar
Terkelsen
Advanced member
Posts: 297
Joined: Thu Sep 08, 2011 5:08 pm
Contact:

Calculate amount

Post by Terkelsen »

I have 8 to 10 dummy-files coming in from different Submit Points, that submits data only. Each of these files contain a metadata tag, that is an amount selected from at drop-down in the Submit point. I need to make a calculation that adds the numbers in the tag "amount" from all thes files.

I have tried to use Assemble Job in order to merge the metadata so that all information is in each file. However, I need the dataset name of these Submit points to be the same, because that information is used later on in the flow, so making individual names for the data sets is not an option. When assembling jobs with data sets with identical names one will overwrite the other.

I tried to write the information into Private data of each file, but merging metadata when assembling will not merge Private Data.

Any ideas of how to merge this information form each file into one, so that a calculation can be done?

PS: The database module is not available in this installation.
jan_suhr
Advanced member
Posts: 586
Joined: Fri Nov 04, 2011 1:12 pm
Location: Nyköping, Sweden

Re: Calculate amount

Post by jan_suhr »

Have you tried to use different Dataset names from the submit point and then use Make XML to combine them in to one XML that you later pickup to the assembled job. It should work for you
Jan Suhr
Color Consult AB
Sweden
=============
Check out my apps
laurentd
Member
Posts: 137
Joined: Wed Mar 13, 2019 2:06 pm

Re: Calculate amount

Post by laurentd »

The Counter Numberer app can also help you.
Add all the values to a counter, and read the total value when you want.
It will be attached as private data.
You can then reset the counter for the next batch of files, or define the counter names based on one common job property.
https://www.enfocus.com/en/appstore/product/counter
Last edited by laurentd on Tue Nov 10, 2020 5:41 pm, edited 1 time in total.
Laurent De Wilde, Solution Architect @ Enfocus
freddyp
Advanced member
Posts: 1008
Joined: Thu Feb 09, 2012 3:53 pm

Re: Calculate amount

Post by freddyp »

Terkelsen wrote: Tue Nov 10, 2020 9:56 am I have 8 to 10 dummy-files coming in from different Submit Points, that submits data only.
You submit dummy files, probably to submit metadata, and not data only, correct? In that case, know that you can also define a submit point as submitting metadata only. Switch will then create an empty text file automatically that serves as a vehicle for the XML metadata from the submit point. It is nicer for the user that way.
User avatar
Terkelsen
Advanced member
Posts: 297
Joined: Thu Sep 08, 2011 5:08 pm
Contact:

Re: Calculate amount

Post by Terkelsen »

@ Jan. As mentioned giving the datasets different names is not an option because the Data set name is later used to add text to a PDF. If the Submit Points have different names I would need to make different variable sets for every Submit Point and as there will be maybe 50 different Submit Points, that won't work.

@ Freddy. Yes, I'm submitting meatdata only and Switch creates the dummy files. The problem is how to gather information from each of these dummy files and use them to calculate. Each file hold information like this:
[Metadata.Text:Path="/field-list/field[2]/value",Dataset="Submit_1",Model="XML"]

I need to collect this information from each file and calculate the SUM.
User avatar
Terkelsen
Advanced member
Posts: 297
Joined: Thu Sep 08, 2011 5:08 pm
Contact:

Re: Calculate amount

Post by Terkelsen »

Just for your information, I solved this using Jan's app called "Take Note". With this app I can add a specific dataset unique to each Submit Point and still keep the dataset "Submit_1", which is the same for all Submit Points.

After assembling the files I then end up with metadata containing the dataset "Submit_1", where one overwrites the other but in addition I have a list of datasets specific to each Submit Point. This way I have the information about amount collected in the metadata for each file, and it can be used for calculating the total amount.
Post Reply