Conditional Styles with Dynamic Dates

With conditional styles you can take control over the lists in M3 and S3. Dynamic dates are an important concept when it comes to comparing dates. I’m not the developer who implemented the feature, in fact I have never used it before today. But I understand that this is a topic that quite a few are interested in. In this post I’ll use the requested delivery date on an order and use different styles for if the order has a requested delivery date the coming week or if the requested delivery date is passed.

When creating a conditional style for a date there are four different options.

You can compare a value with:
– A field
– Specific Fixed Dates
– Dynamic Date
– Specific Dynamic Dates

A field is when you compare it to another field on the screen. A Specific Fixed Date is a fixed date, like a hardcoded date. Useful for always showing delivery dates in green or national holidays in red. They will always have the condition completed regardless of today’s date. Dynamic Dates on the other hand lets you compare a date with a dynamic date. To simplify it I would say that you compare with today, but that is not entirely true since you can specify an interval that will be evaluated for the date in the panel.

Specific Dynamic Dates are not covered in this post. Specific Dynamic Dates without a interval can be used for showing that a date is a public holiday for example. But compared to a specific fixed date it will only show the style if the condition is true with todays date or the interval compared to todays date. The interval is useful if you set the last day of the month and want to highlight all dates that are within an interval around the end of the month. You add the last date in each month and set the interval to for example 3 days before.

Dynamic dates are the most useful. I am not so good at M3 so my scenario will be based upon customer order processing and the delivery date. I have the following requirements:

1. If the requested delivery date is today the field should be highlighted.
2. If the requested delivery date is within the coming week the label should be green.
3. If the requested delivery date is passed with 1 day up to a week the label should be red.
4. If the requested delivery date is passed with a week up to a month the field will be red and the text black.

Of course for a real scenario I would also add a condition for the status of the customer order so only those not delivered would be highlighted but I will not do that in the example since it makes it harder for me to get my demo-data.

Highlight today

I will use OIS300 and a view and sortingorder that have the requested delivery date. Select to open the conditional styles for the program.

Select New to add a new conditional style.

I selected the field I want to apply the style to. This does not have to be the value I compare but it is in my case and I will use the requested delivery date.

I will not set an interval because the dynamic date is today. I press Next and configure it to show a green highligh color.

I give the style a description and save it.

Highlight orders with requested delivery date the coming week

Create a new conditional style for this requirement.

In this case we need to specify that the style should be applied for a specific time interval so click the interval and add the following:

If the requested delivery day is the following week it will be 1 day after today up until 1 week after. That makes sense. Save and select the green text to be shown and give the condition a name.

Show overdue deliveries

Next is to highligh those orders with a requested delivery date that is passed with 1 day up to a week with a red label. You start by adding a new condition, selecting the requested delivery date.

You set the date interval to the following:

The date you are comparing is the delivery date, if it is set to two days before today, it means that it is late since that date has passed. This is the main tricky part; a date that is passed is atually before today. That is it! But the way we think about dates makes that a bit hard – passed before. Also mind the order here we want the condition to be valid 1 week – 1 day before.

Configure the condition to show a red label and give it a name and description.

Show even more overdue deliveries

The last requirement is to highligt the orders that have a requested deliverydate that is more than 1 week overdue.

The condition is similar to the previous one and looks like this.

The final result

In a real world scenario I would add a condition for the status of the order on the first screen in the wizard. There would be one check for lowest status and one for highest status.

The resulting conditional styles in my example look like this:

This is the way they look applied to OIS300.

Have you used Dynamic Dates? What did you use it for?

2 thoughts on “Conditional Styles with Dynamic Dates

  1. Dilshan Embuldeniya


    Can we hide a entire raw in conditional styles by altering the XML script?

    1. karinpb Post author

      No you can’t hide a row with a conditional style. If some rows shouldn’t be in the list it has to be solved with business logic in M3. It would be strange if for example you only get 15 lines (instead of 33) but there are 33, you would think that it is the end of the list when it isn’t. An alternative would be to change the foreground color so that it is lighter which would make the other rows stand out more. For example #33000000.

Comments are closed.