This program will make it so that your Floorplan Smart Labels read and display the respective equipment's description tag.

Download: FloorplanEquipDescriptionProgram.json

Instructions

  1. Click in the Components pane, and then select Programs from the drop-down.
  1. To add a new program, click .
  • The Program Editor displays.
  1. You can do the following in the Program Editor:
  • Program Name: Name the program.
  • Program Target Filter: Enter the tag(s) created in the previous step.
  • Main pane: Copy and paste the code.
  • : You can select Settings or Variables.
  1. Copy and paste the code in to the Main pane.
  1. Add a shortName string tag to all of your labels and make the value of the shortName $equipName
  1. Click Save in the Program Editor.
    You can click Preview to test.

Program

Run Program on: world

Variable: this > invoked by custom event > start

var finLabels = queryAll('finModel and floorplan and virtualPointRef');

var myIds = [];

finLabels.forEach(function(item){

var pointRef = query('id==' +item.virtualPointRef);

if (pointRef && pointRef.pointId && pointRef.equipRef)

myIds.push(pointRef.equipRef);

});

console.log(myIds);

if (myIds.length) {

finstack.eval("readByIds([" +myIds+"])").then(function(data) {

var myEquips = data.result.toObj();

console.log(myEquips);

myEquips.forEach(function(item){

var vp = query('virtualPoint and equipRef==' + item.id);

vp.equipName = item.description;

});

}, function(err) {console.error(err)});

} else {console.log("No equip ids found")}