I am trying to set up a component to display a selected item from a SharePoint list so I thought setting a custom input property of data type "record" would be correct. However I cannot seem to tell the component or the app with the component what the source looks for the record. I keep getting errors because it seems to setup a "helper" record and won't let me change it. The error message is:
The record [table] passed in has none of the expected fields [columns]: SampleBooleanField, SampleNumberField, SampleStringField
This question had the same error but for an existing component plus the solution to remove and add the property didn't work for me.
So if I'm creating a new component and want to have a custom input property of data type "record", how do I let the component and the app know the scheme of the record so I can access the fields?
Solved! Go to Solution.
My solution was to select the first record from the data source during the start of the app and load that into a global variable.
Set(glb_FirstRec, First([@TM_Testing]));
Set(glb_SelectedRec, glb_FirstRec)
Then I created a custom property on my component and assigned the global variable to that. Now I can reference that property and using intellisense I can access the columns of the underlying data set.
From the component main node choose the property and put in a fake record object that has the fields with the type you desire.
In the screenshot below, my EditNote property is given the following type. I want to add a Note record to this component from the app.
However, I don't know if this answers your question and maybe you have the same question I do. I wanted to put Defaults(Notes) here but I get an error that Notes isn't recognized.
My solution was to select the first record from the data source during the start of the app and load that into a global variable.
Set(glb_FirstRec, First([@TM_Testing]));
Set(glb_SelectedRec, glb_FirstRec)
Then I created a custom property on my component and assigned the global variable to that. Now I can reference that property and using intellisense I can access the columns of the underlying data set.
User | Count |
---|---|
258 | |
108 | |
93 | |
57 | |
40 |