Add new records from deck

Hi there !
I have a โ€œdeckโ€ from which the user can select based on a photograph and a brief description of a package, that is, a group of records from that same table, which make up a promotion, (could be more than 15) and I would like to โ€œselectโ€ that record from the deck the emptying of records from the package table is generated (selected package) and the new records are generated in the inventory movement table, however โ€ฆ

things that I didโ€ฆ

  1. I select the โ€œACTIONโ€ that I put in the deck and it is generated but only the first record of the package in the inventory movement table, it does not do it with all records of the package โ€ฆ

  2. try to do it with a workflow, when modifying something in the registry, however I can only generate one registry in my inventory movement table, the one that I modify myself, but I need to do the same with all the registries that make up the package !!!

  3. During the night, I have โ€œREPORTSโ€ that are executed automatically and that generate records, in this case assortment orders according to the sales of the day โ€ฆ
    How to make a report run whenever I want โ€ฆ? when selecting a record, when marking it, with an ACTION
    And to read only the marked records to generate the new ones in the inventory movement table?

This third is I think the one that is closest to what I need, but Iโ€™m stuck, any ideas?

Thank you all for reading and your comments โ€ฆ


Solved Solved
0 6 611
1 ACCEPTED SOLUTION

Your formula for the โ€œAdd more rowsโ€ action should be targeting the Inventory table.

select(Inventory[Item ID], [PAQ ID]=[_thisrow].[PAQ ID])

[PAQ ID] is the column from your Inventory table
[_thisrow].[PAQ ID] is the column from your PAQ table.

This formula produces a list of rows from the inventory table. AppSheet then executes the Action: โ€œAdd one rowโ€ on each row in the list.

View solution in original post

6 REPLIES 6

Just to check my understanding:
You want the user to select a record from a deck view that represents a group of items in a promotion; this promotion is a single record in the same table with multiple items. When they click on that promotion, the app should copy all items in that promotion to an inventory movement table.

I think the missing piece is you need to consider the Action: โ€œData: Execute an action on a set of rowsโ€.

  1. Create an action: โ€œData: โ€œadd a new row to a table using values from this rowโ€ and associate it with the promotions table. This will copy a item from the promotions inventory movement table. (Note this simply is an action that can copy a row from one table to anotherโ€

  2. Create an action: โ€œData: Execute and action on a set of rowsโ€, which would be associated with your promotions table, and the โ€œreference tableโ€ is the promotions table as well. The formula you enter should be a select query which pulls up a list of Primary Keys relevant to that promotion in the promotions table. Then the referenced action will be the action created in step 1.

At this stage you have created an action that you can show for any promotion item. When the action is triggered it will look up the list of items that are relevant to that promotion and apply the copy action to each of those items from the promotion table to the inventory movement table. You can attach this action to a workflow or form save event as well to get the desired behavior.

@Rich Thanks for your guidance and such a good explanation โ€ฆ

I found this article that @steve made very detailed too โ€ฆ

I did what you suggest me in the app Iโ€™m working on and I couldnโ€™t get it to work, I thought it was something in the app, that it was making this hard to work and I made a new app with just two tables so there would be no other things that interfere.

In this new app, I have not been able to make it work either โ€ฆ

It is the same idea, two tables, one with the PAQ promotions and the other with INVENTORY inventory movements.

  • It only generates one record in the INVENTORY table, where it should generate all the records that belong to that promotion [PAQ ID]

  • When editing in the PAQ_form form, where I put (I also tried it with APPEARANCE display prominently)
    For each row to add, do this โ€ฆ
    Add more rows

  • And when editing with the form, it will be very useful for me when you want several promotions, but the PAQ_form form always puts zero in QTY โ€ฆ

https://www.appsheet.com/Template/AppDef?appName=addrows-261468&quickStart=False#Manage.Author.TeamW...
If you cannot see the app, please notify us to correct what is needed ,

I will greatly appreciate your help โ€ฆ
I send you photos and I share the app, the tables are google drive are already shared โ€ฆ


Your โ€œadd one rowโ€ action should be for the Inventory table and copy to the the same inventory table.

The action โ€œAdd more rowsโ€ reference should be the Inventory table. This tells the where to to target. Logically this means:

  1. Start in PAQ table
  2. Then I am going to trigger an action in this the Inventory table
  3. I am going to apply the action to these primary keys records in the Inventory table.
  4. I will apply the action โ€œadd one rowโ€ to each of the records I found.

Then AppSheet executes the add one row action to each record that is calculated from the Referenced rows formula.

You do not need the grouped action called โ€œfor each row to add do thisโ€.

On form save just trigger the โ€œAdd more rows actionโ€

thanks for your prompt reply @Rich

I did a lot of tests based on what you say (and what I knew) and now I am more confused โ€ฆ I think that something in the translation I do not understand โ€ฆ or there is a bugโ€ฆ

I will put into words and the same is the app that I modify according to what I understood from your instructions โ€ฆ

  1. the ACTION โ€œโ€ for each row to add do this โ€ฆ "will not be needed, delete it โ€ฆ

  2. On form, i save just trigger the โ€œAdd more rows" โ€ฆ action โ€

  3. On Action "Add more rowsโ€ Data: add a new row
    in reference table, remove PAQ and put INVENTORY
    For a record of this table- remove PAQ and put INVENTORY

  4. On Action โ€œadd one rowโ€ Data: execute an action on a set of rows
    in -This table- remove PAQ and put INVENTORY

It could be โ€œreference rowsโ€ ? (i tested with some and nothing)
select(PAQ[_computedkey], [PAQ ID] = [_thisrow].[PAQ ID])

As I said before, I am more confused, please help!

It does not generate a single record, and I am in doubt โ€ฆ

To generate the new record (point # 3) where you will get the values โ€‹โ€‹that are in the PAQ table like the [PRICE] [DISCOUNT] and [QTY], I would suppose I would put them in [CTD] = [QTY], but โ€ฆ ?

the above has to do with this โ€ฆ
When the client wants several promotions, he could put how many in the PAQ table !
how would it be done!

Your formula for the โ€œAdd more rowsโ€ action should be targeting the Inventory table.

select(Inventory[Item ID], [PAQ ID]=[_thisrow].[PAQ ID])

[PAQ ID] is the column from your Inventory table
[_thisrow].[PAQ ID] is the column from your PAQ table.

This formula produces a list of rows from the inventory table. AppSheet then executes the Action: โ€œAdd one rowโ€ on each row in the list.

Thx, it works !

Top Labels in this Space