Jump to content
Server Maintenance This Week. ×

Auto number portal rows?


skearton

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

Recommended Posts

How does one write a script to auto number a portal row as each new portal is created related to a record? I have an order database that has a portal for line items. I would like to give each line item it's own number. If I have to rely on people to enter the number it happens sporadically. I would like the user to still have the ability to enter the field and change it if they decided that one item should be ahead or before another.

Link to comment
Share on other sites

you could add auto enter option and use the Get ( PortalRowNumber ) function - however, should you delete a portal row in the middle of your items, then the next number may be a duplicate.

If you were using FileMaker 10 you could add script triggers that could trigger when you exited a field or modified the record updating all the children records. - You could do so in v8 with a plugin but not as maintenance free.

If you don't need the row number in the actual child table and this is just to be used to show for display row number just add @@ in the portal so that each row has a number.

Link to comment
Share on other sites

Set up a self join relationship between the LINE_ITEMS table using the OrderID field as the key, this will group together all the LINE_ITEMS that belong to a specific ORDER:

LINE_ITEMS.SelfJoin = LINE_ITEMS.OrderID::LINE_ITEMS.OrderID

Use the new relationship with the MAX function in an AutoEnter field (say, LineNumber)

So.

LineNumber =

Max (LINE_ITEMS.SelfJoin) + 1

This will always increment the LineNumber and won't be duplicated and the users can still modify the LineNumber.

I did such a thing so a user could manually change the sort order for the LINE_ITEMS, thus printing the ORDER in their preferred sequence.

Link to comment
Share on other sites

  • 2 years later...

Then why quote the entire post? The "notes" were in the quote and appeared to be part of it. You should have asked your question below the part of the post you wanted to quote that you were referring to. You do not need to quote the whole body when referring to another post. Just delete those part that are not pertinent your question.

Try asking your question again without quoting the whole thing.

Link to comment
Share on other sites

  • 5 months later...

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