cancel
Showing results for 
Search instead for 
Did you mean: 

Sum of Double value in Xpath

senthil_kumar44
Participant
0 Kudos

Hi,

In 12.2, we have an issue in SUM function in XPATH in transaction. Sum function is working fine for small double values but for large double values has exp it is showing value as NA.

<?xml version="1.0" encoding="UTF-8" standalone="no"?>

<Rowsets DateCreated="2013-09-26T13:36:30" EndDate="2010-12-22T14:31:00" StartDate="2010-12-22T14:31:00" Version="12.1">

    <Rowset>

        <Columns>

            <Column Description="" MaxRange="1" MinRange="0" Name="DoubleCol" SQLDataType="8" SourceColumn="DoubleCol"/>

        </Columns>

        <Row>

            <DoubleCol>2.160445391E7</DoubleCol>

        </Row>

        <Row>

            <DoubleCol>5.460645391E7</DoubleCol>

        </Row>

    </Rowset>

</Rowsets>

For this XML as input param xmlin and in transaction, if we are using

Transaction.xmlin{sum(/Rowsets/Rowset/Row/DoubleCol)}

it is giving value as NA. But if DoubleCol value is small (like 10000,20000), it is showing sum result.

How to solve this issue.

Regards,

Senthil

Accepted Solutions (0)

Answers (3)

Answers (3)

jcgood25
Active Contributor
0 Kudos

Addressing the scientific notation at the source would be the best, but of course depends on how much control you have over the 'xmlin' property for your transaction.  If you can't rely on this and use the simple xpath sum, then one option could also be using a calculated column action block to add number(DoubleCol) to the dataset of your xmlin property value.  The xpath sum should easily work from that resultset and in case you need to do any other work with the resultset coming into the transaction you always have both the original and the adjusted values for each row.

Regards,

Jeremy

Rapid Innovation Group (RIG)

saumya_govil
Active Contributor
0 Kudos

Hi Senthil,

As suggested by Anuj, the sum function of XPATH does not understand this exponential number format. So, using Aggregate Statistics is a good option here. I tried it and it works fine.

Is there any specific reason to use XPATH? Or else, switching to this would be a good idea.

Regards,

Saumya Govil

Former Member
0 Kudos

Hi Senthil,

XPATH's 'sum' function does not recognize  '5.460645391E7' format of number.

You can use 'Aggregate Statistics' action block under XML functions and get the 'Total' from its output, and check if it is giving you correct results.

Hope this helps you!!

Warm Regards,

Anuj