Seal Report Forum
»
General
»
General Discussions/Other
»
Version 5.0 - Execute Procedure to Populate Tables with parameters From a Common Restriction
Rank: Newbie
Groups: Registered
Joined: 6/17/2019(UTC) Posts: 1 Location: brasilia Thanks: 3 times Was thanked: 2 time(s) in 2 post(s)
|
Hi Sealers, I need to Execute a Stored Procedure to Populate Tables with parameters From a Common Restriction. Is there a way to do this? I have two commom Restriction, CLIENT and REFERENCE_DATE OR Maybe, Creating two Report Input Values and execute the procedure in a TASK? How to execute this procedure from the Task using the Report Input values? Edited by user Wednesday, June 26, 2019 2:58:22 PM(UTC)
| Reason: Not specified
|
|
|
|
Rank: Administration
Groups: Administrators
Joined: 12/20/2013(UTC) Posts: 1,209 Thanks: 14 times Was thanked: 206 time(s) in 199 post(s)
|
Did you check the new documentation SQL Server Stored Procedures The sample reports 21-SQL Server Stored Procedure with parameters should help you.
|
1 user thanked epf for this useful post.
|
|
|
Rank: Newbie
Groups: Registered
Joined: 6/17/2019(UTC) Posts: 1 Location: brasilia Thanks: 3 times Was thanked: 2 time(s) in 2 post(s)
|
Originally Posted by: epf Did you check the new documentation SQL Server Stored Procedures The sample reports 21-SQL Server Stored Procedure with parameters should help you. Thanks for Answering @epf! Yes. I checked it. I`m developing a workaround to achieve what we need. I Created two Report Input Values named as CLIENT and REFERENCEDATE. So, i created a task with the following code, executing the procedure with the Report Input Values as Parameters. Code:
@using Seal.Model
@using Seal.Helpers
@using System.Data
@{
//Query or update the database
ReportTask task = Model;
Report report = task.Report;
var helper = new TaskHelper(task);
ReportRestriction rstBanco = report.GetInputValueByName("CLIENT");
ReportRestriction rstData = report.GetInputValueByName("REFERENCEDATE");
string strData = String.Format("{0:yyyyMMdd}", rstData.FirstDateValue);
helper.ExecuteNonQuery(
"EXECUTE spu_relBI '"+rstBanco.EnumValues[0]+"', '"+ strData +"'",
false
);
}
Now i'm stuck in this scenario: I have my SQL table populated dynamically from the procedure called in the Task. This is great! How to use the Report Input Values in the Restrictions on our many models in this report??
|
|
|
|
Rank: Administration
Groups: Administrators
Joined: 12/20/2013(UTC) Posts: 1,209 Thanks: 14 times Was thanked: 206 time(s) in 199 post(s)
|
The task will populate the SQL Table through the SP, so you can have a model querying the Table (a SQL Model or a Metadata Model). Be careful to use temp tables to avoid conflict if the reports is executed by 2 persons. If you want to reuse the input value in a model restriction you should use the 'Pre Load Script' of the model: Create a restriction in your model having the type of your input value. Then edit the 'Pre Load Script' property of the model to assign the value of the InputValue to the restriction. It will look like (for copying the enum value): Code:@using Seal.Model
@using System.Data
@{
ReportModel model = Model;
List<ReportRestriction> restrictions = model.Restrictions;
ReportRestriction rstBanco = model.Report.GetInputValueByName("CLIENT");
model.GetRestrictionByName("YourModelRestriction").EnumValues.Add(rstBanco.EnumValues[0]);
}
However instead of creating input values, you should consider to use directly the restriction values in your Task. You have direct access to your models restrictions, e.g. report.Models[0].GetRestrictionByName("YourModelRestriction") In this case you do not need pre load script as the values are got from the restrictions. Edited by user Thursday, June 27, 2019 10:04:27 AM(UTC)
| Reason: Not specified
|
1 user thanked epf for this useful post.
|
|
|
Seal Report Forum
»
General
»
General Discussions/Other
»
Version 5.0 - Execute Procedure to Populate Tables with parameters From a Common Restriction
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.