Page 1 of 2
Dynamically collapse dictionary data sources/variables
Posted: Mon Dec 30, 2013 5:21 pm
by theregister
Is there a way to programatically collapse, or expand, our data sources or variables on the dictionary?
Re: Dynamically collapse dictionary data sources/variables
Posted: Tue Dec 31, 2013 8:14 am
by Alex K.
Hello,
Unfortunately, it is not possible. Sorry.
Thank you.
Re: Dynamically collapse dictionary data sources/variables
Posted: Thu Jan 02, 2014 7:38 pm
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?
Re: Dynamically collapse dictionary data sources/variables
Posted: Fri Jan 03, 2014 5:50 am
by HighAley
Hello.
Could you describe your issue more detailed?
Why do you need to remove variables?
Thank you.
Re: Dynamically collapse dictionary data sources/variables
Posted: Fri Jan 03, 2014 4:07 pm
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.

Re: Dynamically collapse dictionary data sources/variables
Posted: Sat Jan 04, 2014 5:59 am
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.
Re: Dynamically collapse dictionary data sources/variables
Posted: Sat Jan 04, 2014 7:38 pm
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?

Re: Dynamically collapse dictionary data sources/variables
Posted: Mon Jan 06, 2014 8:31 am
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.
Re: Dynamically collapse dictionary data sources/variables
Posted: Mon Jan 06, 2014 4:57 pm
by theregister
Edited, it works now
Re: Dynamically collapse dictionary data sources/variables
Posted: Mon Jan 06, 2014 5:20 pm
by theregister
Sorry it seems I typed the report name wrong, it's giving me the data now!
