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

Parameter data source selects user defined function

1 Answer 96 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Phil
Top achievements
Rank 1
Phil asked on 10 Nov 2015, 04:20 PM

I have a Parameter called 'Group By'.  There are 3 choices in a dropdown on the report for which the user can select one and the report will be grouped differently.  I did this using bindings.

 My problem comes with the values of the dropdown.  We have a user defined function set up that accepts an organizations id and culture then returns a certain value.  For example, some orgs use 'Goal' and some use 'Strategy' to refer to the same thing.  I want the dropdown to change depending on the value of this function.

The select statement for my data source goes as follows:

select 
1 as GroupById
,'Epm.Reports.ReportLibrary.TermCache.GetData("FOCUS_AREA", Parameters.OwnerCode.Value, Parameters.CultureName.Value)' as GroupDisplay
UNION
select 
2 as GroupById
,'Epm.Reports.ReportLibrary.TermCache.GetData("FUNCTION_AREA", Parameters.OwnerCode.Value, Parameters.CultureName.Value)' as GroupDisplay
UNION
select
3 as GroupById
,'Epm.Reports.ReportLibrary.TermCache.GetData("GOAL", Parameters.OwnerCode.Value, Parameters.CultureName.Value)' as GroupDisplay

 

The Display Value for my parameter is GroupDisplay.  I would like these to display the word that is pulled from my function.  But the dropdown is filled with the full text 'Epm.Reports.ReportLibrary.TermCache.GetData("GOAL", Parameters.OwnerCode.Value, Parameters.CultureName.Value)'.  The function works elsewhere in the report so I know it is not that.  Any ideas?

 

Thanks,

Phillip

1 Answer, 1 is accepted

Sort by
0
Accepted
Nasko
Telerik team
answered on 13 Nov 2015, 12:38 PM
Hello Phil,

.Reports.ReportLibrary.TermCache.GetData() is a user-defined function which can be used only inside Expressions. It is not possible to use this function inside an SQL query, such as your select statement.
You can use the result of the SQL query and append the user function result inside a similar expression:

= Fields.GroupDisplay + .Reports.ReportLibrary.TermCache.GetData()

or you can pass the data field to the user function inside the expression:

= .Reports.ReportLibrary.TermCache.GetData(Fields.GroupDisplay)

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
Phil
Top achievements
Rank 1
Answers by
Nasko
Telerik team
Share this question
or