cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous_Hippo
Super User
Super User

Set the Last value of a date picker to another date picker when its value changes

Hi all,

 

I'm trying to set a last value of a date picker to another date picker when its value changes. For example 

 

Anonymous_Hippo_1-1629763572227.png

Whenever the value of A changes I update the last saved value to "Previous value of A"  .

 

I know that i can easily do this using a variable but since there is already a value in "Previous value of A" field things become confusing to me. This seems so easy but my brain isn't working

 

Thanks for your help

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Anonymous_Hippo
Super User
Super User

Hello @v-bofeng-msft ,

 

Thank you for sharing such a great idea !  I wanted to point out that in your method it worked only after the 2nd change because the first time i change the value it saves the new value and not the old one. To fix this issue while doing a clear collect i saved the current value of A.

ClearCollect(
    Selectlog,
    {Value: Avalue}
);

In this way we were always comparing the right value.

 

Thanks ! a great learning point 🙂 have a nice day

View solution in original post

2 REPLIES 2
v-bofeng-msft
Community Support
Community Support

Hi @Anonymous_Hippo :

Do you want to get something like this:

1.gif

I've made a test for your reference——

I assume 'Previous value of A''s Default value is 

Today()

'A'

OnChange

Set(
    IfChange,
    true
);
Reset('Previous value of A');
Collect(
    Selectlog,
    Self.SelectedDate
)

'Previous value of A'

DefaultDate

If(
    IfChange,
    First(
        LastN(
            Selectlog,
            2
        )
    ).Value,
    Today()
)

 Best Regards,

Bof

Anonymous_Hippo
Super User
Super User

Hello @v-bofeng-msft ,

 

Thank you for sharing such a great idea !  I wanted to point out that in your method it worked only after the 2nd change because the first time i change the value it saves the new value and not the old one. To fix this issue while doing a clear collect i saved the current value of A.

ClearCollect(
    Selectlog,
    {Value: Avalue}
);

In this way we were always comparing the right value.

 

Thanks ! a great learning point 🙂 have a nice day

Helpful resources

Announcements
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.

Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on June 15, 2022 at 8am PDT.

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Top Kudoed Authors
Users online (3,338)