My Power Apps app is showing old values from a previous record where the current values are NULL.
This is totally unacceptable!
In all cases I have set Reset to true.
In all cases I have set Default Data to a formula like:
If(!IsBlank(SelectedItem.ActualQtyDelivered)||!IsEmpty(SelectedItem.ActualQtyDelivered),
SelectedItem.ActualQtyDelivered,
"")
My record is loaded in the OnVisible action of the screen:
UpdateContext({Tab1:true});
If(!IsBlank(SelectedItem.thOurRef)||!IsEmpty(SelectedItem.thOurRef),
ClearCollect(itemCollection,UpdateGoodsIn.Run(SelectedItem.thOurRef, SelectedItem.stCode)));
If(IsBlank(SelectedItem.thOurRef)||IsEmpty(SelectedItem.thOurRef),
Notify("No record selected", NotificationType.Error));
UpdateContext({Updated:false});
How do I get it to display the correct values?
What seems to have cured it is putting explicit resets in for each screen field.
Reset(txtActualQtyDelivered);Reset(dtDateDelivered);Reset(chbDeliveryAccepted);Reset(txtNumberOfPallets);Reset(chbPallletCondition);Reset(txtPalletType);Reset(txtBinLocation);Reset(txtProductStateTemp);Reset(dtExpiryDateChilled);Reset(dtExpiryDateFrozenFromChilled);Reset(txtConditionOfPack);Reset(chbVisualSpecCheck);Reset(chbRawMeatSpecCheck);Reset(chbHygeneOfDeviveryVehicle);Reset(chbCofACofCReceived);Reset(txtComments);Reset(txtWarehouseApprover);Reset(txtBatchCodes);Reset(chbExtraChecks);
Clear(itemCollection);
ClearCollect(itemCollection, ViewGoodsInDetailItemByID.Run(SelectedItem.ID)); Set(Selection, First(itemCollection));UpdateContext({Tab1:true});UpdateContext({Updated:false});
Hi
I am getting my record in a previous screen. I get the collection here:
(Screen OnVisible property):
Clear(detailCollection);
Set(LoadingSpinnerVisibility,true);
ClearCollect(detailCollection,GoodsInDetail.Run(SelectedOrder.thOurRef));
Set(LoadingSpinnerVisibility,false);
That collection is the Datasource for a Gallery:
SortByColumns(detailCollection,"QtyOS",Descending)
The rows in the gallery have a select icon. On Select:
Set(gvLastScreen,Screen3_OrderDetailV2);
Navigate(Screen4_OrderItemV2, None,{
SelectedItem: galOrderDetails.Selected,
OrderRef: SelectedOrder.thOurRef
});
This way, SelectedItem is passed to the Item screen.
Hi @stapes ,
How did you get the SelectItem? You saved the return of flow into a collection, so you have first to assign the first record of collection to SelectItem variable. Just append Set(SelectItem, First(Collection)) to OnVisible property of Screen.
Then you can try to modify Defaults property of fields as below:
If(IsBlank(SelectedItem.NumberOfPalletsReceived),"", SelectedItem.NumberOfPalletsReceived)
If(IsBlank(SelectedItem.PalletType),"",SelectedItem.PalletType)
If(IsBlank(SelectedItem.stBinLocation),"",SelectedItem.stBinLocation)
Best regards,
Sik
Here is another example.
1) Values displayed on screen:
The values displayed for Number of Pallets, Pallet Type and stBinLocation are all garbage!
The flow picks up these values from the database correctly:
The Data Default Formula for these fields:
If(IsEmpty(SelectedItem.NumberOfPalletsReceived),"",!IsEmpty(SelectedItem.NumberOfPalletsReceived),SelectedItem.NumberOfPalletsReceived)
If(IsEmpty(SelectedItem.PalletType),"",!IsEmpty(SelectedItem.PalletType),SelectedItem.PalletType)
If(IsEmpty(SelectedItem.stBinLocation),"",!IsEmpty(SelectedItem.stBinLocation),SelectedItem.stBinLocation)
If I type anything at all in these fields in the edit screen, it corrects itself.
I have not solved this issue. Whether the correct values get displayed on screen seems to be totally random.
Thank you
Hi @stapes ,
Could you share more detail with your scenario? What is "SelectedItem"? How does it from?
If it is variable, your formulas will only show the selecteditem's value(previous). If you want to show current record value, you should pass the current record to Variable "SelectedItem". Please modify the Onvisble code as below:
UpdateContext({Tab1:true});
If(!IsBlank(SelectedItem.thOurRef)||!IsEmpty(SelectedItem.thOurRef),
ClearCollect(itemCollection,UpdateGoodsIn.Run(SelectedItem.thOurRef, SelectedItem.stCode)));
If(IsBlank(SelectedItem.thOurRef)||IsEmpty(SelectedItem.thOurRef),
Notify("No record selected", NotificationType.Error));
UpdateContext({Updated:false});
Set(SelectItems, First(itemCollection))
If this doesn't make sense or i misunderstand , please let me know and share more details.
Best regard,
Sik
WarrenBelz
637
Most Valuable Professional
stampcoin
570
Super User 2025 Season 2
Power Apps 1919
473