I'm trying to create a content with a table included using the following script:
//START OF LOOP var array = subset_uniquesList("ABIAppartenente"); for (var i in array) { var val = array[i]; #>
<#/*REPEATED ROW*/#>
<#=val#> <#/* example of inserting a script expression */#>
<#= formula("SUBSET_SUM('Netto', SUBSET('ABIAppartenente', '" + val+"'))") #> <#/* example of embedded formulas using the formula() function from within a script*/#>
<#= formula("RECORDCOUNT(SUBSET('ABIAppartenente', '" + val+"'))") #> <#/* example of embedded formulas using the formula() function from within a script*/#>
{{RECORDCOUNT(SUBSET2('Dataregolamento','ABIAppartenente', '04/09/2012','" + val+"'))}} <#/* example of embedded formulas using the formula() function from within a script*/#>
<#<br />} The table is created on a loop on ABIAppartenente code and have different columns:
- first column is the ABIAppartenente code itself; - second column is a total amount for each ABIAppartenente code; - third column is the count that contributes for each code; - fourth column counts record for each ABIAppartenente code for a fixed date.
Everything works fine except for last column that return always 0 (for each ABIAppartenente, also if there are records for each ABIAppartenente code and the indicated date Dataregolamento).
So I'd like to know if anyone have an idea about the problem in using the SUBSET2 as indicated - Thanks
Hi Enrico - The syntax for the last column is not correct. See below and attached IOK file. It started working after wrapping with formula("....") .
<#<br />//START OF LOOP var array = subset_uniquesList("ABIAppartenente"); for (var i in array) { var val = array[i]; #>
<#/*REPEATED ROW*/#>
ABIAppartenente = <#=val#> , <#/* example of inserting a script expression */#>
netto=<#= formula("SUBSET_SUM('Netto', SUBSET('ABIAppartenente', " + val+"))") #> , <#/* example of embedded formulas using the formula() function from within a script*/#>
count=<#= formula("RECORDCOUNT(SUBSET('ABIAppartenente', " + val+"))") #> , <#/* example of embedded formulas using the formula() function from within a script*/#>
date=<#= formula("RECORDCOUNT(SUBSET2('Dataregolamento','ABIAppartenente', '04/09/2012', '" + val+"'))") #> , <#/* example of embedded formulas using the formula() function from within a script*/#>