cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
alexlrca
Level: Powered On

[Edit forms] Button to automatically select dropdown value

[CONTEXT]

I have created an Edit-form for an airline company to report flight delays. It contains several data-cards (more than 40), each containing two drop-down fields - one for the hours, the other one for the minutes, that users must complete to create a report about flight delays.

 

[OBJECTIVE]

I would like to add a button in each data-card that, when clicked, would automatically select the actual time in the drop-down fields, so that my users don't have to do it by themselves. Still, they'd have the opportunity to modify it if they made a mistake.

 

[ISSUE]

All methods to achieve my objective require to:

- Create two variables (one for hours, one for minutes) on the OnSelect property of the button,

- Set their values to Hours(Now()) and Minutes(Now()),

- Set the Defaults properties of the drop-down fields to the variables

 

However, since my drop-down fields are part of an Edit Form, their Defaults properties are already filled-in with the data from my database that the user can modify.

 

Is there an "easy" way (that would not increase the loading time of my app) to achieve my objective?

2 ACCEPTED SOLUTIONS

Accepted Solutions
Super User
Super User

Re: [Edit forms] Button to automatically select dropdown value

Let's say you have a button, btn_TimeOverride,

..and it's onSelect Sets a variable ManualTimes to true/false,

..then your Default for those dropdowns would be:

 

HoursDropdown Default:

If(
   ManualTimes,

   Hours(Now),

   // Else value so that it still uses existing times when not set to manual
   Parent.Default
)

 

MinutesDropdown Default:

If(
   ManualTimes,

   Minutes(Now),

   // Else value so that it still uses existing times when not set to manual
   Parent.Default
)

 

This should do what you require without affecting performance in any way,

Let me know if you still run into any issues,

 

Cheers,

Sancho




Don't forget to 'Mark as Solution' if a post answered your question and always 'Thumbs Up' the posts you like or helped you!

View solution in original post

alexlrca
Level: Powered On

Re: [Edit forms] Button to automatically select dropdown value

This works, but I'd have to reset the value of the variable to "False" every time my users work on another flight

 

(

I should've given a bit more information about the context:

On the top of my screen, there is a drop-down field which lists all "open" flights currently on the apron. The users select one flight number in the drop-down, and the form loads the data that was already entered previously for that flight. Then, the users can enter the start time/ end time in the drop-down fields I previously mentioned.

)

 

Therefore, if the variable ManualTimes takes the value "True" when the button btn_TimeOverride is pressed, it will stay "True" when the users will select another flight in the drop-down..... Except if we reset the value of the variable to "False" every time my users tap on the drop-down to select another flight. But I said, I have + 40 variables to create, and they'd need to be reset EVERY SINGLE TIME someone taps on the drop-down  .. Would it be efficient for the performance of the app?

 

 

View solution in original post

3 REPLIES 3
Super User
Super User

Re: [Edit forms] Button to automatically select dropdown value

Let's say you have a button, btn_TimeOverride,

..and it's onSelect Sets a variable ManualTimes to true/false,

..then your Default for those dropdowns would be:

 

HoursDropdown Default:

If(
   ManualTimes,

   Hours(Now),

   // Else value so that it still uses existing times when not set to manual
   Parent.Default
)

 

MinutesDropdown Default:

If(
   ManualTimes,

   Minutes(Now),

   // Else value so that it still uses existing times when not set to manual
   Parent.Default
)

 

This should do what you require without affecting performance in any way,

Let me know if you still run into any issues,

 

Cheers,

Sancho




Don't forget to 'Mark as Solution' if a post answered your question and always 'Thumbs Up' the posts you like or helped you!

View solution in original post

alexlrca
Level: Powered On

Re: [Edit forms] Button to automatically select dropdown value

This works, but I'd have to reset the value of the variable to "False" every time my users work on another flight

 

(

I should've given a bit more information about the context:

On the top of my screen, there is a drop-down field which lists all "open" flights currently on the apron. The users select one flight number in the drop-down, and the form loads the data that was already entered previously for that flight. Then, the users can enter the start time/ end time in the drop-down fields I previously mentioned.

)

 

Therefore, if the variable ManualTimes takes the value "True" when the button btn_TimeOverride is pressed, it will stay "True" when the users will select another flight in the drop-down..... Except if we reset the value of the variable to "False" every time my users tap on the drop-down to select another flight. But I said, I have + 40 variables to create, and they'd need to be reset EVERY SINGLE TIME someone taps on the drop-down  .. Would it be efficient for the performance of the app?

 

 

View solution in original post

Super User
Super User

Re: [Edit forms] Button to automatically select dropdown value

Hi!

 

Yes, setting a variable to true/false is almost instantaneous, so there should be no performance hit if you are just setting variables to true/false. I have Apps where more than 20 are set when reading the next item to edit, and it's really quick. (and yes, using the OnSelect of the dropdown would be the most sensible place).

 

If you have any issues once you've put it all together feel free to shout,

 

Cheers,

Sancho

 

 




Don't forget to 'Mark as Solution' if a post answered your question and always 'Thumbs Up' the posts you like or helped you!

Helpful resources

Announcements
thirdimage

Power Apps Super User Class of 2020

Check it out!

thirdimage

New Badges

Check it out!

thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors
Users online (5,367)