Prerequisites: The station is running.
- Open the jsonToolkit palette from the workbench palette sidebar.
- Drag a JsonSchema to the Config node or another desired folder location and type a unique name for the schema when prompted.
- To view the schema Property Sheet, double-click the schema glyph in the Nav tree.
The
Property Sheet opens.
When you initially view the Property Sheet for a new schema, the Output property is an empty black box. JSON strings appear here when you generate output.
- In the Property Sheet view, ensure that the
Enabled property is set to true.Setting Enabled to false prevents the generation of output, the execution of queries and the subscription to bound values.
- To begin setting up the message, expand the Objects folder in the palette, drag an Object to the Property Sheet and name it, for example, root.
Braces { } represent this object in the Output. This single top-level object serves as the JSON parent container for other JSON objects that make up the message. Each JSON
object requires a pair of braces ({ }) and arrays require brackets ([ ]).
- Drag an object, array, or property from the palette to the Property Sheet root container.
Some objects may be simple and other objects may yield the more complex results of
Niagara bql queries. The objects that you choose to add depend on your unique requirements.
- Empty braces { } icons represent a JSON object. A bound object is a named object whose child name and value pairs are the
slots within an ord target.
- Bracket [ ] icons represent an array, which is an empty named container of other schema entities. A bound array is a named
object that renders values as a list.
- Other icons represent properties, which may be fixed or bound.
- To update the schema
Output based on the current values retrieved from the station, click Generate, or right-click the schema name and click .This action causes a regular schema to re-evaluate any query and populate the Output box with JSON.
- To set up some actual station data, drag in a BoundObject, name it appropriately, expand the bound object and click the
Select Source finder to the right of the Binding property.This object requires a binding similar to the way components on Px pages require bindings to actual points in a station.
The Choose component/slot for JSON window opens.
- Navigate to and select the source component, click OK and then click Save.
When choosing the target for a binding, you can select any type of slot, from devices to control points to out slots to simple
values. There is no restriction. Due to subscription, saving the schema also generates the JSON message (output).
If your logic contains one or more points whose values change periodically, the schema generates a new JSON message every
time a CoV occurs. If the schema is connected to MQTT, the schema can send each new message to the web.
- To change the
Json Name (a read-only property) to the name of the bound input slot on your Wire Sheet, change Json Name Source property to Target Name, and, from the Slots To Include property, choose Summary Slots.To include specific slots, use the Slots to Include properties, identify and pick individual slots for more fine-grained control.
You may link the output slot to an EngineCycleMessageQueue, if required, which buffers output sent to the onward transport. These could be MQTT or HTTP depending on the onward linked
point.