Add condition to the query sql before the execution
Add condition to the query sql before the execution
In web designer, how can I add a condition to the query sql before the execution? This condition should not be viewed or modified by the user, but the Query Text in the Editor must be editable.
Soft System srl
Re: Add condition to the query sql before the execution
Hello.
Unfortunately, there are no Conditions for the SQL query.
Could you describe your scenario more detailed, maybe we can't suggest you something else?
Thank you.
Unfortunately, there are no Conditions for the SQL query.
Could you describe your scenario more detailed, maybe we can't suggest you something else?
Thank you.
Re: Add condition to the query sql before the execution
Good morning.
Scenario: Consider a single report. The application processes the main print data and populating a special table. All processing / prints populate the same table. To distinguish a processing / printing on the other we use a UID field.
The report must extract the filtering data by UID.
By the designer, the user can add more data, but it does not remove the filter by UID.
In other words, can I add a string to all queries of the reports before they are executed?
Thank you.
Scenario: Consider a single report. The application processes the main print data and populating a special table. All processing / prints populate the same table. To distinguish a processing / printing on the other we use a UID field.
The report must extract the filtering data by UID.
By the designer, the user can add more data, but it does not remove the filter by UID.
In other words, can I add a string to all queries of the reports before they are executed?
Thank you.
Soft System srl
Re: Add condition to the query sql before the execution
Hello,
As a way, you can try to use the variable in the query as you needed:
select * from table {Variable1}
and in Variable1 provide necessary where conditions or additional columns.
Thank you.
As a way, you can try to use the variable in the query as you needed:
select * from table {Variable1}
and in Variable1 provide necessary where conditions or additional columns.
Thank you.
Re: Add condition to the query sql before the execution
Yes, but, through Web Designer, the user can delete the variable from the query.
I would rather that the user can modify the query without removing this condition.
Thank you.
I would rather that the user can modify the query without removing this condition.
Thank you.
Soft System srl
Re: Add condition to the query sql before the execution
Hello,
You can check it in your code and modify query if the necessary:
((StiSqlSource)report.Dictionary.DataSources[ "DataSourceName"]).SqlCommand = newSqlCommand;
Thank you.
You can check it in your code and modify query if the necessary:
((StiSqlSource)report.Dictionary.DataSources[ "DataSourceName"]).SqlCommand = newSqlCommand;
Thank you.
Re: Add condition to the query sql before the execution
OK thanks.
In what event?
OnGetDataBinding
OnGetReportData
OnInit
onload
OnReportConnect
?
another?
In what event?
OnGetDataBinding
OnGetReportData
OnInit
onload
OnReportConnect
?
another?
Soft System srl
Re: Add condition to the query sql before the execution
Hello,
Please try to use it in OnGetReportData.
Thank you.
Please try to use it in OnGetReportData.
Thank you.
Re: Add condition to the query sql before the execution
Very well, thank you!
There is a further problem: I would like to apply the same in the Web Designer, on the View Data function
and on the Preview.
I tried the same code in OnPreviewReport and OnDataBinding, but runs only the second time I run the preview. What is the right event?
Thank you.
There is a further problem: I would like to apply the same in the Web Designer, on the View Data function
and on the Preview.
I tried the same code in OnPreviewReport and OnDataBinding, but runs only the second time I run the preview. What is the right event?
Thank you.
Soft System srl
Re: Add condition to the query sql before the execution
Hello,
Unfortunately, at the current moment, there are not any events for this action. Sorry.
Thank you.
Unfortunately, at the current moment, there are not any events for this action. Sorry.
Thank you.