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

Field not changing based on Purchase Date v2

So I thought I had the answer to this question I had posted before, but it is not exactly working as expected.

If(
    IsBlank(
        Text(DateValue(First(Sort(Filter(colEquip, 'Equipment Type' = "Safety Toe Boots" & User().Email=CurrentUserEmail ), 'Purchase Date', Descending
)).'Purchase Date' ))),
"Today",

Text(DateAdd(DateValue(First(Sort(Filter(colEquip, 'Equipment Type' = "Safety Toe Boots"), 'Purchase Date', Descending
)).'Purchase Date' ), 2, Years ),
"mm-dd-yyyy"))

I have a field in my screen that displays the dollar amount paid and what I am looking to have this do is if, Purchase Date is empty then display Today, otherwise display the Purchase Date plus two years.  It is not working

Dorinda_0-1666298220362.png

 

4 REPLIES 4
TheRobRush
Super User
Super User

Dorinda, add a text box into there and set its value to

IsBlank(
        Text(DateValue(First(Sort(Filter(colEquip, 'Equipment Type' = "Safety Toe Boots" & User().Email=CurrentUserEmail ), 'Purchase Date', Descending
)).'Purchase Date' )))

 

and see if it is returning the value you would expect, and we can go from there. Always easier to troubleshoot these if you separate the working parts and get them all functioning independently of each other first if you are having issues I find

 

_____________________________________________________________________________________
Like my answer? - Hit that Thumbs Up. Resolved the Issue? - Hit Accept as Solution.
This helps others find solutions to future issues!

Came back as True

TheRobRush
Super User
Super User

Ok so, in that purchase date box, I see a date is there which obvs mean this formula isn't returning wjhat you expected. Do you mind sending the Value put into that textbox/label that is showing a date correctly, and gallery items property as well, if this is  a gallery

_____________________________________________________________________________________
Like my answer? - Hit that Thumbs Up. Resolved the Issue? - Hit Accept as Solution.
This helps others find solutions to future issues!
TheRobRush
Super User
Super User

Actually think I see the issue.

IsBlank(
        Text(DateValue(First(Sort(Filter(colEquip, 'Equipment Type' = "Safety Toe Boots" & User().Email=CurrentUserEmail ), 'Purchase Date', Descending
)).'Purchase Date' )))

should be

IsBlank(
        Text(DateValue(First(Sort(Filter(colEquip, 'Equipment Type' = "Safety Toe Boots" && User().Email=CurrentUserEmail ), 'Purchase Date', Descending
)).'Purchase Date' )))

needs an extra &, to be &&

_____________________________________________________________________________________
Like my answer? - Hit that Thumbs Up. Resolved the Issue? - Hit Accept as Solution.
This helps others find solutions to future issues!

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

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