Page 1 of 1
Dialog form shown only if no parameters available
Posted: Mon Jul 23, 2012 10:58 am
by amarinelli
Hi all
it's possibile to build a report with a dialog form that is shown only if a certain parameter is not set?
for example:
- I made a simple list of items and I want to view them based on their Category ID
- added a datasource with named parameter @pCategoryID (int) in query
- I added Form1 with a combobox with all categories
- in certain cases, from code, I know the desired category, and I can add it to datasource with this code:
Code: Select all
if (newReport.Dictionary.Variables.Contains("@pCategoryID"))
{
newReport.Dictionary.Variables["@pCategoryID"].ValueObject = m_category;
}
Despite this, the dialog form is always shown, "overwriting" the category ID value...
there's a way to not show the dialog form is the parameter is already set?
thanks in advance
Re: Dialog form shown only if no parameters available
Posted: Tue Jul 24, 2012 8:34 am
by HighAley
Hello.
amarinelli wrote:it's possibile to build a report with a dialog form that is shown only if a certain parameter is not set?
for example:
- I made a simple list of items and I want to view them based on their Category ID
- added a datasource with named parameter @pCategoryID (int) in query
- I added Form1 with a combobox with all categories
- in certain cases, from code, I know the desired category, and I can add it to datasource with this code:
Code: Select all
if (newReport.Dictionary.Variables.Contains("@pCategoryID"))
{
newReport.Dictionary.Variables["@pCategoryID"].ValueObject = m_category;
}
Despite this, the dialog form is always shown, "overwriting" the category ID value...
there's a way to not show the dialog form is the parameter is already set?
You could disable form in your code:
Code: Select all
using Stimulsoft.Report.Dialogs;
.................
(report.Pages["Form1"] as StiForm).Visible = false;
Thank you.
Re: Dialog form shown only if no parameters available
Posted: Tue Jul 24, 2012 1:47 pm
by amarinelli
thanks!
i'm trying to do something similar with parameters in query, but I've got problems...
on C# I wrote:
StiReport newReport = new Stimulsoft.Report.StiReport();
newReport.Load(@"C:\VariablesReport.mrt");
newReport.Dictionary.Synchronize();
if (newReport.DataSources["MyDS"].Parameters.Contains("@pCategory"))
newReport.DataSources["MyDS"].Parameters["@pCategory"].ParameterValue = 2;
newReport.Show(true);
in the report (FormLoad event):
// if(Dictionary.DataSources["MyDS"].Parameters["@pCategory"].ParameterValue) // doesn't work, always empty
// if(MyDS.Parameters["@pCategory"]) // doesn't work, always empty
// if(MyDS.Parameters["@pCategory"].Value) // doesn't work, always empty
// if(MyDS.Parameters["@pCategory"].ParameterValue) // doesn't work, always empty
// if(MyDS.Parameters["@pCategory"].GetParameterValue()) // doesn't work, always empty
//if already set, don't show dialog
if(Dictionary.DataSources["MyDS"].Parameters["@pCategory"].ParameterValue!=null) // doesn't work, always empty
{
MyDS.Connect();
Form1.Visible=false;
}
but it never works... how can I fix it?
thanks in advance
Re: Dialog form shown only if no parameters available
Posted: Tue Jul 24, 2012 3:18 pm
by amarinelli
solved working on compiled report and removing expression from the parameters...
thanks anyway
Re: Dialog form shown only if no parameters available
Posted: Wed Jul 25, 2012 8:28 am
by HighAley
Hello.
It's Great!
Have a nice day.