Seal Report Forum
»
Report Edition
»
Data Source Creation
»
Input Parameters in SQL Statement for main Table
Rank: Newbie
Groups: Registered
Joined: 2/1/2017(UTC) Posts: 2 Location: Lisbon Thanks: 1 times
|
Hello, I've started using Seal Report a couple days ago and I'm trying to figure out how can I define input parameters to be used as a filter in the SQL statement for my main table. Here you have an example: Select * from myTable where myTable.Col1 = @myParam; Can anyone help me to understand how can I set the variable @myParam to be passed by the user before executing the query? Thanks in advance. Best regards.
|
|
|
|
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 trick is to set a restriction in your model (from any element), you can change his name then you use the Operator: Value Only and in advanced option, you set the flag Use As Parameter You can check the samples '51' and '52' Then you can use the value for any purpose in scripts.... e.g. you can add a dynamic restriction in tables, but you have to understand how reports are built. Check also the post https://sealreport.org/forum/default.aspx?g=posts&t=278#post630
|
1 user thanked epf for this useful post.
|
|
|
Rank: Newbie
Groups: Registered
Joined: 2/1/2017(UTC) Posts: 2 Location: Lisbon Thanks: 1 times
|
Originally Posted by: epf The trick is to set a restriction in your model (from any element), you can change his name then you use the Operator: Value Only and in advanced option, you set the flag Use As Parameter You can check the samples '51' and '52' Then you can use the value for any purpose in scripts.... e.g. you can add a dynamic restriction in tables, but you have to understand how reports are built. Check also the post https://sealreport.org/forum/default.aspx?g=posts&t=278#post630 Thank you for helping. It worked perfectly! By the way, I am facing almost the same case but with a DrillDown list based on a Enum. Should I use it the same way that I did for the other types of input parameters? I am asking because once I create the restriction based on a Enum List, the output of my view has 2 keys with the same name: one with the Enum List and another one(with the same key) as a input text. Here is the properties that I've set for the mentioned restriction: Name : MyRestriction Operator : Value only Prompt restriction : Prompt only one value Is required : True Data type : Default Custom Enumerated List : MyEnumList Use as parameter : true Am I missing something? Thank you! Best regards, William.
|
|
|
|
Rank: Administration
Groups: Administrators
Joined: 12/20/2013(UTC) Posts: 1,209 Thanks: 14 times Was thanked: 206 time(s) in 199 post(s)
|
I do not understand your problem, Check the sample 52: it uses a custom enum list as parameter. You can use either key value or display value of the enum selected depending on your needs.
|
|
|
|
Seal Report Forum
»
Report Edition
»
Data Source Creation
»
Input Parameters in SQL Statement for main Table
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.