Report Variable problem
-
- Posts: 7
- Joined: Tue Feb 10, 2009 7:47 am
- Location: Hyderabad, India
Report Variable problem
I have created/designed a report with two report variables (Ex. Company and Trn.Date) and these two report variables are placed on to the report. I saved the report
template in the sql server database(express). When i view the report by passing two report variables, i get correct report. But if i pass one variable (ie. Trn.Date), i am
getting the report with two variables. Trn.Date is correct, because i passed it to the report. But company is showing the value, which i had passed it at the time of report
creation. I don't want see the variable, which i did not pass to the report. Either i should delete the variable which was not passed or i should hide variable when i view the report.
It should be handled at runtime for that i have to develop logic for this. I tried to inspect the report variables in the Dictionary using StiVariable, but i am not able to delete or hide the variable.
Please provide me the sample code in c#.
thanks in advance.
template in the sql server database(express). When i view the report by passing two report variables, i get correct report. But if i pass one variable (ie. Trn.Date), i am
getting the report with two variables. Trn.Date is correct, because i passed it to the report. But company is showing the value, which i had passed it at the time of report
creation. I don't want see the variable, which i did not pass to the report. Either i should delete the variable which was not passed or i should hide variable when i view the report.
It should be handled at runtime for that i have to develop logic for this. I tried to inspect the report variables in the Dictionary using StiVariable, but i am not able to delete or hide the variable.
Please provide me the sample code in c#.
thanks in advance.
Report Variable problem
Hi,
You can delete a variable from the Dictionary only in the report template before compilation, when report is just a set of objects. It is impossible to delete variable when the report has been loaded from assembly, compiled or attached as class in the Application.
The code for deleting of the Variable is simple:
report.Dictionary.Variables.Remove("VariableName");
Thank you.
You can delete a variable from the Dictionary only in the report template before compilation, when report is just a set of objects. It is impossible to delete variable when the report has been loaded from assembly, compiled or attached as class in the Application.
The code for deleting of the Variable is simple:
report.Dictionary.Variables.Remove("VariableName");
Thank you.
-
- Posts: 7
- Joined: Tue Feb 10, 2009 7:47 am
- Location: Hyderabad, India
Report Variable problem
Thanks for your reply. I am able to delete the variable from the Dictionary. But, is there any solution for not to display the report variable on the report, which was not passed to the report.Edward wrote:Hi,
You can delete a variable from the Dictionary only in the report template before compilation, when report is just a set of objects. It is impossible to delete variable when the report has been loaded from assembly, compiled or attached as class in the Application.
The code for deleting of the Variable is simple:
report.Dictionary.Variables.Remove("VariableName");
Thank you.
Thank you.
Report Variable problem
Hello,
You want remove variables from report dictionary if it does not have value before calling report designer?
Thank you.
You want remove variables from report dictionary if it does not have value before calling report designer?
Thank you.
-
- Posts: 7
- Joined: Tue Feb 10, 2009 7:47 am
- Location: Hyderabad, India
Report Variable problem
Not from report dictionary, I am able to delete variables from report dictionary. I want to delete variables from report design if it does not have value before calling report designer.Jan wrote:Hello,
You want remove variables from report dictionary if it does not have value before calling report designer?
Thank you.
Thank you.
Report Variable problem
Hello
There is a Nullable type of variables in the Dictionary. If you do not assign such variables, their result would remain as null.
There is also a HideZeroes property in the StiText component.
If you need to modify expression or hide entire StiText component or to change somehow the expression of the report components, then you should use the following loop:
Thank you.
There is a Nullable type of variables in the Dictionary. If you do not assign such variables, their result would remain as null.
There is also a HideZeroes property in the StiText component.
If you need to modify expression or hide entire StiText component or to change somehow the expression of the report components, then you should use the following loop:
Code: Select all
StiReport report = new StiReport();
report.Load("report.mrt");
foreach (StiComponent comp in report.GetComponents())
{
if (comp is StiText)
{
StiText myText = (comp as StiText);
{
if (myText.Text.Value.Contains("MyVariable"))
{
myText.Enabled = false;
}
}
}
}
report.Show();
-
- Posts: 7
- Joined: Tue Feb 10, 2009 7:47 am
- Location: Hyderabad, India
Report Variable problem
Thank you very much.Edward wrote:Hello
There is a Nullable type of variables in the Dictionary. If you do not assign such variables, their result would remain as null.
There is also a HideZeroes property in the StiText component.
If you need to modify expression or hide entire StiText component or to change somehow the expression of the report components, then you should use the following loop:
Thank you.Code: Select all
StiReport report = new StiReport(); report.Load("report.mrt"); foreach (StiComponent comp in report.GetComponents()) { if (comp is StiText) { StiText myText = (comp as StiText); { if (myText.Text.Value.Contains("MyVariable")) { myText.Enabled = false; } } } } report.Show();
it solved my problem.
Report Variable problem
Hi
You are welcome!
Please let us know if we could assist you any further.
Thank you.
You are welcome!
Please let us know if we could assist you any further.
Thank you.