Jack Bua
Posts: 0
Joined: Sun Jun 28, 2015 10:16 pm

Service execute on each list item

in a JQM app, I have a list service that populates a list. For each list item, I would like to use that item's ID in a where clause for a service that is invoked. The second service will be used to retrieve all records related to each item in the list and sum a field in that list.

For example I have a list with 4 items, and each item has 5 "child" records (records that have its id in them) in another table, each with the value of 1 in the field I want to sum. The end result of what I am trying to do here is to display that sum, in this case 5, in each list item.

Image

I know this must be possible and would fall as custom JS logic, but I have spent days worth of hours trying to get there myself and am totally lost. Could someone just point me in the right direction please?

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

Service execute on each list item

Hello Jack,

Do you use pointers for that? If so you can get all items by only one request and sum all necessary items via JS,

Jack Bua
Posts: 0
Joined: Sun Jun 28, 2015 10:16 pm

Service execute on each list item

Yes I use pointers but I cannot see how that can help. I am not summing when dealing with the child values. I am summing with dealing with the parent values. To the best of my understanding, pointers only help point upwards in the structure.

What I am showing you in that mock screenshot is the list of parent values. for each value I want to run a service that looks at another collection and sums up all the values that point to the parent.

For example, using the mock screenshot I included above, for record A (second black box), I want to grab its ID (first black box) and search a separate collection for every record that has that ID in a pointer column, then display the results on that list item (in the red box). I then want to do that for record B and every other record.

I just need to know the code to put on the list item or the populating service to do that.

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

Service execute on each list item

We are very sorry, but custom code is something outside the scope (http://devcenter.appery.io/support-po...) of our support.

Jack Bua
Posts: 0
Joined: Sun Jun 28, 2015 10:16 pm

Service execute on each list item

I figured as much. This is very important for me to learn so I figured to ask anyways in hopes of an employee feeling generous or another community member being willing to share some of their knowledge.

Jack Bua
Posts: 0
Joined: Sun Jun 28, 2015 10:16 pm

Service execute on each list item

I would be willing to pay someone to get over this hurdle. If anyone knows they can answer this, please let me know.

Jack Bua
Posts: 0
Joined: Sun Jun 28, 2015 10:16 pm

Service execute on each list item

I relearned of my need for something like this. I am surprised that a need for this is not more common, so either a tutorial or documentation on this would be sorely needed, or I am searching for the wrong terms and the answer for what I seek is out there still.

Could someone point me in the right direction?

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

Service execute on each list item

Please run service on the each item via JS: https://devcenter.appery.io/documenta...

Jack Bua
Posts: 0
Joined: Sun Jun 28, 2015 10:16 pm

Service execute on each list item

I tried that before, but passing a where parameter along with the service execute and manipulating the data (counting and summing it) on success of the service seemed to be too difficult for me. If my memory serves me, I was only to get a limited test using this setup to fire the execute once, and that was for the first item in the list.

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

Service execute on each list item

There are no solutions. Please review your DB struncture if it is not acceptable to you

Return to “Issues”