7 Replies Latest reply on Mar 6, 2017 6:04 AM by nbhagtani RSS
    nbhagtani Explorer

    I want to append image to string/text while writing service

    Please check below service code:

     

    var connections;

    if (filter == "blank") {

      connections = Networks['FlowServeNetwork'].GetNetworkConnectionsWithTemplate();

    } else {

      var params = {

      start : filter

      };

      connections = Networks['FlowServeNetwork'].GetSubNetworkConnectionsWithTemplate(params);

    }

     

     

    var params = {

      dataShapeName : "FlowserveTreeNetwork",

      infoTableName : "AssetHierarchy"

    };

     

     

    // CreateInfoTableFromDataShape(dataShapeName:STRING, infoTableName:STRING("")):INFOTABLE

    var assets = Resources['InfoTableFunctions'].CreateInfoTableFromDataShape(params);

     

     

    var connection;

     

     

    for each(connection in connections.rows) {

      var data = new Object();

      data.to = connection.to;

      data.from = connection.from;

      data.connectionType = connection.connectionType;

      var thing = Things[connection.to];

       

      var alert = MediaEntities["YellowAlert"].GetImage();

        data.description = thing.description + " " + alert; //appending alert icon with description

        assets.AddRow(data);

    }

     

     

    var result = MediaEntities["YellowAlert"].GetImage();

     

     

    ----

    am unable to append image with text. I have tried keeping description type as text,blob,string in datashape.

    am getting error as "[context: com.thingworx.webservices.context.HttpExecutionContext@2ea80460][message: Execution error in service script [FlowserveNetworkServices testImage] : Unable To Convert From [B to INFOTABLE]"