cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Regular Visitor

Suggestion on best practise for DatePicker

Hi Everyone, 

i am in the discovery phase of project where a potential custumer has the need to inform the salesperson if the chosen date on a datepicker control is the correct weekday for the scheduled deliveries in the area of that customer. I set an example:

Client A is located in the province "PD", in this area deliveries are scheduled to be made only on Wednesday and Friday. On the account record we set a lookup to a table called Province where each record is a match between the Province (i.e. "PD") with the possible days of delivery in that area (i.e. WED & FRI), the days are part of a global option set called Weekdays. 

Therefore the big request is to guide the user in choosing only the correct weekday for that area. 

Open to any of your suggestions as how to best approach this scenario.

 

Thanks!

1 REPLY 1
Microsoft
Microsoft

Hi @nikongarato ,

 

Could you tell me:

  1. Do you have a table for submitting the delivery date?
  2. Do you also have a table that records the delivery time (day of the week) in different regions?
  3. If the user selects a certain area but selects the wrong date(), the user will not be able to submit the data and the app will remind the user to select the correct date?

 

If my assumptions are correct, I did a simple test for you.

1\ This is table ‘account record’. The user uses the table to submit the delivery date. ‘TestDate’ is a Date column. ‘Province’ is a lookup column. Its related table is ‘Province’.

v-xiaochen-msft_0-1614150343804.png

 

2\ This is table ‘Province’. Its Name column stores all regions.

‘Weekdays’ column is a Choices column. It has seven options, namely ‘Monday’ , ‘Tuesday’…… ‘Sunday’.

v-xiaochen-msft_1-1614150343806.png

 

 

3\ Add a textnput control ‘TextInput1’.

 

4\ Add a datepicker control ‘DatePicker1’.

 

5\ Add a combo box control and set its Items property to:

Choices('account record'.Province)

 

6\ Add a button control ‘Button1’ and set its onselect property to:

Patch('account record',Defaults('account record'),{Name:TextInput1.Text,TestDate:DatePicker1.SelectedDate,Province:ComboBox1.Selected})

 

Set ‘Button1’ ‘s DisplayMode property to:

If(Weekday(DatePicker1.SelectedDate) in AddColumns(ComboBox1.Selected.Weekdays,"Test",If(Text(ThisRecord.Value)="Sunday",1,Text(ThisRecord.Value)="Monday",2,Text(ThisRecord.Value)="Tuesday",3,Text(ThisRecord.Value)="Wednesday",4,Text(ThisRecord.Value)="Thursday",5,Text(ThisRecord.Value)="Friday",6,Text(ThisRecord.Value)="Saturday",7)).Test,DisplayMode.Edit,DisplayMode.Disabled)

 

7\ Add a label control and set its Text property to:

If(Button1.DisplayMode=DisplayMode.Disabled&&!IsBlank(ComboBox1.Selected),"You could only choose "&Concat(ComboBox1.Selected.Weekdays,Text(Value),","),"")

 

8\ The result is as follows:

AAA.gif

v-xiaochen-msft_2-1614150771418.png

 

 

Best Regards,
Wearsky
If my post helps, then please consider Accept it as the solution to help others. Thanks.

Helpful resources

Announcements
New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

New Power Super Users

Congratulations!

We are excited to announce the Power Apps Super Users!

Power Apps Community Call

Power Apps Community Call: February

Did you miss the call? Check out the Power Apps Community Call here.

Top Solution Authors
Top Kudoed Authors
Users online (65,562)