Displaying extra information for a Logger Case

It is sometimes desirable to be able to display additional information to the user about existing cases over and above the basic information held by iShare in the at_incidents table. For instance you may wish to display the current status of the case or other information maintained in another back office system.

From Version 5.4.0 of iShare, additional information can be associated with a case by adding a Data Share Lookup to the Fault layer and using a custom formatFunction to customise the popup content to include the additional fields in the information popup. Currently the lookup must be added manually (please contact support@astuntechnology.com for assistance) it is expected that the ability to configure a DataShare lookup for a Fault Layer in Studio will be available in v5.6.0.

Some work will be required to prepare a table or view of the additional information that will be reference by the Data Share Lookup. An example is detailed below:

Scenario

A back office system holds a list of cases with their current status, last updated date plus the iShare uniqueid. This additional status information needs to be associated with existing cases while new cases that have not yet made it into the back office system need to have default values defined.

Workflow

The back office table is imported into iShare as a Standard Data Share Connection so that this status information is in the iShare PostgreSQL database. A PostgreSQL view is then defined which will be the source data used by the Data Share Lookup which contains a row for all cases in at_incidents, the relevant information from the back office table where it exists and default values for new records. An example view definition is shown below:

Example View
CREATE OR REPLACE VIEW at_incidents_status AS 
         SELECT "highways_status_import"."iShareID" AS uniqueid, "highways_status_import"."IncidentTypeCode" 
                 AS type, "highways_status_import"."PublicStatus" AS status, 'Last updated '::text || 
                 "highways_status_import"."DateModified"::text AS details
           FROM "highways_status_import"
UNION 
         SELECT at_incidents.uniqueid, at_incidents.type, 'Reported'::text AS status, '' AS details
           FROM at_incidents
          WHERE NOT (at_incidents.uniqueid::text IN ( SELECT "highways_status_import"."iShareMapsID"
                   FROM "highways_status_import"))

 

The above view unions two queries, one to fetch the records from the back office table (highways_status_import) and the other to fetch all rows in the at_incidents table that are not found in the back office table and assign them default values for the extra information.

Once the view is defined in order to use it with a Data Share Lookup you must define an Internal Data Share Connection which simply selects all records from the view e.g.

Example
select * from at_incidents_status

Due to the way that PostgreSQL tracks tables and the way that Data Share imports data a Workflow Job with the following Tasks is normally required when working in this situation:

  • Drop the view
  • Synchronise the back office Data Share Connection
  • Create the view