SCIFI Timelines in FileMaker

If you came by our booth at DevCon, you likely saw our science fiction timeline. DayBack can now show multi-year projects on the Gantt Chart, and we created some long timelines to show how well this works. One plots when milestone SCIFI books and films were set, starting with Kepler’s Somnium in 1608. Check it out.

SCIFI Timeline

Make Your Own Timelines

You can make read-only URLs from any view in your calendar using DayBack’s sharing. Sharing is a great way to publish schedules to folks who can’t log into your FileMaker solution. The timeline above uses the new long timescales feature introduced as a free in-app update at DevCon. If you’d like to play with the timeline above, you can download a copy of DayBack with this SCIFI calendar already set up:

[sdm-download id=”12595″ fancy=”1″ show_version=”1″ button_text=”Download DayBack DevCon 2019″]

Date Limits in FileMaker

FileMaker doesn’t support dates after the year 4000 (same with timestamps). Yet, we needed dates up to 21500 to put Dune on our timeline. Fortunately, DayBack does support dates this big, and when looking at FileMaker sources it converts all dates and timestamps to numbers. So, for the SCIFI timeline in FileMaker, we used text fields for dates and wrote a function to turn those into timestamp-numbers. This is tricky because while FileMaker’s date functions understand leap years, we couldn’t use any of those functions on text-dates that far in the future.

FileMaker 18 While Function

Fortunately, FileMaker 18 introduced the while function so we could have loops within our calculation to express the leap year rule ourselves. This is a very rough implementation we put together for DevCon. It only works with dates in the MM/DD/YYYY format, but it was fun to play with “while” and to see events 20k years from now.

[ba-accordion name=”BA-Accordion”][ba-accordioncontent name=”BA-Accordion” heading=”Function: Large Text-Dates to Numbers” number=”1″ open=”no”]

Let ( [

//============= Assign your date and time fields here ==========================

    ds = "7/25/9205" ; // Your event's start date field
    ts = "9:00 am" ;  // Your event's start time field

//============= You shouldn't have to edit below this line =====================
//============= Returns a number based on a timestamp of the two fields above ==
//============= Required to support dates after 12/31/4000 =====================
//============= Works for any date after 1/1/1583 ==============================
//============= Supports text in the MM/DD/YYYY format =========================

    s = Substitute ( ds ; "/" ; ¶ ) ;
    m = Substitute ( LeftValues ( s ; 1 ) ; "¶" ; "" ) ;
    d = Substitute ( MiddleValues ( s ; 2 ; 1 ) ; "¶" ; "" ) ; 
    yr = Substitute ( RightValues ( s ; 1 ) ; "¶" ; "" ) ;
    yrs = GetAsNumber ( yr - 1583 ) ;
    leaps = // count the number of leap years since 1583

      While ( 
          [ 
           countLeaps = 0 ;
           testYear = 1583 
          ]; 
           testYear < yr ; 
          [
           countLeaps = countLeaps + // test for leap year

              If ( Mod ( testYear ; 4 ) = 0 ; 
                 If ( Mod ( testYear ; 100 ) ≠ 0 or Mod ( testYear ; 400 ) = 0 ; 1 ; 0 ) 
              ; 0  ) ;

           testYear = testYear + 1 
          ]; 
      countLeaps 
      );
    yl = 86400 ; // offset for leapyears
    y = 31536000 ;
    cyr = GetAsNumber (
              Timestamp ( Date ( m ; d ; 1583 ) ; Max ( ts ; 0 ) )
           ) ;
    num = cyr + ( yrs * y ) + ( yl * leaps )
]; 

    GetAsTimestamp ( num )

)

[/ba-accordioncontent][/ba-accordion]

This calc is included in the download above: in the fields DBk_TimestampStartCalcNum and DBk_TimestampEndCalcNum.

Featured Posts

Follow Along

Stay up to date with the latest news & examples from SeedCode

Leave a Reply

Your email address will not be published. Required fields are marked *

Check out some of our other posts ...

FileMaker Summer Camp – Recap

Unconference Sessions If you missed Pause in October, here’s a look at the sessions that attendees hosted. All the sessions are listed in this post

Subscribe to DayBack Updates & Status

Subscribe to DayBack’s latest features and example code at our new site: updates.dayback.com You’ll find new features and documentation, as well as the status and

DayBack Calendar in Claris Pro

DayBack for FileMaker 19 works great in Claris Pro with no changes required. The older DayBack Classic also works in Claris Pro, but requires a few changes.

COMPANY

FOLLOW ALONG

Stay up to date with the latest news & examples from SeedCode

© 2023 SeedCode, Inc.