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

Combobox defaultselectedItem not work

Hi Evereybody,

for a simple question, I'm loosing so much time....

 

I have a set a datetime value for appointments, so I have add in my form a DatePicker and two combobox (one for hours and 1 for minutes)

 

The cbxHours.Items is: ["";"08";"09";"10";"11";"12";"13";"14";"15";"16";"17";"18";"19";"20"]

The cbxMinutes.Items is: ["";"00";"15";"30";"45"]

 

 

I want that if i select a record whit an appointment, in these box I have to display the Appointment Hour and the Appointment Minute

 

So, on the OnVisible Event on this form I have this code:

 

Reset(cbxHours);;
Reset(cbxMinutes);;
If(selectedItem.Stato.Value = "Appuntamento";
Set(vAppointmentDate; Text(selectedItem.Appuntamento; "[$-it-IT]dd/mm/yyyy"));;
UpdateContext({vAppointmentHour:Text(Hour(selectedItem.Appuntamento))});;
UpdateContext({vAppointmentMinutes:Text(Minute(selectedItem.Appuntamento))});;
;
UpdateContext({vAppointmentDate:Blank()});;
UpdateContext({vAppointmentHour:""});;
UpdateContext({vAppointmentMinutes:""})
)

 

 

But If i add the vAppointmentMinutes as cbxMinutes.DefaultSelectedItems I have an error.

What is wrong?

 

Thanks

Marco

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Anonymous
Not applicable

Hi,

 

The defaultSelectedItems for comboboxes has to be an array, so you could update with either:

UpdateContext({vAppointmentMinutes:[""]})

 

or in the  cbxMinutes.DefaultSelectedItems have

[vAppointmentMinutes]

 

Hope this helps,

Alex

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Hi,

 

The defaultSelectedItems for comboboxes has to be an array, so you could update with either:

UpdateContext({vAppointmentMinutes:[""]})

 

or in the  cbxMinutes.DefaultSelectedItems have

[vAppointmentMinutes]

 

Hope this helps,

Alex

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 (4,435)