cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
jharville1
Helper IV
Helper IV

Combo-box (one pulled from LookUp Column) will not patch to SharePoint List

 

Hello! I have two combo-boxes ('Country' & 'Review Material') that will not patch to my SharePoint list, but all other fields in my form successfully do... Here is a screenshot of the form (there are a few other fields that aren't shown but these aren't important to the underlying issue):

 

jharville1_0-1610689915971.png

 

*The 'Country' combo-box only allows for a single selection, and the items are pulled from a "Choice" column in my SharePoint List

     -The name of the 'Country' field's combo-box is called "nationBox"

*The 'Review Material' combo-box allows for multiple selections, and the items within that combo-box are pulled from a Lookup Column

     -The name of the 'Review Material" field's combo-box is called "reviewComboBox"

 

This is the Patch() Statement that I currently have:

 

jharville1_2-1610690478317.png

 

***(side note: the 'Item' property of my EditForm is set to varRecord)

 

It is supposed to patch all of the fields into a list called 'cfa test list' (and also mark the FormStatus as "Submitted"), but it didn't patch any of the items selected from the "Country" and "Review Material" combo-boxes in my form to its perspective columns in my SharePoint List ...

 

I added Country: nationBox.Selected to the Patch() statement hoping it would add the item selected from my form's "Country" combo-box to the Country column in my SharePoint list, and even though it didn't throw any errors ... it didn't patch any info to the column and it still shows up blank.

 

Capture.PNG

 

(I've also tried Review Material: reviewComboBox.SelectedItems.Result to patch info to 'Review Material' but that didn't work either)

---------------------------------------------------------------------------------------------------------------------------

Capture.PNG

 

Does anybody know what lines of code will be able to patch the *one* item selected in my "Country" field (combo-box) of my form AND the *multiple* items selected in my "Review Material" field (combo-box) of my form to my 'cfa test list' (SharePoint List)?

45 REPLIES 45

@jharville1 ,

We are now 40 posts into this (on that subject can you please mark your original question as solved) - again my code works perfectly here. You are simply clearing a collection then putting new content into it.

Put a label on the screen with CountRows(colDD), Navigate to the screen in Play mode and see how many items are counted.

@WarrenBelz 

 

I completely understand, I appreciate your help along the way and I'll do some troubleshooting to see where the issue is (since you said it works on your side). Just to confirm, you said that once you implemented the Clear() function at the top of the code in the OnVisible property of the EditScreen, it showed distinct values for the combo-box choices?

 

I'll go ahead and mark this post as solved with your response. Thanks again Warren!

 

Best,

 

Justin

Thanks @jharville1 ,

When you think about it, this has to happen - you are clearing the collection and then adding only the new items. The only variable now is what your Distinct function on the choices produces - did you try to count the collection after running it?

@WarrenBelz 


After troubleshooting and experimenting with different approaches, I discovered removing the ForAll() statement was the solution. Once I did that, everything worked as desired. Thank you so much for your help throughout the process. I used the CountRows(colDD) for troubleshooting and it helped speed things up.

 

Best,

 

Justin

Thanks @jharville1 ,

You are actually correct here and is an interesting affect when you collect from a Lookup Choices - when I tested, I thought the values were unique, but should have scrolled further down, although this point only came up at the very end of our discussion and I assumed it was running the collection multiple times. The principle of what you need to do however is the same and just another (generally unneeded) burden of this column type.

I am glad you got it sorted.

Thanks @jharville1 

You are actually correct here and is an interesting effect when you collect from a Lookup Choices - when I tested, I thought the values were unique, but should have scrolled further down, although this point only came up at the very end of our discussion and I assumed it was running the collection multiple times. The principle of what you need to do however is the same and just another (generally unneeded) burden of this column type.

Now the real bonus (which I would have offered earlier if I knew this was the required structure - you do not need the collection - The Items of your Combo Box can simply be

With(
  {
    wDD: 
    Distinct(
      Choices('cfa test list'.reviewItem),
      Value
    )
  },
  AddColumns(
    wDD,
    "IdRef",
    LookUp(
      'cfa review materials',
      Title = Result
    ).ID
  )
)

 

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Top Kudoed Authors
Users online (1,070)