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

Using a column other than the 1st row in one of the textbox in ReportHeader

3 Answers 157 Views
Report Designer (standalone)
This is a migrated thread and some comments may be shown as answers.
Pinkesh
Top achievements
Rank 1
Pinkesh asked on 24 Nov 2016, 03:41 PM

In my ReportHeader there are a number of Fields that read from a SQL query. It works fine, as most of the fields are provided in the first row.

However there is a Field that require a condition in finding the right row. e.g.

SQL query:

CompanyName OfficeLocation  Name   Phone   EmployeeType

ABC                    Ontario            Tom      123         Contract

ABC                    Ontario            Ann       234        Full

ABC                    Ontario            May      456        Boss

 

ReportHeader:

Company Name: [=Fields.CompanyName]

Office : [=Fields.OfficeLocation]

Boss: [=Fields.Name] (Wont work, as it will display Tom and not May since Tom is the first row)

 

So how do I make it so it will display May in the Boss Field?

3 Answers, 1 is accepted

Sort by
0
Accepted
Katia
Telerik team
answered on 24 Nov 2016, 04:13 PM
Hello Pinkesh,

You can use a conditional function IIf() to get the name of the person based on the value of another data field in the current data row.
In order the function to be evaluated for each row from the database, you need to use an aggregate function, for example:
= Sum(IIF(Fields.EmployeeType = "Boss", Fields.Name, ""))

Check the attached report demonstrating this approach. The report can be opened with Standalone Designer R3 2016.


I hope this will help.

Regards,
Katia
Telerik by Progress
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
0
Pinkesh
Top achievements
Rank 1
answered on 24 Nov 2016, 07:46 PM

Hey Katia

 

Thanks, but what if there are multiple row with BOSS, would this give me back 'MayMayMayMay'?

Would First be able to fix it? =First(IIF(Fields.EmployeeType = "Boss", Fields.Name, "")) 

 

thanks

0
Pinkesh
Top achievements
Rank 1
answered on 24 Nov 2016, 07:48 PM
oh nevermind, Max works for me
Tags
Report Designer (standalone)
Asked by
Pinkesh
Top achievements
Rank 1
Answers by
Katia
Telerik team
Pinkesh
Top achievements
Rank 1
Share this question
or