cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Ungarala1
Helper V
Helper V

Pre populate date pickers

I have created training form from sp.

Which contains 10topics,each topic has drop-down status columnn(not started,inprogress,completed) with date picker .

Whenever user select any topic it as should update date picker automatically today.

Note: only selected topic drop-down one date should change.

Other training topic should show default.

If they change the status of other training topic then it should get change or else keep it default.

I tried updatecontext on change property of drop-down but changing dates on all training topics with out touching other topics drop-down.

 

5 REPLIES 5
AmDev
Super User
Super User

Hi @Ungarala1  - I'm trying to understand the data structure/process. Is the following interpretation correct?:

 

  • You have 1 column for every topic (i.e. column name = topic) and in each topic column is a choice status field?
  • You have one corresponding date field for each topic
  • This is a total of 20 columns for the above
  • If a user changes the status in any topic, you want the corresponding date column to show todays date and both status update and date will be saved to the list.
  • Your default status is 'Not Started' and the default date text is shown until someone chooses another status
  • This will result in there being one row in your SharePoint list per user

yes u are correct , total 20 columns..

AmDev
Super User
Super User

Hi @Ungarala1 

 

Please try these steps and duplicate accordingly for each topic:

 

  • Status drop down for each topic - add relevant number in place of #
    • In the Onselect property of each combo box control add UpdateContext({varlTopic#:Self.Selected.Value}) - This adds your selected status for that topic to a local (context) variable varlTopic#, which is used to auto populate the date....
  • Date Picker Control for each topic:
    • Change the DefaultDate property to: If( varlTopic# = "inprogress" || varlTopic# = "completed", Now(), Parent.Default)
    • Optional Change for InputTextPlaceholder property:- Change If(IsBlank(Self.SelectedDate), Text("DD/MM/YYYY"))
    • Change the 'displaymode' property of your DatePicker Datacard to 'View' - prevents users from manually changing it, but still allows the automated change from the variable
  • Lastly, be sure to set all your local variables to blank once submitted, by using the following in the 'OnSucess' property of your form: UpdateContext({varlTopic#: Blank()})

 

Hope this makes sense, but just shout if you have any queries

 

Good luck!

I need to enter last code on onsucess?

Because user will use same record for edit also?

 

Hi @Ungarala1 - yes insert that last code in the OnSuccess.

 

Note the following code in the defaultdate property will handle the scenario when someone goes back to edit. If the status has been changed for a topic and this was submitted to your backend data source, when the respective variable for that topic has been cleared, this will then present the defaultdate as the else from the following if statement, which the Datacard (the Parent) should be taking straight from the newly updated backend datasource:

 

If( varlTopic# = "inprogress" || varlTopic# = "completed", Now(), Parent.Default)

 

Hope this makes sense, but let me know if you need anything else.

 

Helpful resources

Announcements
Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Super User 2 - 2022 Congratulations

Welcome Super Users

The Super User program for 2022 - Season 2 has kicked off!

September Events 2022

Check out all of these events

Attend in person or online, there are incredible conferences and events happening all throughout the month of September.

Users online (5,751)