Conditional High-lighting

Stimulsoft Reports.NET discussion
Post Reply
mbrahman
Posts: 7
Joined: Thu Jun 07, 2007 5:57 am

Conditional High-lighting

Post by mbrahman »

Hi Advanced Users,

I am new to the report writer. I am working on a report which requires me to get the number of days delayed between order shipment date and required date and have got the results correct and need to change the calculated field value to be printed in RED color when it is more than 0 days.

I have done the following to get the value:

Edit Calculated Column - Pop-up
(timespan) Days = Order_Details.Orders.ShippedDate-Order_Details.Orders.RequiredDate

RESULT e.g... 5.00:00:00 (Where it is 5 days and time 00:00:00 then I converted the result with the following :-

Edit Calculated Column - Pop-up
(decimal) newDays = Order_Details.Days.Days

RESULT e.g.. 5 now...... the problem I face is since the result value is 5 which is above 0 days as per requirements I defined the Condition in the field properties to change the printing color of the value to be in RED when it is greater then 0 but nothing happens to the color !

Could you kindly help

Thank You.


Edward
Posts: 2913
Joined: Fri Jun 09, 2006 4:02 am

Conditional High-lighting

Post by Edward »

The goal you need to achieve may be reached in the following way:

1. Add an Calculated column of the decimal type with the following expression inside:

(Orders["ShippedDate"] is System.DBNull)||(Orders["ShippedDate"] is System.DBNull)?0M:(decimal)((Orders.RequiredDate-Orders.ShippedDate).Days)

The name of the column will be for example Days.

2. Place the resulted calculated column in the StiText component on the DataBand:
{Orders.Days}

3. For that StiText component in the HighLightCondition property of it you can define the following expression:

Orders.Days<0

Also you should define a Red color for the Text in the HighLightCondition. This color will be set for the Font of the StiText component if the Condition succeeds.

You may also see an example report in the attachment. This report may be opened in the Demo sample Application from the standard delivery.

Thank you.
Attachments
10.DifferenceInRed.mrt
(15.76 KiB) Downloaded 244 times
mbrahman
Posts: 7
Joined: Thu Jun 07, 2007 5:57 am

Conditional High-lighting

Post by mbrahman »

:biggrin:

Hi Edward,

Thank you for the solution and really appreciate the prompt reply, and it works very well and also thanks for the sample report, from which I also learned quite a few thing on displaying and condition the proper parent-child calculated fiel
Edward
Posts: 2913
Joined: Fri Jun 09, 2006 4:02 am

Conditional High-lighting

Post by Edward »

Thank you for the good words.

We always try to do our best for our customers!

Thank you.
Post Reply