We're reclaiming inactive PDIs to keep them available for active builders. Learn what's changing, who's affected, and how to protect your work. Read More

Script to Find Earliest/Latest Date entry from a set of records

Erik Nelson
Mega Sage

Hello!

 

I've been tasked with finding a way to coalesce reporting data in a custom app and am not quite sure how to surface the earliest and latest dates associated with a record.

 

The inputs are from a report generated in a Custom app. Essentially, 1 or more "zones" are selected and a stop and start time are entered. This spits out a report of all devices associated with the zone(s) and assigns the start and end date to them. The entries are coming from unique fields (long story) so it's possible to have not only a duplicate device but for each to have their own start and end times.

 

The outcome being requested is essentially to coalesce the data on each device, and assign to it the earliest start time and the latest end time for an exportable report. Example - Report gets generated based on Zone 1 and Zone 2. Device A appears in each zone, so on the report it displays twice; once each with it's respective Zones Start and End time. The coalesced report would spit the Device once with just the earliest start and latest end.

 

I'm using Flow designer for this and have already built out the initial lookup to return just the unique Device entries so I at least have a starting point for a "For each item", but can't seem to figure out getting the date entries. I'm presuming they'll be similar scripts and I'm assuming I'll need to do separate lookups, which is fine, just need a little help (and Now Assist isn't cutting it!)

 

Thanks,

Erik

1 REPLY 1

DrewW
Mega Sage

So when you say "would spit the Device once with just the earliest start and latest end" do you mean that the device will display in Zone 1 only with its earliest start and latest end.  Or that the device will display in Zone 1 with its earliest start and in Zone 2 with its latest end?  Something like

 

DeviceZone 1Zone 2Zone 3
DevAStart: 1/1  End 1/4  
OR this   
DevAStart: 1/1End: 1/4 

 

Also if this is what your data looks like for DevA

ZoneStartEnd
11/101/12
21/111/14
31/41/10

what should be displayed and for what zone and why that zone?