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 / Combobox defaultselect...
Power Apps
Answered

Combobox defaultselectedItem not work

(0) ShareShare
ReportReport
Posted on by 24

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

 

 

 

 

Categories:
I have the same question (0)
  • Verified answer
    Community Power Platform Member Profile Picture
    on at

    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

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…

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Apps

#1
Kalathiya Profile Picture

Kalathiya 393

#2
WarrenBelz Profile Picture

WarrenBelz 345 Most Valuable Professional

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 271 Super User 2025 Season 2

Last 30 days Overall leaderboard