cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
AVTS
Post Partisan
Post Partisan

Collections Data automatically cleared

Experts,

 

I am trying to save the screen input in to the collections mamo1. and then its save in to the localcache(MyLocalData1).

 

Below code code is working fine.

 

 

Collect(
mamo1,
{
HTTP_Body: Label9_2.Text,
HTTP_Body_1: Label8_6.Text,
HTTP_Body_2: Label17_8.Text,
HTTP_Body_3: Label17_6.Text,
HTTP_Body_4: Label17_8.Text,
HTTP_Body_5: Label17_7.Text,
HTTP_Body_6: TextInput1_12.Text,
HTTP_Body_7: Label18.Text
}

);

 

SaveData(
mamo1,
"MyLocalData1"
);

 

 

 

Below code copy the localdata(MyLocalData1) to collections pe4.

 

 

ClearCollect(pe4,
    {
        HTTP_Body: ""},
        {HTTP_Body_1: ""},
        {HTTP_Body_2: ""},
        {HTTP_Body_3: ""},
        {HTTP_Body_4: ""},
        {HTTP_Body_5: ""},
        {HTTP_Body_6: ""},
        {HTTP_Body_7: ""}
    
);
SaveData(pe4,
    "MyLocalData1"
);


LoadData(
    pe4,
    "MyLocalData1"
);

 

My issue is.

I can insert data into collections mamo1 that are kept in localcache (Mydata1). and it was appropriately transferred to collections pe4. If the program is closed and reopened while attempting to insert data, the old localcache data is erased. Only fresh data appears in the collections.

 


Actually, I want both data( local cache data and newly entered data) should be appear in the collections pe4.

 

Whats wrong with this code.i have tried with many ways but unable to crack the issue.

 

please advise.

1 ACCEPTED SOLUTION

Accepted Solutions
WarrenBelz
Super User
Super User

Hi @AVTS ,

There is nothing wrong with your code -  SaveData overwrites anything already there. You have to do this

LoadData(
   mamo1,
   "MyLocalData1"
);
Collect(
   mamo1,
   {
      HTTP_Body: Label9_2.Text,
      HTTP_Body_1: Label8_6.Text,
      HTTP_Body_2: Label17_8.Text,
      HTTP_Body_3: Label17_6.Text,
      HTTP_Body_4: Label17_8.Text,
      HTTP_Body_5: Label17_7.Text,
      HTTP_Body_6: TextInput1_12.Text,
      HTTP_Body_7: Label18.Text
   }
);
SaveData(
   mamo1,
   "MyLocalData1"
);

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Visit my blog Practical Power Apps

View solution in original post

2 REPLIES 2
WarrenBelz
Super User
Super User

Hi @AVTS ,

There is nothing wrong with your code -  SaveData overwrites anything already there. You have to do this

LoadData(
   mamo1,
   "MyLocalData1"
);
Collect(
   mamo1,
   {
      HTTP_Body: Label9_2.Text,
      HTTP_Body_1: Label8_6.Text,
      HTTP_Body_2: Label17_8.Text,
      HTTP_Body_3: Label17_6.Text,
      HTTP_Body_4: Label17_8.Text,
      HTTP_Body_5: Label17_7.Text,
      HTTP_Body_6: TextInput1_12.Text,
      HTTP_Body_7: Label18.Text
   }
);
SaveData(
   mamo1,
   "MyLocalData1"
);

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Visit my blog Practical Power Apps

Thank you warren . Its worked. 

Helpful resources

Announcements
PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

Top Solution Authors
Top Kudoed Authors
Users online (1,276)