Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Referencing The Next Record

Referencing The Next Record

Referencing The Next Record

Okay I have solved many problems

I now need to reference the previous record to make a calculation. A dummy database is shown below.

9    <<<(first record)

The code for this would look something like this.


if (previous_record != null or does not exist){
current_record = previous_record + 1
current_record = 9

--end code--

summary (need to know how to)
- referencing previous and next record
- detect nulls or undefined or non-existing without crashes

Any solution or designs are welcomed

RE: Referencing The Next Record

What is the relationship between the records in a given range ?

RE: Referencing The Next Record

well all i want to do is be able to populate a field base on a math.

so the relationship is

the current record(say R5) is eqaul to what ever the previous record is plus one.

the next record(say R6) is equal to R5 plus one

another possible solution could be


current_record = current_record_index*1 + 9

--end code--

in this case we would use an automatic index and then adding a constant(9) modifier
and the (*1) can make the increment of one or 2(*2)

but how ever it goes my aim is to automatically populate these field with data that is decided by math or

if (previous_record != null or does not exist){
current_record = previous_record + a
current_record = a

--end code--

which will result in


RE: Referencing The Next Record

The relationship question was to know if there is already a selfjoin relationship in the file...

One way to go is using a lookup.
You need a selfjoin relationship between Serial::PreviousSerial

PreviousSerial = Serial - 1

To find the previous value you need to lookup, based upon the relationship, but check the 'copy next lower value'.

So, 5 fields
addValue, is whatever you want to add
previousValue_nlu, is the lookup
value_cn = previousValue_nlu + addValue
serial_aen, autoenter serial number
previousSerial_cn = serial_aen - 1

This will increment at recordcreation.
If you want it in a given range, you will have to script your steps.

Keep in mind that you can not mix the operators, (+) is for numbers, (&) is for text.
If you want a mix of this you will have to use the proper functions.

RE: Referencing The Next Record

from what i can see this works in terms of populating the database on creation

but if i say delete a record in the middle of my database i will require the rest of my record to change it's content to suit the new database.

for example

10    <<< delete

you will get

i want

RE: Referencing The Next Record

>> from what i can see this works in terms of populating the database on creation

That's indeed what I mentioned in my post: This will increment at recordcreation.

If you delete a record, there several ways to go.
Depend on your structure and what you want to do. Not knowing the structure or the purpose of what you want to achieve:
Use the Replace Field Contents script step - Replace with serial numbers

An other way could be to search for missing serials and let FileMaker create the next records with the missing serial first, untill there are no missing serials anymore, and then go on creating reords with 'new' serials.
But again it depends...

RE: Referencing The Next Record

well my calculation is a bit complicated but it is coming along

I am creating a custom calender which because it is using math can go to the year 9999 or what ever.

over all it is still coming along
but an important thing i need to know is how can i detect non-existing field or null fields

and getting the current date which needs to be renewed at least once everyday(schedule get date)

RE: Referencing The Next Record

A calender !?
Try to tell what you want to do in your posts....

Take a look at http://my.advisor.com/doc/17166 before you try to invent the wheel again.

RE: Referencing The Next Record

okay I have had a look at it
but i think i can make a better calender

can you tell me how to detect decimal places

3/2 = 1.5   <<< detected
2/1 = 2     <<< pass
9/3 = 3     <<< pass
9/8 = 1.125 <<< detected

mine will be base on math rather then data
meaning when you select a certain month eg. may 2006 the math tell you what day the 1st(mon)-31st(wed) will be. rather then create days and month before hand then using the input to find the days to dsiplay

RE: Referencing The Next Record


Use a validation by calculation, strict, do not allow override validation, with message:
Truncate(Number; 2) = Number
or put it in a validation field.

First day of Month : Date ( Month ( DateField ); 1; Year ( DateField ))

Last day of Month : Date ( Month ( DateField ) + 1; 1; Year ( DateField )) - 1

and noe that we are at it, first day of week:
DateField  - (Mod ( DateField - Date ( 1; 3; 1904); 7))

RE: Referencing The Next Record

wow thanks

i was however half way through my calculation though

but this works too

now knowing how ingnore decimal is my aim



will all result in 1
like i want to just ignore the any number behind the decimal and no rounding what so ever

RE: Referencing The Next Record


RE: Referencing The Next Record

Make for the always returning calculations a Custom Function.

You will see that for some calculation you will need a recursive calculation.
Make also a Custom Function for those.
It will save you a lot of time in coding.

RE: Referencing The Next Record

okay thanks JeanW

I my task for this thread is done
there fore this thread is now considered closed

RE: Referencing The Next Record

To come back on your calendar...

I don't see why you need several records.
I have a calendar with 4 fields, 1 record and 1 script.
It covers the whole possible native FileMaker daterange, going from year 1 to 3000.....even 4000, what is the limit on datecontrol within FileMaker.

I wonder how you will manage to check for accuracy beyond that limit....

RE: Referencing The Next Record

Well JeanW I am working on many things and well the calender is being used not only for dates but as link to chedules and many things

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close