Search code examples
powerappspowerapps-formulapowerapps-canvaspowerapps-selected-items

Autopopulate 2 Combo box value from Selected Combo Box


enter image description hereWhat is the best approach to update 2 combo box from a selected Combo box

SharePoint list Issue Tracker
Home Center - Lookup
Supervisor - Person or Group
Regional Manager - Person or Group

enter image description here

Let me know if i explain it clearly. I attach some screen shot When they select from Home Center. Supervisor and Regional Manager gets auto populated


Solution

  • In the Onchange property of HomeCenter combobox ,you can set a context variable like

        UpdateContext({homecenter_changed:true});
    

    and set the value of the same variable as false in the page OnVisible property as

        UpdateContext({homecenter_changed:false});
    

    Set the Items property of Supervisor ComboBox as

        If(homecenter_changed = true,Filter(Issue Tracker,Home Center =HomeCenter_combobox.Selected.Home Center).Supervisor)
    

    Similarly,the Items property of Regional Manager can be set as

        If(homecenter_changed = true,Filter(Issue Tracker,Home Center =HomeCenter_combobox.Selected.Home Center).Regional Manager)
    

    And in the OnChange property of both Supervisor and Regional Manager,update the context varaible back to false,then only the next time you change the value for Home Center,the other two values gets autopopulated properly,like

        UpdateContext({homecenter_changed:false});