ToDecimal function conversion in Matrix
Hi,
I have a matrix like this
where I added a column Totale (to calculate total by row) in which I set expression :
ToDecimal([Garanzia.Importo capitale 1]) + ToDecimal([Garanzia.Importo capitale 2])
but it returns error: System.Exception: Error in expression: Garanzia.Importo capitale 1
I tried then with a custom function in the code:
long MakeSum(object o1, object o2)
{
return Convert.ToInt32(o1)+ Convert.ToInt32(o2);
}
in the cell I call this function:
MakeSum([Garanzia.Importo capitale 1], [Garanzia.Importo tasse annuo])
but keep getting the same error: System.Exception: Error in expression: Garanzia.Importo capitale 1
The total by column, instead, works fine-
I there anyone who can help me ?
Thanks.
This discussion has been closed.
Comments
It looks like you have incorrect data inside the Garanzia.Importo capitale 1
Mea culpa.
There was some mess with the bands . Now it works.
Thanks again.
Hello!
We're glad that after checking the band structure, the report and matrix totals are now working! We'd also like to remind you of the general recommendation for expressions in cells and MatrixObject calculation columns:
Make sure the columns in the Dictionary are of a numeric type (Decimal / Int32), or when working with strings, wrap them in ToDecimal([Table.Field]) / Convert.ToDecimal([Table.Field], CultureInfo.InvariantCulture) and ensure that the string does not contain spaces or null values.