Syntax for evalMetrics bindings in UIViewUsageAndEvents

#1

I’m getting the following error:

"message" : "Expecting specific type for fields with 'any', 'anyof' or 'Obj' type at JSON document at 1:180",

What’s wrong in my syntax?

I have the following series to plot in the component:

"series": [
            {
                "id": "RiskScore",
                "isTimeseries": true,
                "name": "{~MyPackageUi.UsageChart.series.15MinUsage.name~}",
                "data": {
                    "c3type": "MyPackageTdSibilo",
                    "c3function": "evalMetrics",
                    "c3arguments": {
                        "spec": {
                            "ids": ["{{record.data.sibilo.id}}"],
                            "expressions": ["BoilerLeakageDetectionRollingMean"],
                            "include": "start, end, dates, data",
                            "bindings" : {
                                "BoilerLeakageDetectionRollingWindowWidth":"{{record.data.latestModel.rollingWindowWidthInSeconds}}"
                            }
                        }
                    },
                    "responseTransform": null,
                    "collection": false
                },
                "color": "#f0a63a",
                "unit": "%",
                "chartType": "line",
                "axis": "{~MyPackageUi.chart.consumption.axis~}",
                "tooltipGroup": "usage",
                "hasPriorPeriodSeries": false,
                "disabled": false,
                "priorPeriodSeriesConfig": {
                    "color": "#d68510"
                }
            }
        ]

And data retrieved from my (record) dataSource, which is accessed by means of responseSelector: objs, has the following format:

{
  "objs" : [ {
    "sibilo" : {
      "id" : "TN21.2SIB01CAAC"
    },
    "asset" : {
      "id" : "TN21"
    },
    "latestModel" : {
      "rollingWindowWidthInSeconds" : 7200,
      "id" : "f6b04855-23b4-4700-b8f7-dfcfb9ceeeab"
    },
    "id" : "boilerUCSibTn212sib01caac",
    "version" : 131079,
    "name" : "leakageDetection",
    "meta" : {
      "tenantTagId" : 83,
      "tenant" : "MyTenantName",
      "tag" : "MyTagName",
      "created" : "2019-02-22T16:45:46Z",
      "createdBy" : "authorizer",
      "updated" : "2019-03-21T19:25:23Z",
      "updatedBy" : "authorizer",
      "timestamp" : "2019-03-22T13:31:45Z"
    },
    "predictionInterval" : "SECOND",
    "predictionLabel" : "prediction",
    "typeIdent" : "SBL"
  } ],
  "count" : 1,
  "hasMore" : false
}
#2

@rghera to exclude that this is a UI relaed issue - does it work if you run the evalMetrics from console using some sibilos.id?

#3
includeFilter= "[this,latestModel.minDurationOverThresholdInSeconds,latestModel.maxDurationUnderThresholdInSeconds, latestModel.threshold,latestModel.rollingWindowWidthInSeconds]";
useCase = MyTenantBoilerTdUseCase.fetch({include: includeFilter, filter: "sibilo.id == 'TN21.2SIB01CAAC' && name == 'leakageDetection'"}).objs[0];
latestModel = useCase.latestModel;

c3Viz(MyTenantBoilerTdSibilo.evalMetric({
	"interval":"MINUTE",
	"start": "2019-03-08T17:38:47.953Z",
	"end":"2019-03-25T12:50:00.719+01:00",
	"include":"start, end, dates, data",
	"id": useCase.sibilo.id,
	"expression": "BoilerLeakageDetectionRollingMean",
	"bindings": { 
		"BoilerLeakageDetectionRollingWindowWidth": latestModel.rollingWindowWidthInSeconds
	}
}))

@quentin.chouleur made me notice that UI Framework generates a strange metadata parameters (like type:{}) in the payload of the POST request. It should not be due to syntax errors.

We also tried to “force” the type in the bindings, but it was not helpful: