Model.ModelName.data.0.FieldName not being resolved in SKUID V2

I am trying to get a field value using javascript but data.0 is giving error.

Please suggest if the 0 is causing Uncaught SyntaxError: Unexpected number.

cmodel = skuid.runtime.getPage('RSS_Support_Mainpage__v2').model.getModel('DialPad')
//Ye {_parentPageId: 'sk-2n8w-14', dataSourceName: 'salesforce', dataSource: E, processOnClient: true, id: 'DialPad', …}
cmodel.data.length
//1
cmodel.data.0.Description
//VM6472:1 Uncaught SyntaxError: Unexpected number

Hello Dinesh,

Since this is in Javascript you need to do cmodel.data[0].Description.

Or another approach:

let firstRow = cmodel.getFirstRow();
firstRow.Description;
1 Like

Thanks lukaspovilonis.

The first approach to get the row context in array using isn’t working.
image

However, the second approach worked to get the first row and fetch value.

Thanks again for your time and help.

I’m glad the 2nd way worked. Regarding the 1st way, try removing . before [0].

Instead of cmodel.data.[0], do the following, cmodel.data[0]

All good.

1 Like

It worked, thanks for your time and help!