Hi all,
in my ordering system, on admin screen where admin is responsible in updating order progress, I used a gallery to show a list of order, a timer to auto update my data source in SPL and a dropdown control with three values (Order Received, In Preparation, Delivery) to update the order progress. And it is users' responsibilities to set their order to Completed by clicking on a button.
I have a filter in my gallery where once orders are set to Delivery, it will disappear from admin view. And once the order is set to Completed by users, the order also will disappear from users' view.
Admin's view.
User's view:
However, I encountered a problem where seconds after order with Delivery disappear from this view, it will return back to this view but with Order Received status. Before this, it works just fine.
Here's what I have configured so far on admin view:
Gallery's Item property:
With(
{
orderSeq: SortByColumns(
Filter(
'Order Summary',
OrderStatus.Value <> "Completed" && OrderStatus.Value <> "Delivery"
),// Exclude 'Completed' (internal value 2) orders
"DateTime",
SortOrder.Ascending
)
},
ForAll(
Sequence(CountRows(orderSeq)),
Patch(
Index(
orderSeq,
Value
),
{RowNo: Value}
)
)
)
Timer:
Dropdown control:
Patch(
'Order Summary',
LookUp('Order Summary', OrderDateTime = Gallery3.Selected.OrderDateTime),
// Update the OrderStatus field
{OrderStatus: {Value: Dropdown2.Selected.Value}}
);
If(Text(ThisItem.OrderStatus.Value) = "Delivery", DisplayMode.Disabled, DisplayMode.Edit);
Notify("Status updated.", NotificationType.Success)
Text(ThisItem.OrderStatus.Value)
​
And this is what I put and configured on user's button to set their order progress to Completed:
Patch(
'Order Summary',
LookUp(
'Order Summary',
ID = Gallery2_1.Selected.ID
),
// Update the OrderStatus field
{OrderStatus: {Value: "Completed"}}
);
Notify("Order completed.",NotificationType.Success);
UpdateContext({varConfirmCompleted:false})
Please help me to find the root cause to this issue.
Hi @jcfDaniel ,
The issue has been solved. You were right, my OnChange and Gallery code somehow wasn't accurate. Thank you for pointing it out!
What I am saying is that at some point a completed item is changed back to received. This is your issue, right?
You need to find where that happens.
I would take a look at that on change on the dropdown. The filter on the order datetime seems thin.
I dont understand why would I need to patch back the Completed items to Received? I'm sorry, I'm so lost right now.
That looks fine.
You need to find where are your completed items being picked up and patched back to Received.
For dropdown, I only want to show Order Received, In Preparation and Delivery, That's why I filtered the dropdown items. And for gallery, I only want to show orders with Order Received and In Preparation only.
I can see that you changed the filter on statuses.
Still, that's not what creates the order, that picks up orders and gives them a number for processing.
Dropdown Items:
Filter(Choices('Order Summary'.OrderStatus), Value <> "Completed")
Gallery Items:
With(
{
orderSeq: SortByColumns(
Filter(
'Order Summary',
OrderStatus.Value = "Order Received" || OrderStatus.Value = "In Preparation"
),// Exclude 'Completed' (internal value 2) orders
"DateTime",
SortOrder.Ascending
)
},
ForAll(
Sequence(CountRows(orderSeq)),
Patch(
Index(
orderSeq,
Value
),
{RowNo: Value}
)
)
)
So the current flow brings an item from Received through completed and then back to received, right? Can you share the code that creates the item in the first place?
Yes, to both questions. Even when the order is set to Completed.
You say that items are brought back to Order Received status, right? So do these items ever make their way to the user's view?
Regards.
WarrenBelz
637
Most Valuable Professional
stampcoin
570
Super User 2025 Season 2
Power Apps 1919
473