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

Adding a new record in place


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

Recommended Posts

Posted

I need to create a script that will add a new record in a protal at the line where the cursor is situated. The new record step just throws me to the last line of the portal. Am I missing a step somewhere . Any help would be really appeciated.

Many thanks

Posted

This worked for me a couple of times:

Make a field called SortOrder in the related file. Make it a serial number field, incrementing by 100 (10,20,30...) Have your portal sorted by sort order.

Put an "Insert" button in each portal row. Have it call a script. The script should:

-store the currentportalrow in a global field.

- get the sortorder value from the current portal row, store it in a global field.

- go to the next portal row and grab THAT sortorder. Then average the two and store the result in the global field. This is your new record's Sort Order.

- Call a script in the related file that'll create a new record then set it's sort order to the average you just calculated. That'll put it between the two when sorted.

- refresh the main file and go to the portal row you stored in the first step. then go to the next portal row and you should end up on the newly created row.

You might want to put a catch in the first script in case a bunch of rows get inserted. Test to see if row 1 and row 2's sort orders are within 1 or 2 of each other. If so, sort the related file by sortorder then reserialize it.

Jeff

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