cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Medoomi
Helper V
Helper V

ClearCollect a single record & retrieve a single field

I have a table in Dataverse called Projects. This gets loaded into a gallery called galProjects.

I would like to load the selected record into a collection colSelectedProject, so I am using this code:

ClearCollect(colSelectedProject,galProjects.Selected)

I would then like to use particular fields from this selected record, but I don't know how to reference those fields.

For example, I would like to load one field 'Project Calendar Event Id' into a contextual variable varAuditGUID, so I am attempting to use this formula:

UpdateContext({varAuditGUID:colSelectedProject.'Project Calendar Event Id'})

But Powerapps is complaining that I have an incompatible type.

How can I correctly retrieve the single text field 'Project Calendar Event Id'?

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions

@Medoomi 

You could try using the intellisense to guide you with that last bit of code above. Try adding a dot( . ) at the end to see what is offered, it maybe 'Value' and this may work for you.

 

You could also try creating a variable instead of a collection as your reference, if there is only one record?, ie

 

Set( vSelectedProject,galProjects.Selected)

// then use vSelectedProject instead of colSelectedProject

 

 

View solution in original post

3 REPLIES 3
EddieE
Super User
Super User

@Medoomi 

Sometimes ... PowerApps treats GUIDs as special data types, just to make things interesting. Try wrapping your variable code in the Text function, ie

 

UpdateContext({varAuditGUID: Text(colSelectedProject.'Project Calendar Event Id') })
Medoomi
Helper V
Helper V

Thanks so much @EddieE 

Wrapping it in a Text() function sadly doesn't help.

The data type for varAuditGUID ends up being a "Table" so I'm imagining that 

colSelectedProject.'Project Calendar Event Id'

doesn't isolate the field & I need different code to reference the field.

@Medoomi 

You could try using the intellisense to guide you with that last bit of code above. Try adding a dot( . ) at the end to see what is offered, it maybe 'Value' and this may work for you.

 

You could also try creating a variable instead of a collection as your reference, if there is only one record?, ie

 

Set( vSelectedProject,galProjects.Selected)

// then use vSelectedProject instead of colSelectedProject

 

 

Helpful resources

Announcements
Super User 2 - 2022 Congratulations 768x460.png

Welcome Super Users

The Super User program for 2022 - Season 2 has kicked off!

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

<
Users online (4,109)