Q
Problem solve Get help with specific problems with your technologies, process and projects.

Sequential work order system

I am using the discussion database template to build an application that will allow me to interact with my customers. I am implementing the addition of a work order form so they can request work.

My current challenge is in a field I added to the database that I called "Work Order Number." This field should be derived when the form is created and should be incremented one number greater than the highest work order number in existence in the database.

My approach is to use the @dblookup 'dance' in the initialize function of the workordernumber field involving a view with one column (the work order number column), sorted in descending order.

Once the form successfully loads, I need to save it immediately so that work order number is 'saved.' If someone else goes in and creates a new work order, the numbers would increment correctly.

I am hoping there is a code sample out there somewhere or some documentation that I could use to get a jump start on this. This seems to be a common need for incrementing fields like this. Oh, and this has to work natively and using a browser.

You've taken on a difficult task.

It's a bad idea to save a document as soon as someone starts to compose it. What if they change their mind and decide they didn't need a work order after all?

For a work order system there's no need for the order numbers to be sequential; they only need to be unique. Often, people will ask for sequential numbering because it satisfies their sense of order, not because there's a real operational reason for it (e.g., if it were important to be able to look at the list and see whether one were missing, as when balancing your checkbook). If you can just use @Unique in a "computed for display" field, you'll save yourself a lot of grief.

If the idea is to be able to sort the documents based on when they came in, you can't do that if you save the document immediately when they start to compose it. I can start to compose a work order, save it and then go away for four hours before I come back to complete it. Meanwhile five other people have submitted requests. Should mine list before theirs? Wait to save until the user says they want to save, and sort by the @Created date instead.

If you must have sequential numbers: Much has been written about this subject. There's a list of links on this page (look for the "Sequential Numbers" heading). It's not easy, unless you have only a single replica of your application and can wait to assign the number until the document is saved.

Do you have comments on this Ask the Expert question and response? Let us know.

This was last published in November 2004

Dig Deeper on Lotus Notes Domino Formula Language

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchWindowsServer

Search400

  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...

SearchDataCenter

SearchContentManagement

Close