Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Finding Min, Max, and next before max

Featured Replies

Hi all

I can find the min and max date a welder has welded, but i also need to find the date before the max date.

example:

Terry welds on 1/3/05

3/6/05

4/6/05

5/6/05

7/24/05

8/23/05

I can find the first date using "min" and the last date using "max" but i can not figure out how to find the date before "max" which would be "7/24/05".

Any ideas and suggest would be greatly appreciated

Thnaks in advance

Lionel

Show All Records 

Set Error Capture [ On ] 

Enter Find Mode [  ] 

Show Custom Dialog [ Title: "Oi Dude"; Message: "Enter name of the welder"; Buttons: "OK"; Input #1: Untitled::WelderName ] Perform Find [  ] 

Sort Records [ Specified Sort Order: Untitled::Days; ascending ] [ Restore; No dialog ] 

Set Error Capture [ Off ] 

If [ Get ( FoundCount ) > 2 ] 

     Go to Record/Request/Page [ First ] 

     Omit Multiple Records [ Get ( FoundCount ) - 2 ] [ No dialog ] 

     Go to Record/Request/Page [ Next ] 

     Omit Record 

Else 

     Show Custom Dialog [ Title: "Error!"; Message: "Nothing found"; Buttons: "OK" ] 

End If 




Dang ...you're on 6.0 then do you have to...




Show All Records 

Set Error Capture [ On ] 

Enter Find Mode [  ] 

Show Custom Dialog [ Title: "Oi Dude"; Message: "Enter name of the welder"; Buttons: "OK"; Input #1: Untitled::WelderName ]

Perform Find [  ] 

Sort Records [ Specified Sort Order: Untitled::Days; ascending ] [ Restore; No dialog ] 

Set Error Capture [ Off ] 

If [ Get ( FoundCount ) > 2 ] 

    Go to Record/Request/Page [ Last ] 

    Omit Record 

    Loop 

            Go to Record/Request/Page [ Previous; Exit after last ]

            Omit Record 

    End Loop 

Else 

Show Custom Dialog [ Title: "Error!"; Message: "Nothing found"; Buttons: "OK" ] 

End If 

--sd

Edited by Guest

Define a value list "Dates", using values from the date field, include only related values, starting from your welders table.

Then, in the welders table define a calculation field (unstored, result is date) =

Let ( [

list = ValueListItems ( Get (FileName) ; "Dates" ) ;

last = ValueCount ( list )

] ;

GetAsDate ( MiddleValues ( list ; last - 1 ; 1 ) )

)

Oh, version 6, bummer - I don't even know which functions are available in 6.

Try:

Middle(

ValueListItems(Status(CurrentFileName). "Dates") ,

Position(

ValueListItems(Status(CurrentFileName), "Dates") , "¶" , 1 , PatternCount( ValueListItems(Status(CurrentFileName), "Dates") , "¶") - 1 ) + 1 ,

Position(

ValueListItems(Status(CurrentFileName), "Dates") , "¶", 1, PatternCount( ValueListItems(Status(CurrentFileName), "Dates") , "¶") )

- Position(

ValueListItems(Status(CurrentFileName), "Dates") , "¶" , 1 , PatternCount( ValueListItems(Status(CurrentFileName), "Dates") , "¶") - 1 ) - 1

)

Dear me Comment....Hows about




RightWords(

Substitute(ValueListItems(Status(CurrentFileName), "Dates"); 

RightWords(ValueListItems(Status(CurrentFileName), "Dates");

 3); ""); 3)

If we're to be in almost excell mode B)

--sd

Edited by Guest

  • Author

SOren Dyhr and comment

thanks a bunch both of you are life savers

Thanks

Lionel

I have stayed away from counting words, because the result depends on the date format. In pre-7 versions:

8/25/2005 = 3 words;

25-8-2005 = 3 words;

but

25.8.2005 = 1 word.

---

I am sorely tempted to accuse you of being an Americano-centrist and ignoring the rest of the world!!!

Edited by Guest

I am sorely tempted to accuse you of being an Americano-centrist and ignoring the rest of the world!!!

Good grief, couldn't I pursuade you to call me "Daft as a brush" instead ...the other is unbearable B) : : :B:B - But the script then, it had some bite didn't it???

--sd

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.