Dynamically collapse dictionary data sources/variables

Stimulsoft Reports.NET discussion
theregister
Posts: 53
Joined: Wed Nov 27, 2013 5:24 pm

Dynamically collapse dictionary data sources/variables

Post by theregister »

Is there a way to programatically collapse, or expand, our data sources or variables on the dictionary?
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: Dynamically collapse dictionary data sources/variables

Post by Alex K. »

Hello,

Unfortunately, it is not possible. Sorry.

Thank you.
theregister
Posts: 53
Joined: Wed Nov 27, 2013 5:24 pm

Re: Dynamically collapse dictionary data sources/variables

Post by theregister »

I see, well the reason I wanted to do this is because I've been trying to remove variables from the dictionary programatically when the report is being compiled, like this:

Report.Dictionary.Variables.Remove(Report.Dictionary.Variables("MyVar"))

But I noticed this only worked when the Variables Menu was collapsed, for some reason, is there anything else I could do to accomplish this?
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Dynamically collapse dictionary data sources/variables

Post by HighAley »

Hello.

Could you describe your issue more detailed?
Why do you need to remove variables?

Thank you.
theregister
Posts: 53
Joined: Wed Nov 27, 2013 5:24 pm

Re: Dynamically collapse dictionary data sources/variables

Post by theregister »

Say I have a database with 10 tables, each of them is a data source. I have also declared 10 variables into the dictionary.

Now if the user selects Datasource1 from the database, he can use variable1, variable2 and variable3 from the dictionary to filter the data in the data source he selected.

He however doesn't need variables 4 to 10, so it's useless to ask them to him in the parameters tab.

But if the user selects Datasource2 he could use variable1, variable5 and variable6 and so on.

Therefore I'd like to remove those variables the user doesn't need, based on the data source he selected.

I'm really hoping you can help me with this. :D
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Dynamically collapse dictionary data sources/variables

Post by HighAley »

Hello.

There are 2 methods that could help you:

Code: Select all

StiBusinessObjectHelper.GetUsedBusinessObjectsNames(StiReport)
StiDataSourceHelper.GetUsedDataSourcesNames(StiReport)
Using them you could get used Data Sources and Business Objects and remove unnecessary variables.

Thank you.
theregister
Posts: 53
Joined: Wed Nov 27, 2013 5:24 pm

Re: Dynamically collapse dictionary data sources/variables

Post by theregister »

I'm definitely interested in the second option you showed me

Code: Select all

StiDataSourceHelper.GetUsedDataSourcesNames(StiReport)
I was checking this: http://admin.stimulsoft.com/documentati ... Helper.htm and saw the function GetUsedDataSourcesNames returns a Hasthtable, but I'm not exactly sure how to use it, also I see the function GetUsedDataSourcesNamesList that returns a List of String and I tried using it like this while compiling the report just to see what it returned:

Code: Select all

MessageBox.Show(String.Join(",", StiDataSourceHelper.GetUsedDataSourcesNamesList(StiReport).ToArray))
But I'm only getting a blank Message Box, and I can't see anything while debugging either, what am I doing wrong? :geek:
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: Dynamically collapse dictionary data sources/variables

Post by Alex K. »

Hello,

Can you please send us a more detail information about your issue.
Where do you use this code MessageBox.Show(String.Join(",", StiDataSourceHelper.GetUsedDataSourcesNamesList(StiReport).ToArray))

Thank you.
theregister
Posts: 53
Joined: Wed Nov 27, 2013 5:24 pm

Re: Dynamically collapse dictionary data sources/variables

Post by theregister »

Edited, it works now
Last edited by theregister on Mon Jan 06, 2014 7:29 pm, edited 1 time in total.
theregister
Posts: 53
Joined: Wed Nov 27, 2013 5:24 pm

Re: Dynamically collapse dictionary data sources/variables

Post by theregister »

Sorry it seems I typed the report name wrong, it's giving me the data now! :D
Post Reply