Skip to main content
1-Visitor
October 29, 2019
Solved

Getting the number of field definitions from an infotable

  • October 29, 2019
  • 1 reply
  • 1261 views

Hi all, I am trying to get the number of field definitions from my infotable as shown.

Capture.PNG

In this case, I want the number of field definitions to return 4. I've tried using getFieldCount() but it doesn't seem to work, any help will be greatly appreciated!

Best answer by kahmeng96

Hi @Constantine, thanks for reply. I am actually using an IDE to create a custom widget so your solution might not be applicable. Therefore, I will be using mine as shown in the code below.

this.updateProperty = function (updatePropertyInfo) {
 var widgetProperties = this.properties;
 var dataRows = updatePropertyInfo.ActualDataRows;
 var nRows = dataRows.length;
 var rowData = new Array();
 for (var i = 0; i < nRows; i++) {
 rowData.push(dataRows[i]);
 }
}
console.log(Object.keys(rowData[0]).length); //returns 4

 

1 reply

18-Opal
October 29, 2019

Hello,

 

There you are:

myProperty.dataShape.fields.size()

 

/ Constantine

kahmeng961-VisitorAuthorAnswer
1-Visitor
October 30, 2019

Hi @Constantine, thanks for reply. I am actually using an IDE to create a custom widget so your solution might not be applicable. Therefore, I will be using mine as shown in the code below.

this.updateProperty = function (updatePropertyInfo) {
 var widgetProperties = this.properties;
 var dataRows = updatePropertyInfo.ActualDataRows;
 var nRows = dataRows.length;
 var rowData = new Array();
 for (var i = 0; i < nRows; i++) {
 rowData.push(dataRows[i]);
 }
}
console.log(Object.keys(rowData[0]).length); //returns 4