#1 2019-02-07 17:52:18

louisrbli
Member
Registered: 2019-02-07
Posts: 2

Computed columns not working even with basic arithmetic operations

I run a Bitnami turnkey ReportSever 3.0.5 vm. Nothing had been modified. In using the Dynamic List, Computed Columns, I couldn't even use a simple arithmetic operation. For example, I tried to calculate a profit margin in an invoice line, ([Unit Price] - [Unit Cost]) * Quantity This will return an error message saying "Could not tokenize: ([Unit Price] - [Unit Cost]) * Quantity. Problem occured at [Unit Price] - [Unit Cost]) * Quantity". [Unit Price] and [Unit Cost] are a valid field from my MSSQL database. I've tried many variations of the syntax but still no good. I tried the built in Dynamic List reports with the demo database, the Computed Columns worked with the demo database! My Dynamic List reports worked in every other way, just can't get the Computed Columns...Help!

Offline

#2 2019-02-08 10:34:03

eduardo
Administrator
Registered: 2016-11-01
Posts: 1,343
Website

Re: Computed columns not working even with basic arithmetic operations

Hi louisrbli,

you have to put the functions in the white list:
https://forum.reportserver.net/viewtopic.php?pid=3378

be careful to not to add "too much" to the whitelist in order to avoid sql injection. The whitelist is there in order to prevent sql injection and give you the control of which functions are allowed.

Regards,
Eduardo

Offline

#3 2019-02-08 19:36:51

louisrbli
Member
Registered: 2019-02-07
Posts: 2

Re: Computed columns not working even with basic arithmetic operations

Thanks a lot, eduardo! It works perfectly now.

For those out there new to ReportServer, if you use Computed Columns, and if your database fields contain a space, you must use [] to enclose the field name, then go to the config list to add the function '[]' as 'eduardo' suggested in the above thread.

Offline

Board footer

Powered by FluxBB