Manipulate single row field from a group of rows from DataSource

2 Answers 19 Views
DataSources General Discussions Report Designer (standalone) Table
Elias
Top achievements
Rank 1
Iron
Elias asked on 08 May 2024, 09:45 PM
Hello

I have these rows of data coming from DataSource example is in the attached file image


- Want to do some math expressions of every row like Subtraction(BRUTO - DESCUENTO) and show the value in NETO painted in the pink line and circle for individual rows of data.
- I tried to use the expressions SUM(DOC_UNID_BRUTO) and SUM(DOC_UNID_DESCUENTO) try to get the Total SUM of these fields but are just getting the individual first value.
- And the last thing is I want to do a subtraction of the total of NETO and DESCUENTO in the last bottom right corner

2 Answers, 1 is accepted

Sort by
0
Hamza
Top achievements
Rank 1
Iron
answered on 11 May 2024, 08:37 PM
Same issue
0
Dimitar
Telerik team
answered on 13 May 2024, 01:17 PM

Hello Elias,

Thank you for the attached screenshots!

To get the NETO value for each record, you can perform subtraction on the BRUTO and DESCUENTO fields, for example:

= Fields.DOC_UNID_BRUTO - Fields.DOC_UNID_DESCUENTO

For the last rows, where the totals are located, in order for the Sum expression to take into account all of the values in the table, it will be necessary to specify the data scope to be the entire table through the Exec data function, for example:

= Exec("table1", Sum(Fields.DOC_UNID_BRUTO)) //green box
= Exec("table1", Sum(Fields.DOC_UNID_DESCUENTO)) //purple box
= Exec("table1", Sum(Fields.DOC_UNID_BRUTO) - Sum(Fields.DOC_UNID_DESCUENTO)) //red box

where table1 is the name of the table report item in your report.

If you need further assistance, attach a copy of the report to your reply as well as sample data that can be used to preview it locally.

Please try this approach and let me know how it goes.

Regards,
Dimitar
Progress Telerik

Stay tuned by visiting our roadmap and feedback portal pages, enjoy a smooth take-off with our Getting Started resources, or visit the free self-paced technical training at https://learn.telerik.com/.
Elias
Top achievements
Rank 1
Iron
commented on 13 May 2024, 06:29 PM

I attached my SQL SELECT STATEMENT when using:
= Exec("ACO_DOCUMENTO", Sum(Fields.DOC_UNID_BRUTO) - Sum(Fields.DOC_UNID_DESCUENTO))
I get the error invalid scope ACO_DOCUMENTO is the name of the table holding the fields/columns I am using for this report.
Dimitar
Telerik team
commented on 16 May 2024, 11:27 AM

Looking at the image, the ACO_DOCUMENTO seems to be the table in SQL from which the data is retrieved. However, the table name which is used in the expression inside the report should refer to the report table item, for example:

Elias
Top achievements
Rank 1
Iron
commented on 20 May 2024, 03:48 AM

Aaaaaaaahhhhhhh, I believed it was the SQL table referring, now I got it right, thanks for the info and help.
Tags
DataSources General Discussions Report Designer (standalone) Table
Asked by
Elias
Top achievements
Rank 1
Iron
Answers by
Hamza
Top achievements
Rank 1
Iron
Dimitar
Telerik team
Share this question
or