Mar 07, 2024 11:49 AM
We manage a vehicle fleet and to make it easy for non-technical staff to add vehicles, I have created simplified interface forms with just the necessary fields (and some optional ones). This is great for adding one at a time, however often we will be adding multiple of the same vehicle. being comfortable with large sets of data myself, it's easy enough to just duplicate the record mulitple times in a grid view, however for users not comfortable with a grid view, is there a way for me to add a dropdown or number field or something to my interface form that will create a number of duplicates equal to the number provided in the dropdown/number field? Or is there another simple way to generate duplicate records? Thanks for any help in advance!
Solved! Go to Solution.
Mar 09, 2024 06:44 PM
The interface could be done with a single select field that had the possible number of vehicles one person can add (0-10). When the user selects that number, the automation would run that would create that number of vehicles. At the end of the automation, the last step would be to reset the single select field back to 0.
Using this approach you would need the following fields
The automation triggers on when {requested vehicles to add} changes and is not 0. (This is risky though. If someone accidentally changes the value the automation will run that many times. That is why I chose a two factor method in my original reply.). The automation makes the copy and at the end copies {vehicles left to add} to {requested vehicles to add}. This will trigger the automation to run again. *** This method does not account for 2 people trying to create duplicate vehicles at the same time ***
Mar 07, 2024 04:31 PM
Hmm...the simplest way would be with a script I think. A scriptless workaround would be:
1. Create a dropdown / number field
2. Create a formula field that'll output one comma separated item per step of that dropdown/number field
- E.g. If the dropdown has a value of "5", the formula field outputs "1, 2, 3, 4, 5"
- This does mean you'll have to hardcode it, but I can't imagine you'll ever be adding say, 30 of the same vehicle at once, and even up to 100 the formula's easy enough to write
3. Create a multiple select field
4. Create an automation that'll trigger when the Interface form is submitted, and its action will be to paste the value from the formula field into the multiple select field
- This enables you to use the multiple select field as a repeating group in your automation
5. Add a "Find Record" action to your step to find the record that you just updated
6. Use that "Find a Record"'s multiple select field value as a repeating group
7. Add a "Create Record" step to duplicate the initial submission
Should work! You can also create a table where each record represents one number, and have a multiple select field in that table with the appropriate number of options instead of the formula + update record action I mentioned above. We're just looking for weird ways to use repeating groups, really, so whatever works works
Lemme know if you could use an example!
Mar 07, 2024 06:04 PM
@TheTimeSavingCo and @wilkie -- This sounded like an interesting problem. I've added this feature into the book base that I've used in other examples here.
I use a checkbox and a number field.I use two fields so that an automation isn't accidentally triggered when the first digit of a 2 digit number is entered in the how many field.
In the base, I used 3 fields:
The automation checks to make sure that the number of books is > 0 and the box is checked. Then create a new record with the author of the book triggered the automation. If the number left to create is 0 then clear the checkbox.
You should be able to access the Titles base here
Mar 08, 2024 03:54 AM
Oh woah, this is great! Thank you very much for sharing this
I couldn't figure out how you were doing the count, but once it clicked I was like woah
This is going to come in really handy!!
Mar 08, 2024 05:23 AM
In theory @Dan_Montoya I could use a dropdown as suggested by @TheTimeSavingCo, or a field as you have done, and have the validation be done on that the dropdown/field isn't 0 in the same way you have used a checkbox? Want to keep the UI as simple as possible where I can 😅
Mar 09, 2024 06:25 PM
Hmm I'm finding it hard to visualize what you're saying, sorry. For what it's worth, I'd go with Dan's option as it's far easier to setup than mine and both options would requirey ou to have 3 new fields I think
Mar 09, 2024 06:44 PM
The interface could be done with a single select field that had the possible number of vehicles one person can add (0-10). When the user selects that number, the automation would run that would create that number of vehicles. At the end of the automation, the last step would be to reset the single select field back to 0.
Using this approach you would need the following fields
The automation triggers on when {requested vehicles to add} changes and is not 0. (This is risky though. If someone accidentally changes the value the automation will run that many times. That is why I chose a two factor method in my original reply.). The automation makes the copy and at the end copies {vehicles left to add} to {requested vehicles to add}. This will trigger the automation to run again. *** This method does not account for 2 people trying to create duplicate vehicles at the same time ***
Mar 10, 2024 02:21 PM
Hey @Dan_Montoya I see the value in the two factor, so have added it in! I have built the automation and it seems to work:
My fields are: Create Multiple Vehicles (Checkbox), Additional Vehicles (Number), Remaining Duplicates to Create (Formula: {Additional Vehicles}-1). I set up the automation to watch the Additional Vehicles field, and after each run it copies Remaining Duplicates to Create into Additional Vehicles:
I use the form to create a record (during which I check-on the Create Multiple Vehicles on the form and fill in Additional Vehicles with a number before saving). The automation doesn't seem to fire though, and only does as expected when I manually change the Additional Vehicles field, it doesn't seem to fire on record creation. Not sure why?
Mar 10, 2024 06:32 PM
Please show your "when" statement. By chance did you select a view there?
Mar 11, 2024 12:21 AM
I tried it with both, currently it is not watching a particular view, just a field (additional vehicles). Maybe that's why it's not firing, because the field is created and that's not a "change" as it never existed prior?