cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. X

Getting the number of field definitions from an infotable

kahmeng96
12-Amethyst

Getting the number of field definitions from an infotable

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!

1 ACCEPTED SOLUTION

Accepted Solutions

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

 

View solution in original post

2 REPLIES 2

Hello,

 

There you are:

myProperty.dataShape.fields.size()

 

/ Constantine

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

 

Top Tags