web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / LoadData Function not ...
Power Apps
Unanswered

LoadData Function not responding properly

(0) ShareShare
ReportReport
Posted on by 16

Hi

 

I am currently trying to build an offline solution for my app using the SaveData/LoadData functions. The logic I am using is that once a button gets pressed its patches the collection with boolean values in turn changing its display mode from edit to disabled. 

 

The concept works perfectly on the normal flow of the app, however, once I exit the app and the on start function loads the saved data from the collection, the displayed modes are maintained and the patch function stops working. 

 

I have been trying to fix this for the last 4 days and it's driving me insane... please someone help

 

 

 

OnStart: 

LoadData(HomeButtonHistory,"HomeButtonHistory_Saved",true);

 

Collection: 

 

Collect(HomeButtonHistory,{ID:ThisLog_Id,DB_Button_Home:true,STS_Button_Home:false,LWA_Button_Home:false,STC_Button_Home:false,STL_Button_Home:false,TBox_Button_Home:false});

 

Button Display mode: I have created a gallery linked to the HomeButtomHystory which I use to reference the status of the buttons)

 

 If(Button_Gallery.Selected.LWA_Button_Home=true,DisplayMode.Edit,DisplayMode.Disabled) 

 

Button OnSelect: 

 

Patch(HomeButtonHistory, LookUp(HomeButtonHistory,ID = ThisLog_Id) , {LWA_Button_Home:true, STC_Button_Home:false});

 

Thank you all in advance

 

RN

 

 

Categories:
  • Pstork1 Profile Picture
    69,661 Most Valuable Professional on at

    So I see the LoadData() in oNStart, but where in your app are you doing the SaveData()

  • RNazareth Profile Picture
    16 on at

    Hi Pstork,

     

    Thank you for the reply.

     

    I have currently wired the save data function throughout multiple screens after a button is pressed. 

     

    Button On Select: 

    Patch(HomeButtonHistory, LookUp(HomeButtonHistory,ID = ThisLog_Id) , {LWA_Button_Home:true, STC_Button_Home:false});

    SaveData(HomeButtonHistory,"HomeButtonHistory_Saved")

     

    Thank you once again to taking the time to assist.

     

    RN

  • Pstork1 Profile Picture
    69,661 Most Valuable Professional on at

    Are you testing on a Mobile app, Using a Web Browser, Or using Preview?

     

    LoadData and SaveData only work on Mobile devices by default.

    There is a preview feature that can be turned on to enable it in a Browser session.

    Even with the feature enable it still doesn't work in Preview mode in the studio.

     

    I tried something similar in a Mobile app and it works fine for me.

    OnStart

    LoadData(HomeButtonHistory,"ButtonSave",true);

    Button OnSelect

    Patch(HomeButtonHistory,LookUp(HomeButtonHistory, ButtonName=Self.Text),{ButtonName:Self.Text,ButtonStatus:false});SaveData(HomeButtonHistory,"ButtonSave");

    Button DisplayMode

    If(LookUp(HomeButtonHistory,ButtonName = Self.Text).ButtonStatus,DisplayMode.Edit,DisplayMode.Disabled)
  • RNazareth Profile Picture
    16 on at

    Hi,

     

    Once again thank you for the reply! 

     

    I have been testing the load data on an Ipad/phone apps. But still no solution

     

    The collection and patch functions are all working as they should, however, once the data is loaded the buttons do not respond.

    Below there a few screenshots.

    Collection 

    RNazareth_0-1637010435026.png

    From the app

    RNazareth_1-1637010636208.png

     

    LWA Button Display mode: If(LookUp(HomeButtonHistory,ID = ThisLog_Id).LWA_Button_Home,DisplayMode.Edit,DisplayMode.Disabled)

     

    What am I doing wrong!!!?!??!

     

  • Pstork1 Profile Picture
    69,661 Most Valuable Professional on at

    Where are you getting the ID from that you are using in the Lookup?  Are you sure the Lookup is returning the value?  That's why I keyed my sample off the Text of the button label.  Buttons don't have an ID property that I'm aware of.

  • RNazareth Profile Picture
    16 on at

    Hi

     

    The Id is being generated at the On start -  Set(ThisLog_Id, GUID()); 

    From there I add it to my collections as a unique reference...

     

    I have also checked the lookup and it is correct...

     

    RNazareth_0-1637015220943.png

    Honestly, it's good that there are no bridges near me... I am almost ready to jump off one!! 🙂 

  • Pstork1 Profile Picture
    69,661 Most Valuable Professional on at

    I get the placement of the ID in the collection.  But what ties that ID to the specific Button?  The idea is to lookup a reference for a specific Button.  But I don't see anything that ties that button to the record in the collection.  As I said, if you look at the example I did the Button.Text is added to the collection.  So by using the text of the button I can retrieve a specific record in the collection for that Button.  So I suspect the problem may be that after you re-load the connection the lookup doesn't relate to a specific button so the button doesn't change.

  • RNazareth Profile Picture
    16 on at

    Hi,

    Please accept my apologies in advance, but please bear with me, I have no IT background and I am learning all of this through videos and posts from people like your good self.  

    My collection refers to the button name, status, and ID for a particular login. Is that not the requirement of a lookup function?

    Collect(HomeButtonHistory,{ID:ThisLog_Id,DB_Button_Home:true,STS_Button_Home:false,LWA_Button_Home:false,STC_Button_Home:false,STL_Button_Home:false,TBox_Button_Home:false});

    The lookup function returns the status as per my previous post. However, if the data is loaded (on a device) the function 

    If(LookUp(HomeButtonHistory,ID = ThisLog_Id).LWA_Button_Home,DisplayMode.Edit,DisplayMode.Disabled)

    Does not work!

    Am I using the lookup incorrectly? 

     

  • Pstork1 Profile Picture
    69,661 Most Valuable Professional on at

    Its OK if you aren't a programmer.  That's why we're here to answer questions. But to be able to use the Lookup to set the displayMode of a particular button there has to be something that ties that button to the setting.  So if you look at my example

     

    If(LookUp(HomeButtonHistory,ButtonName = Self.Text).ButtonStatus,DisplayMode.Edit,DisplayMode.Disabled)

     

    Lookup checks the HomeButtonHistory for the first record where the ButtonName stored in the record is equal to the Text used on the button (self.Text).  If ButtonStatus in that record is True then DisplayMode is Edit.  Otherwise its Disabled.  In your example you are comparing ID, which is a field in the Collection with ThisLog_Id which is a value in the collection.  Nothing ties that record to the Button.  So it doesn't know which button to apply the DisplayMode to.

     

  • RNazareth Profile Picture
    16 on at

    Hi, 

     

    Still no success, but being honest (running the risk of coming across weirdly) I cannot grasp how my solution -using a unique ID value to identify a role within the collection would work during the normal operation of the app and when the data is loaded it would not. 

    I can see the data being loaded but the button display mode does not respond to the new data...

    I dont know what do to do to explain it better....

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 402 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 328

#3
WarrenBelz Profile Picture

WarrenBelz 296 Most Valuable Professional

Last 30 days Overall leaderboard