calculations

Archived from the Xataface Users forum.

Martin Pruss — Wed Mar 18, 2009 5:16 am

Hi Steve

In my function block__before_main_table() I am querying like this: “select sum(km) from streak …”

unfortunately the field “km”

is populated by this relative query:

[strecken_km]

__sql__ = “SELECT strecken_id, strecken_km FROM strecken ORDER BY strecken_id”

in the valuelist.ini

Now the first query calculates the Sum of the index fields of the valuelist.

even though that’s nice, its not the Sum I need

Do you have any ideas how to calculate the right field?

cheers

Martin


shannah — Wed Mar 18, 2009 8:26 am

You’ll have to do a join then.

select sum(s2.stricken_km) from streak s1 inner join strecken s2 on s1.km=s2.strecken_id


Martin Pruss — Wed Mar 18, 2009 8:37 am

Thanks …

already tested and works like a charm…

have a nice day

cheers

martin