Skip to main content

Notifications

Power Apps - Power Apps Pro Dev & ISV
Answered

Empty people picker fields (not reset!)

Posted on by 21
Good morning everyone.
I am having this problem in this app where a user can choose a number of DEC needed. DECs are people, tied to single-choice People picker fields (comboboxes) .
Basically I would like that, once I have chosen the number of DEC needed (via the How Many field), the program automatically EMPTIES the unnecessary fields.
So if I select 4 dec, but then decide that I only need 2, the program should empty the fields related to dec3 and dec4.

I used the reset formulas in the OnChange event of the How Many field and the Default and DefaultSelectedItems formulas in the various fields related to DEC (percentage is a  simple text field).
Everything seems to work: when I change the number of dec needed, the fields are emptied and when I save everything is ok in field's values.

The problem arises when I then reopen a saved record: the fields are ALWAYS empty!
 
I guess it's due to the DefaultSelectedItems and Default formulas: how should I set them?

Thank you
 
 
 
 
  • Verified answer
    AndreaPRJ Profile Picture
    AndreaPRJ 21 on at
    Empty people picker fields (not reset!)
    Hi Nandit
    I probably hadn't explained myself well
     
    I needed the fields to always be emptied in case either the DECs were not needed at all, or in case I had chosen a particular number of decs (2 decs necessary? then will you empty the third one, 1 dec only? then you empty me both dec 2 and dec 3)
     
     
    in the end I did it like this and I solved : I removed HowMany DECs field, I left only the 4 thrash icons visible next to the 4 fields (always visibles) and in the onSelect of the icons I put:
     
    for example for thrash icon for DEC1 fields:
      UpdateContext({locResetControlsDEC1:true});Reset(DataCardValue_DEC1);Reset(DataCardValue_DEC1%)
     
    and then in the DefaultSelectedItems of DEC1 People Picker field I put:
     
     If(locResetControlsDEC1, Blank() ,Parent.Default)
     
    I also added this in OnVisible property of my SharepointForm
     
     UpdateContext({locResetControlsDEC1:false})
     
    Start situation
     
    End situation when I press thrash icon(s)
     
     
    regards
  • Nandit Profile Picture
    Nandit 1,530 on at
    Empty people picker fields (not reset!)
    Hi,

    Following up to check if you were able to solve this issue using my suggestion?

    Kind regards,
    Nandit
  • Suggested answer
    Nandit Profile Picture
    Nandit 1,530 on at
    Empty people picker fields (not reset!)
     
    I think what you mean is this (correct me if I am wrong)
    1. When user will change the How Many from 4 to 3: Empty DEC4
    2. But if they again select 4 in How Many (without saving): It should display the existing values?
     
    Also, because you have emptied it once, when you select any other item, DEC4 doesn't display anything. Is my understanding of your issue correct?
     
    I think in the DefaultSelectedItems property of DEC4, you need something like:
    If(Value(HowMany.Selected.Value) = 4, [], ThisItem.DEC4Column)
    
    Hope this helps. Let me know how it goes. 
     
    Kind regards,
    Nandit
     
    If this answers your query, please mark this response as the answer.
    If its helpful, please leave a like. Thanks!
     

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

October 2024 Newsletter…

October 2024 Community Newsletter…

Community Update Oct 28…

Power Platform Community Update…

Tuesday Tip #4 How to Conntact Support…

Welcome to a brand new series, Tuesday Tips…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 142,685

#2
RandyHayes Profile Picture

RandyHayes 76,308

#3
Pstork1 Profile Picture

Pstork1 63,750

Leaderboard