Skip to main content

Notifications

Power Apps - Building Power Apps
Unanswered

Unexpected behaviour for Select() method, is it async?

Posted on 29 Oct 2024 10:32:04 by 82
​Hi all,
 
I have two buttons, the first one named btnChassisRow with the following OnSelect:
 
If(
    rightClickListener1.isPressed;
    UpdateContext({ctxDoubleClicked: true});
    If(
        "Control" in Split(
            pressedKeys1.pressedKeys;
            ", "
        );
        Select(cbSelectedRow);;
        UpdateContext({ctxSelectedVehicle: ThisItem});;
        ;
        UpdateContext({ctxClicked: !ctxClicked});;
        If(
            !ctxClicked And ctxStarted And ctxSelectedVehicle.Chassis = ThisItem.Chassis;
            UpdateContext({ctxDoubleClicked: true});;
            ;
            UpdateContext(
                {
                    ctxDoubleClicked: false;
                    ctxSelectedLocation: Blank()
                }
            );;
        );;
        UpdateContext({ctxSelectedVehicle: ThisItem});;
        Reset(timerHoldForDetails);;
        UpdateContext(
            {
                ctxDisplayVehicleMoves: false;
                ctxDisplayEditVehicle: false
            }
        );;
        Copy(Self.Text);;
    );;
    
);;
 
The second one has the following OnSelect:
 
Select(btnChassisRow);;
Copy(Self.Text);;
 
The expected behaviour would be to first Copy() the Text property of btnChassisRow, then replace the copied content with the Copy() from the second button.
However, I end up having the btnChassisRow's Text in my clipboard after selecting the second button
 
  • BaptisteW Profile Picture
    BaptisteW 82 on 30 Oct 2024 at 07:11:14
    Unexpected behavior for Select() method, is it async?
    Sadly no.

    I fixed it in my app by introducing a new variable

    1st button
    If(
        !ctxPreventCopyChassis;
        Copy(Self.Text)
    );;


    2nd button
    UpdateContext({ctxPreventCopyChassis: true});;
    Select(btnChassisRow);;
    Copy(Self.Text);;
    UpdateContext({ctxPreventCopyChassis: false});;

  • KeithAtherton Profile Picture
    KeithAtherton 3,610 on 29 Oct 2024 at 17:14:46
    Unexpected behavior for Select() method, is it async?
    Hey. I would also expect the behaviour that you mention.
     
    If you change the second button code rom this:
    Copy(Self.Text);;
    To this:
    Copy(btnSecondButton.Text);;
     
    Does it behave any differently?

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,151

#2
RandyHayes Profile Picture

RandyHayes 76,308

#3
Pstork1 Profile Picture

Pstork1 63,845

Leaderboard