cancel
Showing results for 
Search instead for 
Did you mean: 
Reply

Re: Identifying an Item Due for Inspection

I found a relatively easy fix for the time being. The following seems to work when we format the date as yyyymmdd and have the column set to INT in SQL.

 

SortByColumns('[dbo].[ItemTest]',"NextInspect", Ascending)

 

sample.PNG

 

 

 

 

This at least sorts the items that have an inspection date that is relatively close.

 

The next difficult task is going to be coming up with a formula that adds whatever inspection interval

 to the next inspection date field,  but this is a good starting point for solving this particular problem.

 

Life was sooooo much easier with AWA.  Thanks again @Meneghino.I'll continue to add any addtional solutions I might find in this thread.

 

 

Brendon

 

Re: Identifying an Item Due for Inspection

In using the yyyymmdd format (20170518, for example), have you been able to add or subtract dates?

Meneghino
Level 10

Re: Identifying an Item Due for Inspection

Hi, yes.  In order to do this you need to convert back to dates and then do the addition/subtraction.

I think the shortest and safest way to convert from yyyymmdd to date (MyDateInt) is the following:

DateValue(Replace(Replace(Text(MyDateInt), 7,0,"-"),5,0,"-"))

So if you need to add 35 days to this date you just do this:

DateAdd(DateValue(Replace(Replace(Text(MyDateInt), 7,0,"-"),5,0,"-")), 35, Days)

Same for the difference, in days say between MyDateInt_A and MyDateInt_B:

DateDiff(DateValue(Replace(Replace(Text(MyDateInt_A), 7,0,"-"),5,0,"-"))
, DateValue(Replace(Replace(Text(MyDateInt_B), 7,0,"-"),5,0,"-"))
, Days)

Re: Identifying an Item Due for Inspection

@MeneghinoThat worked! Now there comes the issue with adding the number of days from the inspection interval. There's probably some 15 line formula that I could figure out, but here's a way easier solution:

 

Here's your formula that you provided:

 

DateAdd(DateValue(Replace(Replace(Text(MyDateInt), 7,0,"-"),5,0,"-")), 35, Days)

I made some alterations to do the following:

 

1. Take the nextInspdate DATE and add it to the INTERVAL.

2. Use  the normal mmddyyyy format and DATE as the format in my SQL table.  This way, I'll be able to use DATE in the future in case the PowerApps team finds a way to get past the delegation issues with time. 

 

Here's the altered formula:

 

DateAdd(DateValue(Text(DataCardValue9)),Value(Text(DataCardValue10)),Days)

What this does here, is take the datacardvalue that is on the record for nextInspdate and adds it to the datacardvalue that displays the inspection interval.  I added a gallery and a display form so that a user can merely select a record and see the inspection date. The next step is to add a submit button and some additional inputs so that the user can conduct a proper inspection.

 

See picture below. Thanks @Meneghino for your help.

SNIP.PNGsnip2.PNG

 

Helpful resources

Announcements
firstImage

PowerApps Monthly Community Call!

Join us next Wednesday for our Demo Extravaganza, October 16, 2019 8am PDT.

firstImage

Microsoft Business Applications Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

SecondImage

Power Platform Summit North America

Register by September 5 to save $200

Top Kudoed Authors
Users Online
Currently online: 388 members 5,601 guests
Please welcome our newest community members: