Gelöst Problems with calculations in a table

1. Sergio Ciordia
3. Montag, Dezember 24 2018, 10:51 AM
Hi,

I have added a table to my report that summarizes the tax rates of my products (10 or 21%). I have 5 columns in the table with these calculations:

• Column-1: \$F(field1)
• Column-2: \$F(field2)
Column-3: = field1 * field2 / 100
Column-4: = field2 + (field1 * field2 / 100)
Column-5: = CASE field1 WHEN 10 THEN (field2*1,4/100) When 21 Then (field2*5,2/100) ELSE 0 END

If I include the first 4 columns (and their calculations), the table is shown and works perfectly but if I add the fifth column (conditional statement) it does not work.

I have two questions:

- How could I include the conditional statement correctly so that the table is shown and works?
- Could I replace the fields in the calculation of column-4 with the column values (column-2 + column-3)?. What would be the correct expression?.

I want to clarify that I can include the conditional statement in the SQL query and it works perfectly with CASE expression but I do not know how to add it directly to the table.

Thank you very much.

Best regards,
Sergio
Kommentar
Antworten (6)
Sergey Pashkov Akzeptierte Antwort
Hello Sergio,

Is there any error message? What datasource is used?
Kommentar
Sergio Ciordia Akzeptierte Antwort
Hi Sergey,

The datasource is a SQLite query:

Select
IdInvoice,
(VAT * 100) AS field1,
SUM(Total_row) AS field2
FROM
Details_Invoice
WHERE IdInvoice = \$P(ParamIdInvoice)
GROUP BY field1

There are several error messages. I attach a screen-capture with these errors.

Thank you very much.

Sergio
Anhänge
Kommentar
Sergey Pashkov Akzeptierte Antwort
And what if you use the point as a decimal separator, 1.4 and 5.2?
Kommentar
Sergio Ciordia Akzeptierte Antwort
Ouhhhh!! It has been a very silly mistake. I get all the decimal values with a comma and I thought I would have to write the conditional expression with that separator symbol.

What do you think about the calculation of column-4? Would it be possible to use the previous column values?.

Thank you very much Sergey.

Sergio
Kommentar
Sergey Pashkov Akzeptierte Antwort
No, it's not possible to reference other columns
Kommentar
Sergio Ciordia Higuera Akzeptierte Antwort
Ok, thank you very much.

Best regards,
Sergio
Kommentar
• Seite :
• 1

There are no replies made for this post yet.
However, you are not allowed to reply to this post.

Categories

Announcements & News
1. 0 subcategories
Valentina Studio
1. 2 subcategories
Valentina Server
1. 4 subcategories