lookupOne formula

Can anyone tell me why this formula doesn’t work? i just get a list of 0’s as a result in “TEST” column. The “Conto” in the “BGT” table has as its reference the “CONTO” in the “chart of accounts” table.

BGT.lookupOne(Conto=$CONTO).IMPORTO

Try this:

BGT.lookupOne(Conto=$id).IMPORTO

It’s explained in References and Lookups - Grist Help Center – basically because the Conto column is a Reference column, so stores row IDs rather than actual dates.

Note that if it is possible for multiple records in table BGT to have the same Conto value, then you might want to use BGT.lookupRecords instead to get all of them. For example, you could use SUM(BGT.lookupRecords(Conto=$id).IMPORTO) to get the sum of all IMPORTO values.

Thank you very much. I completely missed this explanation. Now everything works!