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

Expression Editor for multiple possibilities

3 Answers 590 Views
Report Designer (standalone)
This is a migrated thread and some comments may be shown as answers.
James
Top achievements
Rank 1
Iron
James asked on 09 Apr 2019, 02:28 PM

How can I use the expression editor or some other means to assign a string to a numeric value.  For example, I have status integer values that would show up in the legend of my chart but I want the proper string for those values.  There are about 12 different status values with associated strings.  How can I make this happen?  I don't have a database table with the string values to join.

Thanks

3 Answers, 1 is accepted

Sort by
0
James
Top achievements
Rank 1
Iron
answered on 09 Apr 2019, 06:50 PM
I am new to Telerik reporting and I want to make sure I asked this question correctly.  I am reporting on data that has an integer id stored in the database and I am creating a pie chart to show percentages of each type by id number.  What I want to do is provide a string to display in the legend instead of the integer value.  Please see attachment.  How could I do this without having the strings being a part of the data from the query?  Is there a way?  Thanks
0
James
Top achievements
Rank 1
Iron
answered on 09 Apr 2019, 06:51 PM
sorry, forgot the file
0
Neli
Telerik team
answered on 12 Apr 2019, 12:37 PM
Hi James,

If I understood correctly, you would like to set specific strings for each ID (numeric value) in the graph legend which are not taken from the data source. If so, there are two options:

1) If you have known limited number of values (e.g. 3), you can use nested IIf Statements for the Value of the Legend Item. This can happen in the following way:

Click on the barSeries -> Misc -> expand LegendItem-> Value set with an Expression like :

= IIF(Fields.Id = 1, "First ID", IIF(Fields.Id = 2, "Second ID", "Third ID"))

Note that you may nest more IIFs (to substitute "Third ID"). Please, check the attached screenshot and report which demonstrate this solution.

2) The second option is by using UserFunction, in case you have a lot or unknown number of values. You may pass the Id as parameter of the User function and return a string based on the passed Id.

Please, let me know if you have any additional questions.

Regards,
Neli
Progress 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
Report Designer (standalone)
Asked by
James
Top achievements
Rank 1
Iron
Answers by
James
Top achievements
Rank 1
Iron
Neli
Telerik team
Share this question
or