cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Responsive Resident
Responsive Resident

how to save a selected value from the Canvas app to the look up field in the SharePoint list?

Dear all, 

 

I have created a lookup column (name: Testing2) in the SharePoint list that looks for values in the other SharePoint list. This lookup column field was added to the Canvas app, and I modified its Items function to depend on another field's value:

 

 

 

(Items = 
Sort(
Filter(
AdditionalSPList,
Factory = cmb_Name.Selected.Result
).Material,
Ascending
)

 

 

 

The update function was unchanged: DataCardValue14.Selected


With this configuration, the selected item in the Canvas app field is not saved to the SharePoint. If leave Items function unmodified (original Items function is = Choices([@'MT'].Testing2), then the selected item is uploaded correctly.


Could someone please if it is possible to filter Items in the canvas app field and save the selected item to the SharePoint lookup column and how?

1 ACCEPTED SOLUTION

Accepted Solutions
Super User III
Super User III

@mantastg08876 
If testing2 is a lookup column, then when you use Choices on that column for your items, you are really getting a table returned from that which has records with two columns - the Id of the record in the lookup list and the value of the record column from the lookup list.

When you give the formula you show to the Item, it will return a table with a single column called Material.  When you go to update, then record schemas will not match and you will not get anything saved.

 

So, your formula also will not include the Id of the record...which is needed, so changing the Update of the datacard alone will not be helpful.

 

You can either change your Items formula to the following:

ForAll(
    Sort(
        Filter(AdditionalSPList,
            Factory = cmb_Name.Selected.Result
        ),
        Material
     ),
     {Value: Material,
      Id : ID
     }
)

Note: this will return a table of records with a Value and Id (what is needed for a lookup column)

No other changes are needed.

 

OR, you can change the Items property to:

Sort(
     Filter(AdditionalSPList,
         Factory = cmb_Name.Selected.Result
     ),
     Material
)

and then change your Update formula on the datacard to:

{
    Value: DataCardValue14.Selected.Material,
    Id : DataCardValue14.Selected.ID
}

This will provide a record with the correct schema for the lookup column.

 

I hope this is helpful for you.

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!

View solution in original post

1 REPLY 1
Super User III
Super User III

@mantastg08876 
If testing2 is a lookup column, then when you use Choices on that column for your items, you are really getting a table returned from that which has records with two columns - the Id of the record in the lookup list and the value of the record column from the lookup list.

When you give the formula you show to the Item, it will return a table with a single column called Material.  When you go to update, then record schemas will not match and you will not get anything saved.

 

So, your formula also will not include the Id of the record...which is needed, so changing the Update of the datacard alone will not be helpful.

 

You can either change your Items formula to the following:

ForAll(
    Sort(
        Filter(AdditionalSPList,
            Factory = cmb_Name.Selected.Result
        ),
        Material
     ),
     {Value: Material,
      Id : ID
     }
)

Note: this will return a table of records with a Value and Id (what is needed for a lookup column)

No other changes are needed.

 

OR, you can change the Items property to:

Sort(
     Filter(AdditionalSPList,
         Factory = cmb_Name.Selected.Result
     ),
     Material
)

and then change your Update formula on the datacard to:

{
    Value: DataCardValue14.Selected.Material,
    Id : DataCardValue14.Selected.ID
}

This will provide a record with the correct schema for the lookup column.

 

I hope this is helpful for you.

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!

View solution in original post

Helpful resources

Announcements
New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

New Power Super Users

Congratulations!

We are excited to announce the Power Apps Super Users!

Power Apps Community Call

Power Apps Community Call: February

Did you miss the call? Check out the Power Apps Community Call here.

Top Solution Authors
Top Kudoed Authors
Users online (35,252)