Create Multiple Rows in Table from a ADD Form Values

Hi,
Am Trying to recreate an Application from Appmaker and coming across many Problems.
In the present scenario:
Want to Populate a Table with multiple Rows of Data From a ADD FORM.
in which case most of the Fields should be the same apart from some.

Any suggestions will be very much appreciated !!

Thanks in advance

0 12 3,082
12 REPLIES 12

This is possible with form onsave events or workflow rules / api calls.

The benefit to workflow rules is they are more flexible / customizable and in some ways reliable than onsave or in app actions.
The downside to workflow rules is they occur in the background and therefore no immediate indication that they have worked is given to the user.

If you could provide some more information about your form, how you plan to indicate how many rows it should add, and how to differentiate between the rows, I could offer more advice.

Hi Jonathon,
Thanks for your Reply.
I have FORM with fields in the Form:

Id (Auto)
COD (NUMBER)
NAME (STRING)
START DATE (DATE)

OFICINA( This is a multiselect from TABLE OFICINA)

ZONE (DROPDOWN FROM TABLE ZONE)
AREA (DROPDOWNFROM TABLE AREA )
PROYECT(DROPDOWN FROM TABLE PROYECT)
CLIENT (DROPDOWN FROM TABLE CLIENT CLIENT )
OBSERVACION (TEXT FIELD)
ORDER_BY(EMAIL OF THE PERSON CREATING- INSERT AUTO).

Now the objective is:
USER CAN SELECT from multiselect FIELD OFICINA x No of OFICINA (eg. VALENCIA, MADRID, BARCELONA)
and fill rest of the Fields.
ON CREATE, POPULATE new ROWS in TABLE SUBPROYECTOS depending on the no of values selected in OFICINA.
REPETE all the Values in Rows expect the field OFICINA which will change on multiselect values.

Hopefuly I was able to explain properly.

You might also check out the โ€œAdd a row to another tableโ€ action

Here is one user friendly way of achieving this. In a nutshell you will:

  • Create form_RowGen[1] actions which copy the record but select singular OFICINA() items
  • Put them in a grouped onsave action

Here is the app definition:

Feel free to copy the above sample and play around with it.


One obvious limitation of this method is you need to have at least as many form_RowGen[#] actions as your users will be expecting to generate in one go. Worst case scenario is you would need a new rowgen action for each โ€˜Oficinaโ€™ option.

I can think of a possible way around this by using an โ€˜execute action on set of rowsโ€™, where you SELECT() from the Oficina table and run against those rows, but I donโ€™t have time to test it right now.

Thanks a lot Jonathon,
I will try to follow your example.
Greetings from Spain

Hello, if I select two option from oficina i.e. velencia and madrid and what if i want the value of zone to be different for both the value and rest being the same, how can this be done.
Thanks in advance

Hi @Jonathon, I've been able to modify your solution to make it run recursively without having to create actions for each row.

This is how I did it:

In the main grouped action, have three actions like so:

  • form_onSave
    • Min01_0-1702409534971.png
  • add item - adds the first item in the list in the original row to a new row. This is the same as your action form_RowGen[1].
  • pop item - removes the first item of the list in the original list
    • Select Data: Set values of some columns in this row and update the OFICINA column with this formula: [OFICINA] - List(Index([OFICINA],1)).
  • Recursion - go back to the form_onSave
    • Select Data: execute action on a set of rows
    • Set Referenced rows to LIST([_THISROW])
    • Set referenced action to form_onSave
    • Set behaviour condition to Count([OFICINA])>1

This keeps looping until there is only a single item in the original row.

Here's a link (but I might have to take it down at some point, hence the description of the changes).

https://www.appsheet.com/template/appdef?quickStart=True&appId=9b3a8691-85a6-4dd7-8ff4-ab243413c4b0&...

Hi Min01,

Just tried your solution, and it works very nicely! Had the same issue you had described elsewhere with the behavior of the 'save' button of the form, and that took me like an hour to understand:-D

Of course, now I am thinking: "What if I now want to adjust the three rows of 'OFICINA' I just created rows for, and let's say, only use two of them?"

My method doesn't hardcode the number of rows created so if you only select two values in Oficina, it will only create two rows.

Hi,

First of all thank you for your solution. It works very well and is quite simple to transpose.
However, I have a problem, I do not have the values โ€‹โ€‹of all my columns which are copied. Do you have any idea where the problem could be coming from?

Regards,

Do you know which ones are not getting copied? Is it the first, last, or random ones in the middle. If it's the first or last, my guess is it's caused by a bug in the loop condition.

Hi,

I've solved  the problem, i add the colmun that didn't copy in the "Add Item". It works very well, need to deploy the app to see if it still work well with multiple users editing the table. Thank you.

Francois_3340_0-1710315381373.png

 

Top Labels in this Space