Skip to main content
Community site session details

Community site session details

Session Id : RhIVzuM8N9qUpbS2OGuJZW
Power Apps - Building Power Apps
Answered

PowerApps App is displaying old values where actual values are Null

Like (0) ShareShare
ReportReport
Posted on 5 Dec 2019 14:16:29 by 894

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?

  • Verified answer
    stapes Profile Picture
    894 on 10 Dec 2019 at 15:04:03
    Re: PowerApps App is displaying old values where actual values are Null

    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});

  • stapes Profile Picture
    894 on 10 Dec 2019 at 14:38:05
    Re: PowerApps App is displaying old values where actual values are Null

    Hi v-siky-msft

     

    I tried converting my form to use a new collection.

    I am getting it at the OnVisible stage:

        Clear(itemCollection);
        ClearCollect(itemCollection, ViewGoodsInDetailItemByID.Run(SelectedItem.ID)); Set(Selection,

        First(itemCollection));UpdateContext({Tab1:true});UpdateContext({Updated:false});

     

    My fields have this in the Default Data:

        If(IsEmpty(Selection.ActualQtyDelivered)||IsBlank(Selection.ActualQtyDelivered),

            0,

            !IsEmpty(Selection.ActualQtyDelivered),Selection.ActualQtyDelivered)

     

    But it makes no difference. It is still displaying values from the last data I input on a completely different record!

     
  • stapes Profile Picture
    894 on 10 Dec 2019 at 09:20:52
    Re: PowerApps App is displaying old values where actual values are Null

    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.

  • v-siky-msft Profile Picture
    on 10 Dec 2019 at 03:30:09
    Re: PowerApps App is displaying old values where actual values are Null

    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

  • stapes Profile Picture
    894 on 09 Dec 2019 at 15:16:06
    Re: PowerApps App is displaying old values where actual values are Null

    Here is another example.

    1) Values displayed on screen:

    POR029667.png

     

    The values displayed for Number of Pallets, Pallet Type and stBinLocation are all garbage!

    The flow picks up these values from the database correctly:

    noPalletsPalletType.png

    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.

     

     

     

     

  • stapes Profile Picture
    894 on 09 Dec 2019 at 12:31:11
    Re: PowerApps App is displaying old values where actual values are Null

    I have not solved this issue. Whether the correct values get displayed on screen seems to be totally random.

     

  • stapes Profile Picture
    894 on 06 Dec 2019 at 15:28:26
    Re: PowerApps App is displaying old values where actual values are Null

     

     

  • stapes Profile Picture
    894 on 06 Dec 2019 at 14:31:57
    Re: PowerApps App is displaying old values where actual values are Null

    Thank you v-siky-msft

    This is driving me nuts.

     

    SelectedItem is an Object that is passed from the previous screen.

    All the other fields on my screen are populated from this object.

    As you can see they are all populated.

    Except that Actual Qty Delivered in this case is actually set to 0 (Zero) in the database!

    Here is the data - from the Flow:

    response-from-flow.PNG

     

    screenshot.PNG

     

  • v-siky-msft Profile Picture
    on 06 Dec 2019 at 07:09:21
    Re: PowerApps App is displaying old values where actual values are Null

    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

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 637 Most Valuable Professional

#2
stampcoin Profile Picture

stampcoin 570 Super User 2025 Season 2

#3
Power Apps 1919 Profile Picture

Power Apps 1919 473

Loading started
Loading complete