cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Updating a child record using a parent gallery selection

Hi All,

 

I'm attempting to update a record in a table that relies on a parent/child relationship by selecting the parent record through a gallery.

 

In my screen, I have my 'EngagementsGallery' that presents the data in the parent table (Engagements Table) about an engagement, including the engagement name. I then have another table that returns other data about the engagement (The Scoping Table), and therefore have a relationship from the Scoping Table to the Engagemen Table using the Engagement Name. 

 

I want to be able to click on a record in the EngagementsGallery using EngagementsGallery.Selected.Name which selects the engagement name, then update the data in the Scoping Table using some kind of patch formula. At the moment I'm using the 'OnVisible' Property of the new screen to set variables, but I get an 'Invalid Argument Type' error because it identifies the SelectedEngagement Variable as text, but the Name in the scoping table is a lookup data type as it is the column I have used to setup the relationship between the two tables, which is causing the invalid argument type. I've included the code excerpt below. 

 

Set(SelectedEngagement, EngagementsGallery.Selected.Name);

Set(VariableTest, First(Filter('Risk & Scoping Informations', 'Risk & Scoping Informations'.'Engagement Team' = SelectedEngagement)))

 

Any help would be greatly appreciated!

 

Many thanks

1 ACCEPTED SOLUTION

Accepted Solutions
Anonymous
Not applicable

Hi again,

 

I've managed to resolve this issue. The problem I was having is that PowerApps appears to treat a lookup column as containing a table. As a result, I had to select the 'Risk & Scoping Informations' table, then selected the 'Engagement Team' column which was setup as a lookup column and therefore each record within this column is treated as a table value, so I then needed to select 'Engagement Team' again. Apologies if I've used any incorrect terminology there as I'm a PowerApps Novice, but I've included the amended code below to help anyone looking for a similar solution in future.

 

Set(VariableTest,First(Filter('Risk & Scoping Informations, 'Engagement Team'.'Engagement Team' = EngagementsGallery.Selected.'Engagement Team')))

View solution in original post

3 REPLIES 3
Bilakanti
Responsive Resident
Responsive Resident

 

Hi @Anonymous ,

 

As the child table is having lookup column it expects record, but the value you are storing in set function is text, thats why it shows error. Can you try the below code.

 

Set(SelectedEngagement, EngagementsGallery.Selected);

Set(VariableTest, First(Filter('Risk & Scoping Informations', 'Risk & Scoping Informations'.'Engagement Team' = SelectedEngagement)))

Anonymous
Not applicable

Hi @Bilakanti, thank you for the input. I've tried removing the '.name' when setting the SelectedEngagement variable but I still get an invalid argument type error on the equals sign. This time it doesn't give me any more information than that though (rather than saying expected text which was the case previously). 

Anonymous
Not applicable

Hi again,

 

I've managed to resolve this issue. The problem I was having is that PowerApps appears to treat a lookup column as containing a table. As a result, I had to select the 'Risk & Scoping Informations' table, then selected the 'Engagement Team' column which was setup as a lookup column and therefore each record within this column is treated as a table value, so I then needed to select 'Engagement Team' again. Apologies if I've used any incorrect terminology there as I'm a PowerApps Novice, but I've included the amended code below to help anyone looking for a similar solution in future.

 

Set(VariableTest,First(Filter('Risk & Scoping Informations, 'Engagement Team'.'Engagement Team' = EngagementsGallery.Selected.'Engagement Team')))

View solution in original post

Helpful resources

Announcements
User Group Leader Meeting January 768x460.png

Calling all User Group Leaders!

Don't miss the User Group Leader meetings on January, 24th & 25th, 2022.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Top Solution Authors
Top Kudoed Authors
Users online (3,203)