Thank you, but would you please show me how to pass (only once) for each function the xml sequence which results from my main query, instead of simple numbers as in your example?

With kind regards,
Menashè

On 07/14/2015 12:30 PM, Christian Grün wrote:
I hope it's clear.
Sorry, I'm still confuzzled. What is the problem? I guess you want to
define different, exchangable reporting functions for more or less the
same input (dataType, device, ...)?

Here is one way to define functions and call them in a second step:

   let $add := function($a, $b) { $a + $b }
   let $multiply := function($a, $b) { $a * $b }
   for $function in ($add, $multiply)
   return $function(3, 5)

Instead of $add and $multiply, you could have $report-pivoting and
$report-count.



On Tue, Jul 14, 2015 at 11:40 AM, Menashè Eliezer
<melie...@ogs.trieste.it> wrote:
Hi,
The initial of the code should be modified, so here is only the essence of
one of the pivoting reports:
for $singleDataType in $dataType

for $singleDevice in $device

for $singleAvailability in $availability

for $singleCountry in  $country

for $singleParameter in $parameter

group by
$singleDataType,$singleDevice,$singleAvailability,$singleCountry,$singleParameter
order by
$singleDataType,$singleDevice,$singleAvailability,$singleCountry,$singleParameter

return <Row DatasetType="{$singleDataType}" Instrument="{$singleDevice}"
Availability="{$singleAvailability}" Country="{$singleCountry}"
Parameter="{$singleParameter}" NumberOfRecords="{count($current-pre)}"/>

Other report will count all records with one less condition:

group by $singleDataType,$singleDevice,$singleAvailability,$singleCountry
order by $singleDataType,$singleDevice,$singleAvailability,$singleCountry

return <Row DatasetType="{$singleDataType}" Instrument="{$singleDevice}"
Availability="{$singleAvailability}" Country="{$singleCountry}"
Parameter="Any" NumberOfRecords="{count($current-pre)}"/>

I hope it's clear.

With kind regards,
Menashè



Reply via email to