Skip to main content

Notifications

Power Apps - Building Power Apps
Suggested answer

Using a Form Connected to SP List #1 While Using a Combo Box with the Choices From SP List #2

Posted on by 125
I am trying to use a combo box in a form that uses a different SP list than the form. The image below describes what I'm trying to do.  What is the best method to achieve this?

Categories:
  • zoso2112 Profile Picture
    zoso2112 125 on at
    Using a Form Connected to SP List #1 While Using a Combo Box with the Choices From SP List #2
    WarrenBelz - Yes, creating a new SP list solved the issue. 
  • WarrenBelz Profile Picture
    WarrenBelz 143,487 on at
    Using a Form Connected to SP List #1 While Using a Combo Box with the Choices From SP List #2
    So this is now solved ?
  • Suggested answer
    zoso2112 Profile Picture
    zoso2112 125 on at
    Using a Form Connected to SP List #1 While Using a Combo Box with the Choices From SP List #2
    WarrenBelz - Thank you for all your help. I created a new SP list to save my data and now the 'Work Center' choice column is now being saved.  I used the same code as before but this time I used comboBox.SelectedItems for Work Center data card Update property, and it did not throw the "Expected Record value" error. I had previously tried a new screen and a new form so the root cause was the SP list. Go figure. Thanks again!
  • zoso2112 Profile Picture
    zoso2112 125 on at
    Using a Form Connected to SP List #1 While Using a Combo Box with the Choices From SP List #2
    WarrenBelz - Thank you for following up on this. I made a mistake in describing the issue. I am NOT using the 'Work Centers' text type column to populate the combo box choices, but instead I am using the 'Prod Line Choices' choice multi-item select column (see image below).  Can you make any recommendations based on the new information?


     
  • WarrenBelz Profile Picture
    WarrenBelz 143,487 on at
    Using a Form Connected to SP List #1 While Using a Combo Box with the Choices From SP List #2
    That suggests you are writing back to a single value choice column (it expects a Record, not a Table). I just tested the code on a multi-value Combo Box writing back to another (the choices came from another list as per yours) multi value choice column and it worked as expected. It also explains why comboBox_WkCenter.Selected does not work.
  • zoso2112 Profile Picture
    zoso2112 125 on at
    Using a Form Connected to SP List #1 While Using a Combo Box with the Choices From SP List #2
    WarrenBelz - I tried your suggestion and I got the familiar syntax error,  "Expected Record value". 
    ForAll(
       comboBox_WkCenter.SelectedItems As _Items, 
       {Value: _Items.Value}
    )
     
  • WarrenBelz Profile Picture
    WarrenBelz 143,487 on at
    Using a Form Connected to SP List #1 While Using a Combo Box with the Choices From SP List #2
    Try in the Update
    ForAll(
       comboBox_WkCenter.SelectedItems As _Items, 
       {Value: _Items.Value}
    ) 
     
  • zoso2112 Profile Picture
    zoso2112 125 on at
    Using a Form Connected to SP List #1 While Using a Combo Box with the Choices From SP List #2
    WarrenBelz - Thank you for your response. 

    The SharePoint list populating the combo box is referencing a SP choice multi-item select column as is the form's SharePoint list column for 'Work Center'.

    For the combo box I have:
    Items: Choices('Prod Lines Choice Options'.'Prod Line Choices')
    DisplayFields: ["Value"]


    I can't seem to get the correct code for the form's Work Center's data card's UPDATE property. I used comboBox_WkCenter.Selected and there are no syntax errors, but it doesn't write any data to the SP list Work Center's column. Since it is a multi-item select choice column, the UPDATE really should be comboBox_WkCenter.SelectedItems but there is a syntax error "Expected Record value".

    The crazy thing is I have tried all the code below trying to find the correct code for UPDATE but all have the same syntax error "Expected Record value":

    // "Expected Record value"
    ForAll(comboBox_WkCenter.SelectedItems, {Value: ThisRecord.Value })
    comboBoxChoices.SelectedItems
    comboBox_WkCenter.Selected.'Work Center'
    Split(Concat(comboBox_WkCenter.SelectedItems, 'Prod Line Choices' & ";"), ";")
    Table(ForAll(comboBox_WkCenter.SelectedItems, {Value: ThisRecord.'Prod Line Choices'}))
    ForAll(comboBox_WkCenter.SelectedItems, {Value: ThisRecord.'Prod Line Choices' }) 
    ForAll(comboBox_WkCenter.SelectedItems, {Value: 'Prod Line Choices'})


    // No syntax error but throws generic error when form submitted (all required fields are satisfied)
    {Value: Concat(comboBox_WkCenter.SelectedItems, Value, ";")}
    {Value: ThisItem.'Work Center'} â€‹â€‹â€‹â€‹â€‹â€‹â€‹

    This one seems close but it has a nested table that I can't figure out how to extract:
    {Value: comboBox_WkCenter.SelectedItems} // has nested Table; no errors expect when form submitted but failed to write combo box data
     
    Record Data Type (Value has nested Table) Table Data Type

     
  • zoso2112 Profile Picture
    zoso2112 125 on at
    Using a Form Connected to SP List #1 While Using a Combo Box with the Choices From SP List #2
    Is it even possible to have a form connected to one SP list and have a combo box connected to a different SP list? 
  • WarrenBelz Profile Picture
    WarrenBelz 143,487 on at
    Using a Form Connected to SP List #1 While Using a Combo Box with the Choices From SP List #2
    Hi zoso2112 
    It seems you have already done this - the Items of the Combo Box would be
    Choices('Choice Options'.'Work Centers')
    What is not working and also what type of field is 'Work Center' in 'Line Inspection Min Max Weights' ?
    If is is a Multi-Value Choice column (please do not tell me it is a Lookup column) and your Combo Box (as it appears) is multi-select, then the Update of your Data Card should be
    YourComboBoxName.Selected

    Please click Does this answer your question if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it a Like.
    MVP (Business Applications)     Visit my blog Practical Power Apps    Buy me a coffee


Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

November 2024 Newsletter…

November 2024 Community Newsletter…

Community Update Oct 28…

Power Platform Community Update…

Tuesday Tip #7 Community Profile Tips…

Welcome to a brand new series, Tuesday Tips…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 143,487

#2
RandyHayes Profile Picture

RandyHayes 76,308

#3
Pstork1 Profile Picture

Pstork1 64,014

Leaderboard