web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Apps
Answered

Date Comparisions

(0) ShareShare
ReportReport
Posted on by 50

Hi, 

I have an end date in the format Mar 2021, Apr 2021, Jun 2021, till Dec 2022 stored as string in the SQL database table. Now, I want to set status as Inactive if end date < current month and year. How can I achieve this and can I write this on OnStart property of the app.

Categories:
  • Verified answer
    RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @vakula 

    I'm not sure how you expect the OnStart to play a role in this or what you want to change the status to inactive for.  Perhaps you can explain that a little further.

     

    In general though, your date comparison for that would be something along this line.

      DateValue(yourSqlDateText) < Date(Year(Today()), Month(Today()), 1)

     

     

  • mogulman Profile Picture
    764 on at

    Why do you have date as string?  Use data type datetimeoffset.  It is easier to compare.

  • Vakula Profile Picture
    50 on at

    @RandyHayes I have start date, end date and some other items in gallery. Every time the user opens the apps, it should check if there any rows with end date < todays date and update the status to Inactive. So, on which property, I should write the code.

     

    UpdateIf('[dbo].[Tableabc]', If(EndDate<>"*",DateValue(EndDate) < Date(Year(Today()), Month(Today()), 1)),{RuleStatus:"InActive"})

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @vakula 

    You are describing a process and a user interface.

    Please clarify which is true:

    A) You want the App to automatically go through the actual data in your datasource and change records that do not meet the criteria you mention and set them to Inactive.  This is a data process action.

    B) You want the user to either see the rows that do not meet the criteria as disable or not have them show at all.  Or you want to provide a way for the user to then initiate a data action to mark them as inactive.

     

    If A, I would consider a PowerAutomate flow to do this as you are relying on a User to open an app in order to change your records.  This should be on a timed schedule instead.

     

    If B, then this is a matter of filtering the Gallery of records.

     

  • Vakula Profile Picture
    50 on at

    Thanks, It worked!!

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 220 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 189 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 139

Last 30 days Overall leaderboard