Yes I don't want just a random Key or system ID, I want a bit more control over the number generated and it should be user specific.
The ID should start at 1 and increment for every new entry. This ID will form part of a concatenated KEY I will build up for each entry to a user's inventory. Think of the requirement as a SKU type code used for stock management.
The incremental ID should be unique at the level of the Master entry's Category selected. The category exist in the master form as a hierarchy of lookup fields to filter the next level down.
I had a look at [auto_id], but I'm not sure how I can utilize this function to identify the next number (start=x) sequence for the logged in user based on the lookup selection (category).
For example, 2 different users using my application:
1.) User_ID 3:
- User_ID 3 is logged in
- User_ID 3 is adding 2 new entries to his personal inventory, 1 Fruit and 1 Vegetable
- User_ID 3 already has 7 entries in his inventory for Category "Fruit"
- User_ID 3 is capturing a new "Fruit" entry, this fruit should be assigned an ID of 8
- User_ID 3 already has 5 entries in his inventory for Category "Vegetable"
- User_ID 3 is capturing a new "Vegetable" entry, this vegetable should be assigned an ID of 5
2.) User_ID 10:
- User_ID 10 is logged in
- User_ID 10 is adding 2 new entries to his personal inventory, 1 Fruit and 1 Vegetable
- User_ID 10 already has 3 entries in his inventory for Category "Fruit"
- User_ID 10 is capturing a new "Fruit" entry, this fruit should be assigned an ID of 4
- User_ID 10 already has 1 entries in his inventory for Category "Vegetable"
- User_ID 10 is capturing a new "Vegetable" entry, this vegetable should be assigned an ID of 2
With this example, how can I know what the "start=?" ([auto_id start=?]) value should be for the current user, based on existing entries by Category "Fruit" or "Veg"?
There’s no way to do this they way you’ve designed your process without custom code. You’ll need to use either a custom shortcode that you write or the frm_after_create_entry hook (preferred method)
I was hoping there is a simpler solution which might've evaded me, but suspected that it might require bespoke development.
Thanks for the help!
Please login or Register to submit your answer