cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
MattMcQ
Helper I
Helper I

Component with custom input property of data type record - how to define fields?

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?

1 ACCEPTED SOLUTION

Accepted Solutions
MattMcQ
Helper I
Helper I

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.

View solution in original post

2 REPLIES 2
KASCHN
Resolver II
Resolver II

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.

KASCHN_0-1670249061332.png

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.

KASCHN_1-1670249214453.png

 

MattMcQ
Helper I
Helper I

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.

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (5,583)