Summary report

I am trying to get a summary report of the products used in a fertilization program. It often happens to repeat the products used in the various interventions.
So what I want is

  1. list of unique products used
  2. sum of the quantities for each product used
  3. product cost
    4.total product cost (quantity * product cost)
    Possibly divided by “radical” or “foliar” intervention category

I have 3 tables PLANS (parent), INTERVENTIONS (child), INTERVENTION ROWS (grandchild). Then in INTERVENTION ROWS i have [PRODUCT] column that is a reference to PRODUCTS table.

I tried this approach but maybe I misuse the start / end expressions:

<<Start: FILTER(RIGHE INTERVENTI,AND([IDPIANO]=[_THISROW].[IDPIANO],[IDINT].[DISTRIBUZIONE]=”Radicale”))>>

RIEPILOGO COSTI AD ETTARO

Prodotto

Quantità ( kg )

Prezzo ( € )

Costo ad ettaro

<<Start:SELECT([Related RIGHE INTERVENTIs],[IDINT].[DISTRIBUZIONE]=”Radicale”) >><<UNIQUE([PRODOTTO].[IDPRODOTTO])>>

<<UNIQUE([PRODOTTO].[NOME])>>

<<SUM(SELECT(RIGHE INTERVENTI[DOSAGGIO],AND([IDPIANO]=[_THISROW-2].[IDPIANO],[IDINT].[DISTRIBUZIONE]=”Radicale”,[_THISROW-1].[PRODOTTO]=[PRODOTTO])))>><>

<<If: ISNOTBLANK([NOTE])>> NOTE: <<[NOTE]>> <>

<>

Error: ‘GENERA PDF’ task ‘SALVA PIANO’ Body template. Start expression ‘SELECT([Related RIGHE INTERVENTIs],[IDINT].[DISTRIBUZIONE]=”Radicale”)’ should generate a List of Ref values. Please verify that it generates a List and that the contents of the List are Ref values. Ref values should come from the ‘Key’ column of the referenced table. Error: The document body is empty

someone can help me to find the right approach?
sorry but it’s my first template, and i made a bit of confusion

I suggest translating the column names into english for this post if you’re desperate for help.

2 Likes