Multiple Parameter ????

Stimulsoft Reports.WEB discussion
Post Reply
Karthikeyan.V
Posts: 7
Joined: Mon May 18, 2009 12:17 am
Location: Hyderabad

Multiple Parameter ????

Post by Karthikeyan.V »

Hello,

I have 2parameters to Filter the Compiled report.

Dim Stimulrep As StiReport = New StiReport()

Stimulrep("@USERNAME1") = objuserInfo("userName")
Stimulrep("@CompanyID") = ddlCompanyName.SelectedItem.Value


Not everytime i may not pass value in all 2 of parameter's. i tried to pass values like the following lines

Stimulrep("@USERNAME1") = objuserInfo("userName")
Stimulrep("@CompanyID") = Nothing

But the Report is coming Empty.if I pass both parameter is passed then the report is working. what can be done to bring result even if only one parameter is passed at a time.

The Edit Data Source Query iam using is Select * from DatabaseName where username = @USERNAME1 and Companyid = @CompanyID.

Please Help me in fixing this issue. Thanks In Advance .





Jan
Posts: 1265
Joined: Thu Feb 19, 2009 8:19 am

Multiple Parameter ????

Post by Jan »

Hello,

You need change your sql query regarding your request because query:

Code: Select all

Select * from DatabaseName where username = @USERNAME1 and Companyid = null 
returns only rows where Companyid is null. You need use something like this:

Code: Select all

Select * from DatabaseName where username = @USERNAME1 and (Companyid = @CompanyID or @CompanyID is null)
Thank you.
Karthikeyan.V
Posts: 7
Joined: Mon May 18, 2009 12:17 am
Location: Hyderabad

Multiple Parameter ????

Post by Karthikeyan.V »

Hi,

Thanks for the response. But the company id is optional parameter here. So how to pass the optional parameter if the user is not selected anything from the company names dropdown.

regards,
karthik
Jan
Posts: 1265
Joined: Thu Feb 19, 2009 8:19 am

Multiple Parameter ????

Post by Jan »

Hello Karthik,
karthik_saje wrote:Hi,

Thanks for the response. But the company id is optional parameter here. So how to pass the optional parameter if the user is not selected anything from the company names dropdown.
In this case you need change your sql query. You can try use expression in sql query. For example:

select * from customers where {myvariable}

but i recommend you use variant which i post in previous topic.

Thank you.
Karthikeyan.V
Posts: 7
Joined: Mon May 18, 2009 12:17 am
Location: Hyderabad

Multiple Parameter ????

Post by Karthikeyan.V »

Hello,
Just a last question, if i have 2 parameters say @CompanyID and @DepartmentID

How should i write the SQL Query in Stimulsoft EDIT Datasource. i mean i have value of only CompanyID and Department is NULL. I had tried many possiblities but still the report comes empty. if i pass values for both parameter the Report works. Please Suggest us what can be done. i read from post that We can use variable instead of parameter . is that correct ????
Jan
Posts: 1265
Joined: Thu Feb 19, 2009 8:19 am

Multiple Parameter ????

Post by Jan »

Hello,

You have tryed following variant?

Code: Select all

Select * from DatabaseName where username = @USERNAME1 and (CompanyID = @CompanyID or @CompanyID is null)
If you specify parameters in your report you need fill it with value which will give you result. If you don't want specify parameter value you need change sql query or you need add logic construction which will be support parameter with null value. Please check query which i post before.

Thank you.


Karthikeyan.V
Posts: 7
Joined: Mon May 18, 2009 12:17 am
Location: Hyderabad

Multiple Parameter ????

Post by Karthikeyan.V »

Hello,
Thanks for your speedy reply,
i used Query like this

Select * from DatabaseName where username = @USERNAME1 and (CompanyID = @CompanyID or @CompanyID ='')

and this helped me in getting my output. thanks again.
thiru
Posts: 3
Joined: Sat Jul 04, 2020 1:52 am

Re: Multiple Parameter ????

Post by thiru »

Multiple Parameter ????

hai im using stimulsoft tool . i passed multiple parameters in single variable . example variablename is firstname parameter values (dinesh,kumar,thiru,etc)
Lech Kulikowski
Posts: 6266
Joined: Tue Mar 20, 2018 5:34 am

Re: Multiple Parameter ????

Post by Lech Kulikowski »

Hello,

Sorry, maybe we did not exactly understand your question. Could you explain your issue in more details?

Thank you.
Post Reply