Jump to content

Extracting week from field


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

Recommended Posts

Hi there

I have a field with this date format in it: 4/16/07 - 4/22/07

That I want to extract the week number from for the second date set

I am familiar with the week(field) format but that's based on a particular date. This field is just a number field at the moment and as you can guess the field length changes as the dates do eg.

1/3/07 - 12/19/07 so the standard left(field) command won't work either.

Anyone come across this before or have a solution?

Regards

Mark

Edited by Guest
Link to comment
Share on other sites

First, the field should be a TEXT field - because "4/16/07 - 4/22/07" is neither a date nor a number.

You can extract the starting date by:

GetasDate ( Leftwords ( YourField ; 1 ) )

or the week directly:

WeekOfYear ( Leftwords ( YourField ; 1 ) )

---

This is assuming your date format is set to m/d/y.

Edited by Guest
Link to comment
Share on other sites

  • 2 weeks later...

You can also use this custom function to extract all valid dates from a text.

Then do ???

Week ( GetValue ( GetDates ( yourField ) ; X ))

where X is the date you want, e.g. 2 if you want the week of the second date.

Hi there fabrice

Thanks for the link.

I tried the custom function but when I paste it into filmaker as a new custom functions I'm getting a few errors.

It doesn't recognise and number of the arguments and also says there are too many parameters.

Unfortunatley it's beyond my skill level.

thanks anyhow it looks like a great function.

Regards

Mark

Link to comment
Share on other sites

I just made a sample for you. Using v8.5.

The Custom Function must have a function that wasn't in v7, and as I tested it in v7, v8, and v8.5 and it is the only one that will not work.

HTH

Lee

p.s. updated because I noticed the version being used.

forDNA.fp7.zip

Link to comment
Share on other sites

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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