Hello everyone,
I have an issue when wanting to navigate or just go back.
I have a stock management app and the gallery sorts the item based on the lowest amount on top versus the highest on the bottom (screenshot attached). Sorting code is the following in case you need it:
Sort(
AddColumns(
Filter(
'Stock Management',
StartsWith(
Title,
TxtIn_AllProductsSearchBox.Text
) &&
(
Description = DpDwn_AllProducts.Selected.Result ||
DpDwn_AllProducts.Selected.Result = "All"
) &&
(
Status = "High" ||
Status = "Low" ||
Status = "Average" ||
Status = "Out"
)
),
"SortRank",
(Stock/Threshold)
),
SortRank,
If(
SortDescending1,
Descending,
Ascending
)
)
The problem I have is the following:
When I open a product to add or remove some stock (let's say I bought 5 so I'll add 5 to the current stock value with a Patch command). Once I validate, the stock changes higher or lower, which update the sorting of my gallery. The screen then automatically shift to another product: the one that falls now in the gallery position where the product I was editing was (that is not the same anymore since I changed the stock and then the sorting happened - follow me :)?.
Code of the "Save" button of my productdetail form:
Patch(
'Stock Management',
First(Filter('Stock Management',Name=Gallery_AllProducts.Selected.Name)),
{Stock:Value(Lbl_NewStockResult.Text)}
);
UpdateContext({Quantity: Blank()});
Reset(TxtIn_Qty);
Navigate(StockUpdatedScreen,ScreenTransition.Fade)
I have a quick workaround: I've created a simple screen "Stock updated Successfully" to which I navigate once I hit save - and then it as only one big button that navigates me back to the gallery...
Code of the Stock updated successfully button:
Navigate(ProductsScreen,ScreenTransition.Fade)
What I would like is:
To keep the "Stock updated Successfully" screen (cause it's nice), but once press its button, that it takes me back to the product I was editing... Knowing that, I have 2 galleries on the same screen that show 2 categories of products (I hide/unhide galleries with a button).
Thank you in advance everyone! Hope we get some good findings!