Autonumber function for posting sequential ranges (and no-sequential)

I have an app which is used in a series of apps that accept orders, generate picking tickets and then allow edits to the delivery that has been picked.

One process I have set up is the entry of label numbers which are placed on the product for state-required tracking of the product's origin.

I have a table that shows the original picking data (done currently on a paper form) and a separate linked form that allows the user to change any product quantities which might have changed due to availabilty or product quality. The user also enters the sequential tag numbers which have been affixed to the products. Most of the time this is a sequntial assignment, so if the user enters a number in the Tag Start field of the edit form, the Tag End is automatially calculated.

Occasionally, a tag might break during attachment and a replacement (which might be non-sequential) will be attached. The non-sequential tag is reported in the Tag Extra field.

Also, the tags are not always applied in sequence of the order list, so the user will need to highlight those plants receiving tags in order to maintain the numbering (at least from a reference standpoint)

This is working, but the process is pretty manual. I am looking to have the next number available when the user selects the Tag Start field. Ideally a message appears with the next number available, and the user can accept the input, which will complete the Tag Start, and the Tag End will update automatically. The tag Extra would still be a manual process, but it would need to be accounted for in whatever process derives the next tag number (e.g. Max Tag Number +1).

I am using a MySQL database and can set up a view that would automatically update the nextTag value, but I want to ensure that once that value is used and "posted" to a table row, it won't be changed when the next row is processed.

Would a better approach be to use a Transformer to derive the next tag number? If so how do I ensure the numbers are posted correctly? Any input would be greatly appreciated.

Hi @edmartin! Happy to help with this.

To clarify, is your tag start and tag end data stored in a table together? If not, how is the tag end currently being calculated?

For example, my database table has an address_id and an address column. If a user selects an address_id, I can use code like this to find the corresponding address:

{{formatDataAsArray( => obj.address_id == select1.value)[0].address}}

filter by id

The tags are physically placed on the products and the staff member writes down the starting and ending numbers, and also any individual tags that are used in case an original tag breaks and needs a replacement.

So the data is coming from hand-written notes on a print out of a document. I have set up the form to have the TagEnd number calculate the value (tagStart + Qty -1) as the default value in the tagEnd field. There is also a tagExtra field where any replacement tags can be listed (single value currently).

So currently the starting Tag number is entered into the appropriate tagStart field and the tagEnd immediately populates with the sequential end number.

This is workable, but I was also wondering if there would be a way to have the tagStart value default to the next tagNumber in sequence. So if the first set of tags were for 9 units (numbers 100 - 108), when the user goes to the next item in the table, the tagStart field in the edit form would default to 109 if activated. I realize this level of automation might not be best, but I am responding to the client's request.

I signed up for office hours tomorrow to hopefully discuss this.

There are three data fields in my table (tagStart, tagEnd, tagExtra). These fields are populated from the form as not all products receive a tag. When the table record is updated the database table fields are updated.

The ending numbers are calculated by taking the starting number adding the quantity and subtracting 1. TagExtra data is directly entered into the form where it updates the database on acceptance.

Thank you again for coming to office hours yesterday, Ed! Hope to see you around again soon :slight_smile:

Also, for anyone lurking, I believe we were able to grab the latest Tag, which happens to be the largest Tag, from the table with something like {{_.max(formatDataAsObject(}}