Criteria when referencing XML cell

  Kiến thức lập trình

This might be a longshot, but here goes.

My company uses a custom platform as a portal where we interact with stakeholders.

One feature of the platform is a builder in the backend for XML data tables. Our primary use for this is that our stakeholders can use an XML table to submit reports where they can add rows to the report themselves. There are multiple sections within the table, and they can add unlimited rows to each section to outline the expenses they are reporting on.

At the bottom there is a summary section where the “Amount” column from each section is totaled.

I’ve recently added a new column in each section that is a “Category” that we use to further classify the expenses.

I am now trying to find a way to sum the amounts by these categories and I’m stuck.

Essentially, I’m just looking to Sum the totals of the “Amount” column, but only if they meet the criteria of having the desired value in the “Category” column.

I’ve looked through the platform’s wiki to see if there’s any code I can adapt for my purposes but nothing I’ve tried works.

The code currently being used in the section that displays the total of the column “Amount” for the entire section is as follows:

=[@section.SectionName.id@_total_Total-SectionName]

However, this is the total of everything in that section and doesn’t employ a criteria.

The only reference to employing criteria I can find in the wiki is an example for when you want to display the info outside of the table in other parts of the platform.

@xml.fieldname.sectionodename.rownodename[#(?criteria=”~colunnnodename.nodevalue~” == “matching criteria”)~columnnodename.nodevalue~ #]@

Any chance someone has an idea on how I can combine the two to apply a criteria to the first piece of code so it displays in the table?

I’m not well versed in XML and I’m not even sure if this is standard XML or something unique to the platform but I appreciate any help.

New contributor

Sparkdog is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

1

LEAVE A COMMENT