# Simple Date compare Function?

This topic is 6627 days old. Please don't post here. Open a new topic instead.

## Recommended Posts

Hello,

I'm converting to FM7 from FM6. I have a script that is run to determine the oldest of a set of dates. This is later used to sort a found set. The script I wrote a LONG time ago, before I knew what a case() function was for is this:

If ["IsEmpty(EX FUD) = 1"]

Set Field ["gl_DateCompare", "Elmer FUD"]

Else

Set Field ["gl_DateCompare", "EX FUD"]

End If

If ["IsEmpty(EQ FUD)"]

Else

If ["EQ FUD <= gl_DateCompare"]

Set Field ["gl_DateCompare", "EQ FUD"]

End If

End If

If ["IsEmpty(TU FUD)"]

Else

If ["TU FUD <= gl_DateCompare"]

Set Field ["gl_DateCompare", "TU FUD"]

End If

End If

If ["IsEmpty(FS FUD)"]

Else

If ["FS FUD <= gl_DateCompare"]

Set Field ["gl_DateCompare", "FS FUD"]

End If

End If

If ["IsEmpty(FS FUD 2)"]

Else

If ["FS FUD 2 <= gl_DateCompare"]

Set Field ["gl_DateCompare", "FS FUD 2"]

End If

End If

I want to make this into a simple Custom Function.

I know I can a series of Case() Steps, however, I want to learn how to make this cleaner, and faster.

Any ideas?

There are 5 dates to compare, I want to find the lowest of the 5 dates.

Thanks!

##### Share on other sites

Couldn't you just use something like

LowestDate = min(date1, date2, date3, etc)

or

LowestDate = min(Table:DateToCompare)

##### Share on other sites

HA!! I love it! A function that I have never explored!

GOD I love this forum!

Thanks!

##### Share on other sites

This topic is 6627 days old. Please don't post here. Open a new topic instead.

## Create an account

Register a new account