This is a migrated thread and some comments may be shown as answers.

Access report items within User defined functions.

5 Answers 356 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Pavan
Top achievements
Rank 1
Pavan asked on 06 Apr 2012, 12:03 PM
Based on one field in report i need to make visible/caluculate the values of other dependent textboxes.
So for this what i have done is Created a custome function.
eg: public static string Test(int idPt)
{
//Logic
if(idPdt==1)
{
textbox2.Value="test2";
textbox2.Visible=true;
}
if(idPdt==2)
{
textbox3.Value="test3";
textbox3.Visible=true;
}
else
{
textbox2.Visible=false;
textbox2.Visible=false;
}
}
But i am not able to access any of the report items in this function. when i remove static modifier for the method then all the items are accessible.

How to acheive this in Telerik Reporting?

5 Answers, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 06 Apr 2012, 01:19 PM
Hi Pavan,

You do not need user functions for such simple needs - you can directly use Expressions
and to conditionally specify the value for the TextBox utilize the IIF() function or any other built in Function that works for your needs.
Additionally if you need to access a function that is not static (instance function), you could use the following expression:

"= ReportItem.Report.ItemDefinition.MyFunction(args)

where the ReportItem is the current item in which context the expression is evaluated, the Report keyword is used to get reference to the processing report and ItemDefinition gets the definition report.

All the best,
Steve
the Telerik team
NEW in Q1'12: Telerik Report Designer (Beta) for ad-hoc report creation. Download as part of Telerik Reporting Q1 2012. For questions and feedback, use the new Telerik Report Designer Forum.
0
David
Top achievements
Rank 1
answered on 06 Apr 2012, 05:34 PM
When a report item is not visible how to remove the white space created by it on the report?
will the solution you are suggesting automatically do it?
thanks
0
Steve
Telerik team
answered on 09 Apr 2012, 08:14 AM
Hello David,

This thread does not discuss the visibility of items. For more info on your inquiry, refer to Design Considerations for Report Item Layout help article.

Greetings,
Steve
the Telerik team
NEW in Q1'12: Telerik Report Designer (Beta) for ad-hoc report creation. Download as part of Telerik Reporting Q1 2012. For questions and feedback, use the new Telerik Report Designer Forum.
0
Swetha
Top achievements
Rank 1
answered on 01 Jun 2015, 05:42 PM

Telerik Team,

 

I have a Telerik reporting table in which each cell has a textbox which calls the static user functions to set the value for the textbox.

Sometimes I make this table invisible dynamically in code behind and so datasource is not set for that table.

Even though the table is invisible still these user functions in that table are being called which is raising an exception in my case.

Can you please tell me how to make the static user functions are not called by expression in textbox value when the table is invisible.

0
Nasko
Telerik team
answered on 02 Jun 2015, 02:40 PM
Hello Swetha,

In more recent versions of Telerik Reporting the processing of the report does not depend on the visibility of the report items. This means that all report items will be processed and their expressions will be evaluated regardless if their Visible property is set to True or False.

You can check if the call is made by a hidden report item by sending the ReportItem.Visible value to the user function arguments. Based on this value you can continue/stop any further execution of the user function code.

Regards,
Nasko
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
General Discussions
Asked by
Pavan
Top achievements
Rank 1
Answers by
Steve
Telerik team
David
Top achievements
Rank 1
Swetha
Top achievements
Rank 1
Nasko
Telerik team
Share this question
or