cancel
Showing results for 
Search instead for 
Did you mean: 

Best method of finding the largest numeric value in an xml document

Former Member
0 Kudos

I have an BLS routine where I need to find the largest numeric value in my XML document. It could be in any row or column. I'm not sure what column it will be in, so the aggregate function is not a good choice (unless I recursively call it for each column and then dynamically assign it to the output) I'm thinking of a couple techniques but I wanted to get some other's opinions first. In the past for things like this I've just nested a couple repeaters but maybe there is a more efficient way.

This is a standard Illumdoc XML format.

Accepted Solutions (1)

Accepted Solutions (1)

jcgood25
Active Contributor
0 Kudos

Consider a Simulator History TagQuery with L1Speed, L2Speed, L3Speed, L4Speed

Do a CalculatedColumns action block on it adding a column called MaxNumber with an expression like:

max((max((max(L1Speed, L2Speed)), L3Speed)), L4Speed)

Then use the Aggregate Stats block on the Calc Column and get your value.

If the columns are not known in advance you should be able to loop through the Rowsets/Column section for any of the SQLDataType numerical columns and build a similar string as above, assigning it to a local property. You should then be able to use something like #Local.MaxFormula# in the configure dialog of the calculated column.

Regards,

Jeremy

Answers (1)

Answers (1)

agentry_src
Active Contributor
0 Kudos

Doug,

I would use xPath or the Aggregate Statistics action block or a combination of both. Do you have a representative sample of xml that you could post?

Thanks,

Mike