1 Reply Latest reply on Dec 8, 2016 4:47 AM by jens.bruckmann

    fixed value as row

    jens.bruckmann

      Hi all,

       

      me again. When I have my js file is there a way to add an additional fixed value as table output which is not part of the columns?

       

      I would like to have the ID all time inserted in the output.

       

      myConnector.getSchema = function (schemaCallback) {
          var cols = [
            {id : "id",tableau.dataTypeEnum.string}, 
           { id : "datetime", alias : "Time", dataType : tableau.dataTypeEnum.string },
        { id : "value", alias : "CPU Load", dataType : tableau.dataTypeEnum.string },
        { id : "value_raw", alias : "CPU Load calculated", dataType : tableau.dataTypeEnum.int },
        { id : "coverage", alias : "Coverage", dataType : tableau.dataTypeEnum.string },
        { id : "coverage_raw", alias : "Coverage calculated", dataType : tableau.dataTypeEnum.int }
      

       

       

      and for

       

      myConnector.getData = function(table, doneCallback) {
      
      ...
      
      
      var feat = resp.histdata,
                  tableData = [];
      
                  // Iterate over the JSON object
        //String id = UUID.randomUUID().toString();  
                  for (var i = 0, len = feat.length; i < len; i++) {
                      tableData.push({
      
        "id" : feat[i],id,
                          "datetime": feat[i].datetime,
        "value": feat[i].value,
                          "value_raw": feat[i].value_raw,
        "coverage": feat[i].coverage,
        "coverage_raw": feat[i].coverage_raw
      
                      
                      });
                  }
      

      so my idea was to add simply the id but as I made it, it does not work. Any Idea?