cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
TheJM15
New Member

SharePoint list - issue with saving edited field value to SharePoint

Hi All,

I am currently working on a kind of a tracker, which asks user for an input by selecting from available options. Please see the sample below which portrays what I am trying to achieve and my current stage.

 

The data source for the user form looks as follows:

 

TheJM15_0-1658399773686.png

 

The user form SharePoint list has the following structure:

TheJM15_1-1658399818053.png

Key columns in this exercise are:

  • Visited Continent (single line of text) – in the input form it should be a simple dropdown
  • Visited Country (multiple lines of text, can be changed to single line of text) – in the input form it should be a combo box (I want user to be able to select multiple items)

Data types should remain as provided.

 

I have already built the user form in PowerApps, which looks as follows:

TheJM15_2-1658399880988.png

Everything works well when I am creating a new item – data is saved properly in the SharePoint list, for example:

TheJM15_3-1658399908045.png

A problem occurs when I am trying to edit the already existing item. It looks like the record values are loaded properly once I click on “Edit” (just like on the snip above). However, when I am trying to edit the “Visited Country” field, the result is not saved properly. For example, when I remove “Sweden” and “Netherlands” from the list, the field turns blank:

TheJM15_4-1658399978545.png

When I am adding a new entry, I get the following outcome:

TheJM15_5-1658400015059.png

Interestingly, if I remove all items in the edit mode and choose again, the result is saved properly:

TheJM15_6-1658400048566.png

 

It looks like the items that are already in the field are not treated as “selected” ones, despite being visible in the form upon clicking on the Edit button (the example, where “, , , Poland” saved back to SharePoint makes me think that these are loaded as blanks or nulls).

 

The form elements are configured in PowerApps as follows:

  • Visited Continent dropdown name: ddSelectedContinent
  • Visited Continent card name: Visited Continent_DataCard2
  • Visited Country combo box name: cbSelectedCountry
  • Visited Country card name: Visited Country_DataCard1

 

Properties of the “Visited Country” field (I am not showing how “Visited Continent” is configured as it works well)

 

Items property:

 

Filter(ContinentAndCountry, Continent = ddSelectedContinent.Selected.Result)

 

TheJM15_7-1658400200321.png

 

Update property:

 

If(
    SharePointForm1.Mode = 1, // 0 - Edit, 1 - New, 2 - Display
    Concat(cbSelectedCountry.SelectedItems, ThisRecord.Country, ", "),
    If(
        SharePointForm1.Mode = 0,
        Concat(cbSelectedCountry.SelectedItems, ThisRecord.Country, ", ")
    )
)

 

TheJM15_8-1658400273968.png

(The highlighted part serves as a placeholder here – my guess is that the solution can be placed here)

 

DefaultSelectedItems property:

 

RenameColumns(Split(Parent.Default, ", "), "Result", "Value")

 

TheJM15_9-1658400406781.png

 

TheJM15_10-1658400464707.png

 

Has anyone worked on a similar problem with Edit mode or knows what I am missing in the presented solution? I would appreciate any feedback - tips, suggestions are more than welcome. 

 

Thanks,

Pawel

1 ACCEPTED SOLUTION

Accepted Solutions
v-xiaochen-msft
Community Support
Community Support

Hi @TheJM15 ,

 

This is due to the format of items and defaultselectedItems are different.

Please try this on defaultselectedItems attribute:

ForAll(Split(Parent.Default, ", ") As A,LookUp(ContinentAndCountry,Country=A.Result) )

 

Best Regards,

Wearsky

View solution in original post

1 REPLY 1
v-xiaochen-msft
Community Support
Community Support

Hi @TheJM15 ,

 

This is due to the format of items and defaultselectedItems are different.

Please try this on defaultselectedItems attribute:

ForAll(Split(Parent.Default, ", ") As A,LookUp(ContinentAndCountry,Country=A.Result) )

 

Best Regards,

Wearsky

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 (2,878)