Related area filters - j5 - 28.0 - Administration & Configuration - Hexagon

j5 IndustraForm Designer Help

Language
English
Product
j5
Search by Category
Administration & Configuration
j5 Version
2019

For the query below to work with a Shift Handover, the Shift Handover needs to be configured as explained in Shift handover setup.

It is sometimes also useful to be able to import data from a related area, for example, a shared utilities area. Let’s add a section now that shows the Operations Logbook entries from Section B.

Because Section B is not contained within Section A, we cannot use the IMPORT.MYSUBLOG function. Instead we will use IMPORT.LOG for our Data Binding:

=IMPORT.LOG("general_logbook", "start_time,logtype,message,status")

What you will notice if you use this formula without any filters, is that there are two issues to resolve:

  1. It still only returns data from Section A. This is because IndustraForms have a default Context Filter that filters by the Area of the containing logbook record.

  2. It does not have a time-based or status-based filter (it returns all of the logbook entries for the matching area).

We’ll start by sorting out the area filter:

=FILTER.AREA(IMPORT.LOG("general_logbook", "start_time,logtype,message,status"), "..", "Section B")

The ".." in the formula above is an FILTER.AREA search parameter that indicates that the IndustraForm should search for "Section B" in the parent area of the current form (in other words, it should search for a sibling, rather than a sub-area). It would also be possible to use =FILTER.AREA(<...>, "/", "Section B"), which would indicate the search for "Section B" should start at the root of the Area Hierarchy.

FILTER.AREA is also different from the general purpose FILTER function, because it automatically clears the currently applied Area filter. To achieve the same thing for other context filters you will need to use the FILTER.CLEAR function. If you are interested, you can update the Data Binding, as follows, and you will see that all of the logbook entries are imported.

=FILTER.CLEAR(FILTER.AREA(IMPORT.LOG("general_logbook", "start_time,logtype,message,status"), "..", "Section B"))

Now let’s add a time filter. Although this is a little more complicated than a simple filter on start_time or status, which may be sufficient for many uses, we’re going to use the same filtering logic that the Handover sub-log rule uses for the Operations Logbook. This will demonstrate some more advanced usage of the filter functionality.

The Operations Logbook sublog rule for Handovers includes any logs that were open at some point during the shift. To do this, we will also need to add some specially named IndustraForm elements that will be synchronized with information from the parent logbook entry for "start_time" and "finish_time". This is what the final formula looks like:

=FILTER(

FILTER(

FILTER.AREA(

IMPORT.LOG("general_logbook", "start_time,logtype,message,status"),

"..", "Section B"),

"finish_time > ? OR finish_time IS NULL", start_time),

"? IS NULL OR start_time < ?", finish_time, finish_time)