Not all values showed up

Hi,

What I want to achieve is for the Delivery Status to show how many items have been delivered out of the total ordered items (e.g. 1 of 5 delivered, 4 of 5 delivered, All Items Delivered).

While I'm making some progress now, I wasn't able to show the Delivery Status for the subsequent order correctly.

For information purpose, when the Delivered button is clicked (value = 1), the Delivery Status of the Item will be changed to 1. So, if there are 5 items, and each of the value is 1, then the Sum would be 5. When the Sum matches the Count of Items, Delivery Status = All Items Delivered, otherwise 1 of 5 delivered, 4 of 5 delivered, etc.


As you can see, Delivery Status for Order From Client B should be 2 of 3 Delivered. But it doesn't show up. There must have been one crucial part that I didn't include (ListFilter, ForEach?)

Thank you.

Hi,

What are you using in "Delivery Status" column? SQL query value? An expression with function? A webblock?

Can you share the logic of that?

Thanks

Solution

Hello Vincent,

What you want is easily done with a more or less simple aggregate.

Join Orders and Items. Create a calculated field in the aggregate with a condition (if) based on the item status. If the status is delivered, return 1, otherwise, return 0. Now, group by all attributes from the Orders that you want to show or use, like id, etc. Create a count in a non null column (like orders or item id). This is the number of items. Apply a sum in the calculated field. As this field value is 1 only for delivered items, the sum will return the number of delivered items.

Now you have all the info to show in the table.

Cheers

Solution

Eduardo Jauch wrote:

Hello Vincent,

What you want is easily done with a more or less simple aggregate.

Join Orders and Items. Create a calculated field in the aggregate with a condition (if) based on the item status. If the status is delivered, return 1, otherwise, return 0. Now, group by all attributes from the Orders that you want to show or use, like id, etc. Create a count in a non null column (like orders or item id). This is the number of items. Apply a sum in the calculated field. As this field value is 1 only for delivered items, the sum will return the number of delivered items.

Now you have all the info to show in the table.

Cheers

Hello Eduardo,

Thanks for your suggestion. It works! Plus, your approach is simpler and straight-forward than what I had worked on earlier (I was even thinking of using ForEach OrderID, go through each line in the Items table, check whether the Delivery Status = 0 or 1, then if it's 1, add it to the NumberOfItemsDelivered local variable, then use it together with the count of Items which will be grouped by OrderID).

The output from your suggestion: