IBM webMethods Hybrid Integration

IBM webMethods Hybrid Integration

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.


#TechXchangePresenter
 View Only
Expand all | Collapse all

Still fighting with SUM function.

  • 1.  Still fighting with SUM function.

    Posted Wed August 25, 2004 10:53 AM

    Hi all,

    I’m still with the sum problem. I can’t understand the ‘Runtime Type Error’. I’ve been using sum without problems several times. Take a look at the query:

    ----------------------------------------
    declare namespace xs=“XML Schema
    let $nodo :=
    for $cial in (‘7495’,‘10485’)
    let $nodo_dia := input()/ageing[@id=‘2004-08-10’]
    let $t1 := $nodo_dia/drv/comercial[@cod=$cial]/@tramo_1
    let $t2 := $nodo_dia/drv/comercial[@cod=$cial]/@tramo_2
    return
    return

    {$nodo}

    ----------------------------------------

    Take a look at the result:

    ----------------------------------------





    ----------------------------------------

    I just want to SUM t1 and t2 and have a unique node with both sums.

    All the fields are ‘float’ in the schema, and I’m working with Tamino 4.1.4.4 and ‘Interactive Interface’.

    Thank you for your support.

    Xavi.


    #webMethods
    #API-Management
    #Tamino


  • 2.  RE: Still fighting with SUM function.

    Posted Thu August 26, 2004 05:20 PM

    Xavi,

    the following query does what you require (for simplicity purposes, I created the data inside the query rather than getting it from the database, but that should not matter.

    Regards

    Harald

    declare namespace tf=“http://namespaces.softwareag.com/tamino/TaminoFunction
    declare namespace w=“http://schemas.microsoft.com/office/word/2003/wordml

    declare namespace xs=“XML Schema
    let $input:= (

    ,



    )

    let $nodo :=
    for $cial in (‘7495’,‘10485’)
    let $nodo_dia := $input/ageing[@id=‘2004-08-10’]
    let $t1 := $nodo_dia/drv/comercial[@cod=$cial]/@tramo_1
    let $t2 := $nodo_dia/drv/comercial[@cod=$cial]/@tramo_2
    return
    return (

    {$nodo}
    ,{attribute sum_t1 {sum($nodo//@t1)}}{attribute sum_t2 {sum($nodo//@t2)}})


    #webMethods
    #Tamino
    #API-Management


  • 3.  RE: Still fighting with SUM function.

    Posted Wed September 01, 2004 12:02 PM

    Thank you!
    It was the ‘attribute’ word.


    #Tamino
    #webMethods
    #API-Management