February 28, 200124 yr 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.
February 28, 200124 yr 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.
February 28, 200124 yr Author 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.
March 1, 200124 yr 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.
March 1, 200124 yr Author Thanks a lot BOB!!! It works GREAT!!! Appreciate it buddy! Here's a thumbs up for you, until next time.
Create an account or sign in to comment