Dialog form shown only if no parameters available

Stimulsoft Reports.NET discussion
Post Reply
amarinelli
Posts: 7
Joined: Fri Jun 11, 2010 7:08 am
Location: Italy

Dialog form shown only if no parameters available

Post 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
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Dialog form shown only if no parameters available

Post 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.
amarinelli
Posts: 7
Joined: Fri Jun 11, 2010 7:08 am
Location: Italy

Re: Dialog form shown only if no parameters available

Post 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
amarinelli
Posts: 7
Joined: Fri Jun 11, 2010 7:08 am
Location: Italy

Re: Dialog form shown only if no parameters available

Post by amarinelli »

solved working on compiled report and removing expression from the parameters...

thanks anyway
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Dialog form shown only if no parameters available

Post by HighAley »

Hello.

It's Great!
Have a nice day.
Post Reply