How-To Guides
Analytics Guides

Use the Join Processor Function

12min
you can use the join processor to combine the output for two or more input processors you must define the connector when multiple input processors are connected to a join processor understanding different join outputs you have the following output modes for join processor by fields map use this option if standard json format is needed (e g , for database output) array use this option if all values are needed in an array format user scenario review the following scenario for the join processor function then, you will simulate plc data and join outputs using multiple input processors in a chemical plant, different plcs monitor environmental factors like temperature, humidity, gas levels, and pressure in various plant areas with the join processor, you can combine these readings into an array or json format for real time monitoring and trend analysis of the plant environment step 1 add a device follow the steps to connect a device docid\ nm1lqfefya dsiffitity and configure the following parameters device type simulator driver name generator enable alias topics select the checkbox step 2 add tags after connecting the device, add the following tags see add tags docid\ h5heqicxrcy3nch9kbg9i to learn more each tag will be used for simulating the different join processor outputs mentioned above tag 1 tag1 name select s random value generator value type select int64 polling interval enter 5 tag name enter tag1 tag 2 tag2 name select s random value generator value type select float64 polling interval enter 5 tag name enter tag2 tag 3 tag3 name select s random value generator value type select string polling interval enter 5 tag name enter tag3 step 3 create analytics flows you can now create the analytics flows using data from the device and tags you previously created follow step 3a or 3b, depending on whether you want to combine outputs in json or array format to create an analytics flow with the join processor function navigate to analytics on the analytics canvas, click add processor the create a processor dialog box displays select datahub subscribe in the topic field, click the search icon, select the device you previously created, and then select the alias topic for the tag1 click save repeat steps 2 5 to add another datahub subscribe node select the alias topic for the tag2 and tag3 respectively step 3a configure join processor with output as map click add processor again and select join processor the following information defines this function output mode select map from the drop down menu map field prefix add a prefix before the output fields when they are combined if needed input source you can use the device or connecting wire definition name if the device name is chosen, it is required to have the devicename and tagname fields in the input field the field from the json string you want to join available options are device , tagname , value , etc click save connect the datahub subscribe processor (tag tag1) to the join processor with a wire and enter the definition of inputa for the connection connect the datahub subscribe processor (tag tag2 ) to the join processor with a wire and enter a definition of inputb for the connection connect the datahub subscribe processor (tag tag3 ) to the join processor with a wire and enter a definition of inputc for the connection on the analytics canvas, click save step 3b configure join processor with output as array click add processor again and select join processor the following information defines this function output mode select array from the drop down menu map field prefix this field can remain empty field the field from the json string you want to join available options are device , tagname , value , etc array sort by in array mode, you can arrange field values by tag , definition , id , and time array sort order in array mode, you can arrange field values in either ascending or descending order click save connect the datahub subscribe processor (tag tag1) to the join processor with a wire and enter the definition of inputa for the connection connect the datahub subscribe processor (tag tag2 ) to the join processor with a wire and enter a definition of inputb for the connection connect the datahub subscribe processor (tag tag3 ) to the join processor with a wire and enter a definition of inputc for the connection on the analytics canvas, click save step 4 view output of processor click the view icon in the join processor to view outputs in different modes on the analytics canvas view map mode output the join processor returns a json string with the joined fields from all the tags defined view array mode output the join processor returns an array of the joined field from all the tags defined, sorted by time in ascending order