advanced slice

Hi all. I have a doubt.

I have a budget application, when I create a budget it is done in two stages.

The first stage prepares the same from a table called "configuration budget". In this table I configure some things such as VAT, whether or not it has any additional charge, work zone and other parameters that affect direct costs.

Every time I create a budget with this table (assigned to a client and a particular job) a unique Id is created that identifies it.

The other part of the budget is the direct costs, which are nothing more than a table that is loaded from another table that contains a large list of available items that the user can choose and add with a behavior action button. The chosen items are loaded into the "slice direct costs" table.

The user can only see his uploaded records, but I am missing one thing.

How can I make the values โ€‹โ€‹loaded by the user in the slice to be loaded with the id of the generated budget and not without it?

I need this because when I want to generate a report I must be able to discriminate the items belonging to said budget and not all of them.

Thank you for your attention

Solved Solved
1 5 139
1 ACCEPTED SOLUTION

Ok, I assume then what you are trying to achieve is a way for users to quickly select the costs, from a list and have the chosen records attached to the Budget.  As opposed to adding child records one-by-one.

This can be done and I use it all the time but it is a bit difficult to explain and a little complicated to understand.

The idea is this:

1)  Provide a selection list on your Budget entry Form - an EnumList with base type of Ref to your "direct cost" table.  User will multi-select all the cost items.

2)  Walk this list picking off each selected item to add a new row to your separate Budget Direct Costs table

@Steve did a great job of explaining this "walking the list" process in this post:

https://www.googlecloudcommunity.com/gc/Tips-Tricks/Add-any-number-of-rows-from-any-row-within-a-tab...

NOTE: the post above has expandable text at the bottom to get more details!!

 

You will want to make a couple modifications - instead of using a count to control when to stop, use the list itself.  Stop when the list has no more items in it.

As you iterate through, pick off the first list item, add the new row for that item with the Budget ID, then remove this item from the list ...repeat!

You end up with an empty pick list and your Budget Direct Cost table with all the properly linked cost items.

I'm sure you will have questions.  Study the above post and then come back with your questions.

View solution in original post

5 REPLIES 5

There are several ways to handle this.   How do want the "direct costs" to display in the app - as a list or in a table? 

Hola WillowMobileSys


I want the direct costs to be displayed in a table that is associated with the budget, already generated, because the table has useful information for the user, while the list only has the labels.

Ok, I assume then what you are trying to achieve is a way for users to quickly select the costs, from a list and have the chosen records attached to the Budget.  As opposed to adding child records one-by-one.

This can be done and I use it all the time but it is a bit difficult to explain and a little complicated to understand.

The idea is this:

1)  Provide a selection list on your Budget entry Form - an EnumList with base type of Ref to your "direct cost" table.  User will multi-select all the cost items.

2)  Walk this list picking off each selected item to add a new row to your separate Budget Direct Costs table

@Steve did a great job of explaining this "walking the list" process in this post:

https://www.googlecloudcommunity.com/gc/Tips-Tricks/Add-any-number-of-rows-from-any-row-within-a-tab...

NOTE: the post above has expandable text at the bottom to get more details!!

 

You will want to make a couple modifications - instead of using a count to control when to stop, use the list itself.  Stop when the list has no more items in it.

As you iterate through, pick off the first list item, add the new row for that item with the Budget ID, then remove this item from the list ...repeat!

You end up with an empty pick list and your Budget Direct Cost table with all the properly linked cost items.

I'm sure you will have questions.  Study the above post and then come back with your questions.

I have to take the time to thank you for paying attention to me and also for the precision of your answer. You knew how to lead me to the perfect case. It's what I needed. Yes, it deserves study because it is an advanced technique (although it can also be copied and edited in certain cases).

I think that it is not the best way for my App after reviewing the case for me. Copying a record from one table to another greatly affects the sync of the App in about 1 second per record. If I have to update or add 200 records, the user will believe that the App no โ€‹โ€‹longer works. I need to do this in a more practical way.

One of the solutions I have thought of is:

Have a Budget form where you can register each budget made and that said budget has a unique ID. Below the form, find an action button that takes me to a common list with records to choose from.

The original one-column table available with a "+" sign that allows me to set an add action on it. This table is common to all users.

The "Add" action allows me to add a record to a Direct Cost table. As this table has a Budget Id column, all loads will have the budget Id of the budget in question and, as the budget is a slice for each user, no user will be able to access data from others.

Once the Direct Costs table is created, which will not be directly visible, I should have another table in which I can select the budget that I want and be able to make calculations in it by adding amounts to the records loaded from that budget, to finally have a value to deliver through a report to the client.


@Gustavo_Eduardo wrote:

I think that it is not the best way for my App after reviewing the case for me. Copying a record from one table to another greatly affects the sync of the App in about 1 second per record. If I have to update or add 200 records, the user will believe that the App no โ€‹โ€‹longer works. I need to do this in a more practical way.

Actually this part is not entirely accurate.  Note that there probably actually 3 copies of all tables at any given time - the datasource itself, on the server AND on the the users device.  The updates made by actions activated by a button or on a Form Save, will happen directly on the users device and show almost instantaneously - even if it was adding 200 records. 

Of course, if the implemented processing is complex OR there are a significantly larger number of rows, yes there could be some slowness the user perceives.  But Syncing would not be involved and any perceived slowness is highly unlikely in normal circumstances.

What does take time is the submission of those edits into server and then into the datasource to be made available to other users.  The OTHER users will need to Sync to see the new rows but they would need to do so anyway whether it was 1 row or 1000 rows.  Again, under normal circumstances the Sync should see no abnormal slowness based on the new rows added.

In the end, you have to provide the design that works best for you and your users.  You know your app better than any of us could.

Top Labels in this Space