Still fighting with SUM function.

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.

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)}})

Thank you!
It was the ‘attribute’ word.