Conditional Formatting Step by Step Guide

This pages provides an example of how to apply conditional formatting to a form or grid view. It provides a basic guide, and assumes you are using a pre-existing template.

Load same data

This example uses the demo data that is provided with IJC. You of course will probably be doing this with your own data.

  1. File->New Project

  2. Choose IJC Project (local database with demo data).

  3. Find the PubChem demo data tree in the projects window.

  4. R-click on it and choose 'New View...'.

  5. Select 'Default grid view' as the view type and give the view a name.

  6. The grid view will open in the main window.

Conditionally format the Mol Weight column

Here we apply traffic light formatting to the molecular weight field. We want to display values less than 400 as green, those between 400 and 500 as yellow and those greater than 500 as red.

  • Select the Mol Weight column and click on the Conditional formatting button ( images/download/attachments/48850762/conditionalFormatting.png )in the toolbar. The Conditional Formatting dialog will open.

images/download/attachments/48850762/con_form_step_by_step.png

  • For the type of formatting select 'Create a new from "Traffic lights" template...'. The new type of formatting dialog will appear.

images/download/attachments/48850762/con_form_step_by_step2.png

We will use the default traffic lights formatting so just click OK, but you could change the formatting characteristics if you wanted.

  • The conditional formatting dialog will update to show that it now using the traffic lights type of formatting.

images/download/attachments/48850762/con_form_step_by_step3.png

  1. You can optionally change the name from the default. This name identifies the type of formatting in the grid view so that it can be used again when you conditionally format additional columns. But the default name is OK.

  2. You could change the data field whose values are used to conditionally format our Mol Weight column. This allows you to format one column using the values of a different field. But we don't need that so we leave the data field unchanged.

  3. Specify '400' as the value for the first rule, and leave the outcome as 'Green'. This rule means that values are tested and if they are less than or equal to 400 then they are assigned to the Green bin of the Traffic Lights rule set.

  4. Add another rule by pressing the '+' button and for this rule specify '500' as the value and 'Yellow' as the outcome. This means that if the value has failed the previous test then it will be tested against this rule and if it passes then the value will be assigned to the 'Yellow' bin.

  5. Finally specify 'Red' for the 'Otherwise' test. This means that values failing all the previous tests will be assigned to the Red bin. The dialog should now look like this:

images/download/attachments/48850762/con_form_step_by_step4.png

  • Click on the Close button and you will now see your traffic lights conditional formatting applied to the Mol Weight column.

    images/download/attachments/48850762/con_form_step_by_step5.png

Conditionally format the Donors column

Here we apply the same traffic light formatting to the Donors column. Of course the rules will be different, but the process is much the same.

  1. Select the Donors column and click on the Conditional formatting button in the toolbar. The Conditional Formatting dialog will open.

  2. For the type of formatting select 'Traffic lights'. This selects the existing traffic lights type of formatting that you created when formatting the Mol Weight field. This type of formatting is associated with and stored with the grid view so it can be re-used when formatting any column in that grid view. Do not choose 'Create a new from "Traffic lights" template...' as this would create a second duplicate type of formatting for traffic lights. You would only want to do this if you wanted a different set of bins or formatting characteristics. The new type of formatting dialog will appear. We will use the default formatting so just click OK, but you could change the formatting characteristics if you wanted.

  3. Now for Set of Expressions choose 'Create a new expressions set..'. This allows you to create a new set of rules and apply them to the traffic lights type of formatting.

  4. Specify '5' as the value for the first rule, and leave the outcome as 'Green'.

  5. Add another rule by pressing the '+' button and for this rule specify '8' as the value and 'Yellow' as the outcome.

  6. Finally specify 'Red' for the 'Otherwise' test.

  7. Click on the 'Close button and you will now see your traffic lights conditional formatting applied to the Donors column.

    images/download/attachments/48850762/con_form_step_by_step6.png

Conditionally formatting a form view

The same process applies to conditionally formatting widgets in the form view. Just select the widget, or the column of a table widget and go through the same process.