Dynamic SQL Parameter


https://www.nevron.com/Forum/Topic6843.aspx
Print Topic | Close Window

By colin fowle - 12 Years Ago

Hi,

Using Nevron Chart for Sharepoint 2012 Vol1.  I notice the new feature for database properties which can be configured with expressions.

I want to pass a parameter to the SQL Command for a chart connecting to a Database Data Source.  So something like

Select col1, col2, col3

from table1

where table1.userid = Params![UserId].STR

However it doesnt work as the query parser throws an error

Error:Cannot connect to data source.  Eroor was:Invalid column name 'Params![UserSid].STR

Is there not some form of parameter expansion done before the SQL is passed to the query parser ?  I've tried a variety of ways of specifying the Params![UserId].STR (in quotes / double / single etc.)

How do I get one of these pre-defined parameters passed to my query ?

thanks

 

By Nevron Support - 12 Years Ago

Hi,

In order for the chart to know that you are writing an expressoin, and not a regular string expressions must start with the '=' char.
So perhaps you just have a syntaxis problem - following is an expression that binds to a dynamic query:

="select co1, col2, " + Params![UserId].STR + " from table"