cmckee

Manual data entry custom symbol

Discussion created by cmckee on Feb 14, 2020
Latest reply on Feb 17, 2020 by JTWhite

Hello,

 

I am using the latest custom symbol code for entering multiple manual data entries in PI Vision and noticed that the attribute column does not display the entire Element/Attribute name. For example, I've attached a screenshot that where it should display as ARM A| Availability Status but it only displays the last A in the Element name. It appears the issue is related to the space in between. PI Vision also throws a "Communication Error" as soon as I drag the attribtues onto the display with this symbol.

 

Debug refers to this line 15567,9:         return Function.prototype.apply.call(logFn, console, args);

 

Everything else is working and the attribute value updates correctly when I press the update button.

Would anyone have any suggestion on what it could cause this? I've attached the .JS file that is being used.

I don't have this issue with other custom symbols or the native symbols displaying the full attribute name but unfortunately not strong enough with JS coding to find the problem on my own...

 

My best guess is that this is happening in this part of the JS file

 

function getStreams(datasources){   
   //Breaking chains: http://stackoverflow.com/questions/28250680/how-do-i-access-previous-promise-results-in-a-then-chain
   var datastreams = _.map(datasources, function(item) {
        var isAttribute = /af:/.test(item);
        var path = isAttribute ? item.replace(/af\:(.*)/,'$1') : item.replace(/pi\:(\\\\.*)\?{1}.*(\\.*)\?{1}.*/,'$1$2');
        var label = isAttribute ? path.match(/\w*\|.*$/)[0] : path.match(/\w+$/)[0];
        var friendlyName = isAttribute ? label.match(/\|(.*$)/)[1] : label;
        
       
        return {IsAttribute: isAttribute,
          Path: path,
          Label: label,
          IsSelected: false,
          FriendlyName: friendlyName,
          Value: undefined,
          Timestamp: scope.config.defaultTimestamp};
       });
   
   var streamsConfigPromise = getStreamsConfig(datastreams);

 

Thanks!

Chris

Outcomes