Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

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

Recommended Posts

Posted

Hey all,

This is for one of my projects. Been having trouble trying to create a script which will create a new record and automatically set the date field to be 1 day later than the previous record.

For example, say I have a record in last week dated at Feb 20. Today I want to create a record which will automatically label the date as Feb 21. And if I use the script again, it will create a new record with date of Feb 22 and so on and so forth.

Any ideas will be well appreciated. Note however that by setting the date field to auto date creation will not work.

Posted

Make a selfjoin relationship on your file that relates to all records (ie, make a calculated field Key=1, and use it as the relating field).

Then make a calculated field:

cDate = Max(Self::Date)

Then, set up your Date Field as autoenter:

Date, Autoenter Calculation = cDate+1

You need to have the cDate field as an intermediary to prevent a circular reference.

Posted

bob,

thanks for ur help in both areas. the script to delete cuplicates work now. but i am still having trouble with this auto increment of dates function. can you explain it in a more idiot proof manner? i am a total newbie here. appreciate you help a lot. Thanks again.

Posted

Create a calculated field called Key. Click Options and where you enter the formula, just enter 1. Click OK, and then "Done"

Now, select "Define Relationships" under the file menu. Create a new relationship called "Self". In the two lists that appear in the dialog, click "Key" on both the left and right lists. Click OK and then Done.

Next, go back to Define Fields, and create a date field called "Date". Don't enter any options just yet.

Next, create a calculated field called "cDate". When you click Create, the formula dialog opens where you enter the formula value:

Max(Self::Date)

At the bottom of the formula window, set the calculation result type to date from the popup menu. Click OK.

Now, go back and select the Date field, and click Options. Under the Auto-Enter tab, click the Calculated value checkbox. A new formula window appears where you enter the following formula:

cDate+1

Click OK, OK again, and then Done.

That should do it.

This topic is 8673 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.