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.

Featured Replies

Hi,

I wish to generate a list of dates from a range field which changes on a regular basis.

At present my range field shows 11/04/2003...21/04/2003

I now need to show all individual dates from that range in another field which includes the start and end dates. eg; 11/04/2003

12/04/2003

13/04/2003 and so on

preferably using a calc field as it is awkward running a script each time.

Manyt thanks

Benzie

Get a range plugin ... there are several around, like Troi Ranges or Ranges ToolBox ...

depending on the number of days between the 2 days you could use a simple calc:

DatetoText(startDate) & "q|" &

if(EndDate>StartDate;DatetoText(StartDate +1) & "q|";"") &

if(EndDate>StartDate;DatetoText(StartDate +2) & "q|";"") &

if(EndDate>StartDate;DatetoText(StartDate +3) & "q|";"") &

....

q| stands for return char.

is of no use when you span several centuries.

To save you typing, yo may consider setting up a script which generates the calc

set field, g_temp to 1

set field calc to "DatetoText(startDate) & ""q|"" &"

loop

set field calc to "calc &" if(EndDate>StartDate;DatetoText(StartDate +g_temp) & ""q|"";"""") &"

set field g_temp to g_temp +1

exit loop if g_temp = 1000

end loop

go to next record

now copy calc into your calculation and delete the last "&"

  • Author

Hi Cjaeger,

Thanks for your response. I have tried the to make the script but get errors when pasting in your script steps - I have attached a small demo file of what i'm trying to achieve.Could you possibly have a look and advise?

Many thanks,

Benzie

daterange.zip

Here is a sample file that does not require a script, just some calculation fields. Its limitation is that it will only generate a list of dates for a maximum span of 2 years. But, I assume that if you are trying to fit them into a text field, you probably don't need to have any more than that.

BTW, I should warn that this is set up for US date format, so you may have to modify the formula somewhat for DD/MM/YYYY format. I've included a script that initializes the gSequence global. It may be sufficient to simply run that script once to set up the global field to your system formats.

<<<Edited>>>

I noticed a bug in the file. So I replaced the original attachment. This one will work correctly with either an ellipsis or 3 periods as the date range separator.

Also, to adjust it to your local date format, Save the file as a clone and then open the clone and run the Gendates script. That should allow it to work anywhere.

DateRange3.fp5.zip

  • Author

Bob,

This is exactly what I require, and looking from the number of downloads will be of use to many people.

Many thanks,

Regards,

Benzie

I just noticed another bug. I had it set to work when spanning more than one year when either year is a leap year, but I forgot the case where neither year is a leap year--trying to be too clever. I fixed this problem and reposted the file (DateRange3.fp5).

Better download it again.

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.