web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / OnSelect of button = w...
Power Apps
Answered

OnSelect of button = write to Dataverse table

(0) ShareShare
ReportReport
Posted on by 802

Hi there,

 

I think this is pretty simple, but it's my first time patching to Dataverse.

 

I have a dataverse table which is called DeskReservations. 

 

A column in here is 'Desk'. 

 

When the user clicks a button in my app, I want to update the Dataverse column in this table with the desk number (which is the text value of the button). So, for example, "C5"

 

What formula do I put in my button to enable this?   

 

I am thinking of adding more columns later to also write back other values to other dataverse columns, so if I know the syntax and process I can replicate later.

 

Thanks,

K.

I have the same question (0)
  • v-qiaqi@microsoft.com Profile Picture
    on at

    Hi @Kosenurm,

    Do you want to patch a Number column in your Dataverse table?

    Could you please tell me more about your scenario?

    If you want to save the button text to the Desk column, please set the OnSelect of the button as below:

    Patch(DeskReservations,Defaults(DeskReservations),{Desk:Self.Text})

    Note that the Self represents the button itself. Access to properties of the current control.

    Hope it could help.

  • Kosenurm Profile Picture
    802 on at

    Thank you for the help.

     

    Basically, I have a custom deskbooking app in creation. Overlaid to the floor plan are lots of buttons which, when the user taps the desk they want to book, I want it to display a pop-up message (well, just make visible a rectangle icon with some text, if that's the best way?) to say "Are you sure you wish to book (desk number)?"

     

    How can I write a formula to include the desk number which the user has selected in the map view... something like "Are you sure you wish to book   " &  'desk number which they have selected'?

     

    Then, when they select the Yes button in this pop up, it writes all the necessary information about the booking (so the user's name, date, time, desk number, floor, office name) back to the dataverse table?

     

    All desk buttons are labelled and named according to their reference, so like "A1", "B3" etc.

     

    Thanks,

    K

  • Verified answer
    v-qiaqi@microsoft.com Profile Picture
    on at

    Hi @Kosenurm,

    If you want to make a popup window, and display the reminder, please try as below.

    1). Set OnVisible property of your current  screen to

    Set(_popup,false)

    2). Insert buttons as many as you expect to on click of which you want a pop up to appear and set its OnSelect property to:

    Set(_popup,true);Set(Buttontext,Self.Text)

    3).Add a Label within the popup window and set the Text as below:

     

    "Do you want to book this desk "& Buttontext&"?"

    4). Add a save button within the popup window and set the OnSelect as below:

    Patch(DeskReservations,Defaults(DeskReservations),{Desk:Self.Text,...}) // Add other fields in your dataverse table

     

    5). Set the Visible property of all the elements within your popup window as follows:

    _popup

    6). Set the OnSelect property of the close button within the popup as below:

    Set(_popup,false)
  • Kosenurm Profile Picture
    802 on at

    @v-qiaqi-msft  - Quite possible the best help I have ever received. Thank you so much, this is PERFECT.

  • Kosenurm Profile Picture
    802 on at

    Hi, sorry just one more thing.

     

    When I patch the record to the Dataverse table, it goes in as a new entry which is what I want. However, I then want to show the desk's button as greyed out for that specific day and make it's OnSelect value to false; depending on if it's Dataverse column record of LDN Desk Availability Status within the LDN_Desk_Reservations table = "Reserved". If "Available", I want it to be white, and if "Unavailable" I want it to be "Red".

     

    Any ideas on this final piece for me?  I think it's something like If(LookUp... but then nothing I try works. Basically when someone selects on the Date Picker for a day they want to book, it then does a look up on Dataverse to see availability and change the colour of the button's accordingly as above. 


    Thanks, 

    K

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 739 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard