cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
jbrines
Post Prodigy
Post Prodigy

When changing a field automatically update a date field

I have two fields from a List.

 

A category where we select A, B or C

I am looking to add update a date and time field (Assigned To) whenever the category field is selected. The date an time needs to be the date and time at which the category is changed.

 

Screenshot_20201231_114734.png

1 ACCEPTED SOLUTION

Accepted Solutions

I don't know that the switch is needed is it?  I think the ask is just to set the combo boxes to the current date/time and time that dropdown is changed.  So it is the same for each selection.  If i am correct you don't need the switch a simple set will work.

 

Set(
    varDateTime,
    Now()
)

 

Then you can set the proper values on the DatePicker and Dropdowns

 

DatePicker > DefaultDate

varDateTime

 

HourDropdown > Default

 

Hour(varDateTime)

 

MinuteDropdown > Default

 

Minute(varDateTime)

 

Note: you need to make sure the Hour and Minute dropdown have the values in their "Items" array to select.

View solution in original post

5 REPLIES 5
Jitendra_jangid
Resolver II
Resolver II

You can write something similar to following formula on OnChange of your combobox and set DefaultDate  property of DateTime contorl If(Not(IsBlank(ComboBox1.Selected)), varCategoryDate, Blank())

Switch(
    Self.Selected.<Property>,
    "A",
    Set(
        varCategoryDate,
        Today() // ANY date of choice
    ),
    "B",
    Set(
        varCategoryDate,
        DateAdd(
            Today(),
            1,
            Days
        )
    )
)

 

@Jitendra_jangid 

 

The date and time is broken in to three boxes, Date, Hour and minutes so if I update the DefaultDate property will that update the date and time?

No, time will not be updated by setting DefaultDate of Date control.

You need set individual Dropdown(Hour and minute) Default property.

 

Hour Dropdown can be set like this one Hour(DateTimeValue(varCategoryDate)).
Minute Dropdown can be set like this one Minute(DateTimeValue(varCategoryDate))

I don't know that the switch is needed is it?  I think the ask is just to set the combo boxes to the current date/time and time that dropdown is changed.  So it is the same for each selection.  If i am correct you don't need the switch a simple set will work.

 

Set(
    varDateTime,
    Now()
)

 

Then you can set the proper values on the DatePicker and Dropdowns

 

DatePicker > DefaultDate

varDateTime

 

HourDropdown > Default

 

Hour(varDateTime)

 

MinuteDropdown > Default

 

Minute(varDateTime)

 

Note: you need to make sure the Hour and Minute dropdown have the values in their "Items" array to select.

@jeffwllms Many thanks. It's working a treat.

Helpful resources

Announcements
Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on August 17, 2022 at 8am PDT.

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Users online (2,363)