cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
vikna
Helper III
Helper III

Data from Gallery is not being saved to database once I close the app.

Hi Team,

I've used the below code to show the data in each boxes. It works well until I close the app and relaunch it.

Please see Pic 2. Seems like the 2nd row onwards does not save.

 

 

Pic 1 : 

vikna_0-1620008339664.png

 

Pic 2 : 

vikna_1-1620008376933.png

 

I've added the below code to "On Visible" so that it will save to my database the moment it opens the page : 

 

ForAll(Filter(GalleryLaptop.AllItems, Toggle1.Value = true), Patch(SUMMARY_LAPTOP, ThisRecord, {LUTONG:TextInput6_1.Text, 'MENARA SHELL':TextInput6_2.Text, 'PLAZA SHELL':TextInput6_3.Text, 'LABUAN SUPPLY BASE':TextInput6_4.Text, TOTAL:TextInput6_5.Text})) ;
ForAll(Filter(GalleryAccessories.AllItems, Toggle2.Value = true), Patch(SUMMARY_ACCESSORIES, ThisRecord, {LUTONG:TextInput11.Text, 'MENARA SHELL':TextInput11_1.Text, 'PLAZA SHELL':TextInput11_2.Text, 'LABUAN SUPPLY BASE':TextInput11_3.Text, TOTAL:TextInput11_4.Text}))

 

Please advise.

 

Thanks to @v-albai-msft for providing the solution for my initial issue : 
https://powerusers.microsoft.com/t5/Building-Power-Apps/Show-data-from-one-Gallery-based-on-location...

 

 

Thank you!

 

6 REPLIES 6
v-xiaochen-msft
Community Support
Community Support

Hi @vikna ,

 

Please provide more information.

What's Toggle1 ? I did not find it from the picture. Please provide the relevant formula and describe its usage.

What's Items  formula of  GalleryLaptop ?

What's Items  formula of  GalleryAccessories?

What's Items  formula of  Gallery1_1?

What's formula of LaptopModel?

What's formula of Laptops?

 

From the image, it seems that you are using nested galleries?

Please provide as much information as possible, such as what is each name you defined?

 

Best Regards,
Wearsky

 

Basically there is 4 Gallery for Laptop and another 4 for Accessories.

Total 4 locations 

vikna_1-1620015149484.png

LAPTOP

Lutong : Gallery 1_1

Menara Shell :  : Gallery 1_2

Plaza Shell : Gallery1

Labuan Supply Base : Gallery1_3

 

ACCESSORIES

 

Lutong : GalleryLUT

Menara Shell :  : GalleryKL

Plaza Shell : GalleryKK

Labuan Supply Base : GalleryLSB

 

 

What's Toggle1 ? I did not find it from the picture. Please provide the relevant formula and describe its usage.
It is hidden. Purpose is to tell if there is any changes done on the box .

Formula :
ThisItem.LUTONG <> TextInput6_1.Text Or ThisItem.'MENARA SHELL' <> TextInput6_2.Text Or ThisItem.'PLAZA SHELL' <> TextInput6_3.Text Or ThisItem.'LABUAN SUPPLY BASE' <> TextInput6_4.Text Or ThisItem.TOTAL <> TextInput6_5.Text

vikna_0-1620014990629.png

 

 

 

What's Items formula of GalleryLaptop ?
TextInput6_1 : LookUp(Gallery1_1.AllItems,LaptopModel.Text = Laptops.Text).Total.Text
TextInput6_2 : LookUp(Gallery1_2.AllItems,LaptopModelKL.Text=Laptops.Text).TotalKL.Text
TextInput6_3 : LookUp(Gallery1.AllItems,LaptopModelKK.Text=Laptops.Text).TotalKK.Text
TextInput6_4 : LookUp(Gallery1_3.AllItems,LaptopModelLSb.Text=Laptops.Text).TotalLSB.Text
TextInput6_5 : TextInput6_1 + TextInput6_2 + TextInput6_3 + TextInput6_4


What's Items formula of GalleryAccessories?
TextInput11 : LookUp(GalleryLUT.AllItems,ProductsLUT.Text = Accessories.Text).QuantityLUT.Text
TextInput11_1 : LookUp(GalleryKL.AllItems,ProductsKL.Text = Accessories.Text).QuantityKL.Text
TextInput11_2 : LookUp(GalleryKK.AllItems,ProductsKK.Text = Accessories.Text).QuantityKK.Text
TextInput11_3 : LookUp(GalleryLSB.AllItems,ProductsLSB.Text = Accessories.Text).QuantityLSB.Text
TextInput11_4 : TextInput11.Text + TextInput11_1.Text + TextInput11_2.Text + TextInput11_3.Text


Toggle 2 :
ThisItem.LUTONG <> TextInput11.Text Or ThisItem.'MENARA SHELL' <> TextInput11_1.Text Or ThisItem.'PLAZA SHELL' <> TextInput11_2.Text Or ThisItem.'LABUAN SUPPLY BASE' <> TextInput11_3.Text Or ThisItem.TOTAL <> TextInput11_4.Text

What's Items formula of Gallery1_1?
no specific formula. Its connected to a data source (Excel) when I hit the update button

 

Update button formula : (toggle is hidden)
ForAll(Filter(Gallery1_1.AllItems, Toggle3_1.Value = true) , Patch(LUT_LAPTOP, ThisRecord, {JML:TextInput1_8.Text, CAR:TextInput1_9.Text, SECONDEE:TextInput1_10.Text , BREAKFIX:TextInput1_11.Text,VIP:TextInput1_12.Text, TOTAL:Total.Text}))

 

What's formula of LaptopModel?
What's formula of Laptops?
This is based on @v-albai-msft advise in my previous post :
https://powerusers.microsoft.com/t5/Building-Power-Apps/Show-data-from-one-Gallery-based-on-location...

 

I hope this explains better. hopefully not too much useless information. I'm still new to Powerapp 🙂

 

 

 

 

v-xiaochen-msft
Community Support
Community Support

Hi @vikna ,

 

Thanks for your supplement.

 

I have the following questions:

1\ I see that you have 3 loop patch functions, which one failed to execute? Please see the picture below

v-xiaochen-msft_0-1620020346507.png

v-xiaochen-msft_1-1620020365003.png

 

2\ Could you add a description of the problem you encountered?  Did you run it for the first time without problems?

Did you open the app for the second time and it didn't work properly?

Your formula has no grammatical errors, so I want to know what you want to achieve.

 

3\ Thank you for the supplementary explanation of many textinput controls  .But I also want to know the Items property of your gallery 'GalleryLaptop ' and 'GalleryAccessories'. 

v-xiaochen-msft_2-1620021690470.png

v-xiaochen-msft_3-1620021742159.png

 

4\ What is your data source? How many data sources do you have? 

From your formula, I can see that you have three loop patch formulas, so do you have 3 data sources and do you want to modify their records?

 

Best Regards,

Wearsky

 

1.  All 3 did not fail to execute. There are no errors generated

 

2. 

a. This is the main page which have 2 dropdown

Location :

Lutong

Menara Shell

Plaza Shell

Labuan

Summary

 

Items :

Laptops

Location

 

vikna_13-1620030816402.png

 

b. After selecting the dropdowns, I click on EDIT.

 

c. I have 2 more screens for each of the 4 location mentioned before each similar as below.

vikna_14-1620030816424.png

 

vikna_15-1620030816467.png

 

d. This is the summary page.

If I open the app, and then update laptop and accessories inventories from the page above, it updates the summary screen properly.

vikna_16-1620030816550.png

 

e. However, I close the app and then launch it again, it will be something similar as below.

The only this that stays are the details for HP EliteBook 830 (G5,G6,G7) AND USB Standard Keyboard ALL.

vikna_17-1620030816629.png

 

f. At the launch of SUMMARY page (On Visible) , the below formula will be applied to ensure it saves to my database.

vikna_19-1620030816638.png

And it saves in the Excel database.

However, upon closing my application, those details are missing

 

vikna_20-1620030816647.png

 

g. And all data in my other screen is retained. Only SUMMARY page is having issues.

 

WHAT I NEED TO ACHIEVE:

I want to ensure that the details captured in the SUMMARY pages does not go missing.

 

 

3. The Item formula for GalleryLaptop and GalleryAccessories.

vikna_21-1620031014329.png 

vikna_22-1620031042936.png

 

 

 

4.  These are my data sources using Excel file location in One Drive.

vikna_18-1620030816633.png

 

The output in Excel should be like below for each location (WORKS FINE) and one page of summary(NOT WORKING) : 

vikna_23-1620031156392.pngvikna_24-1620031174978.pngvikna_25-1620031188252.png

 

 

v-xiaochen-msft
Community Support
Community Support

Hi @vikna ,

 

Sorry, your data structure and app are very complicated.

I don't have any good suggestions.

Hope someone can help you.

 

Best Regards,

Wearsky

thanks for your advise so far.

 

hopefully someone would be able to advice.

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Users online (2,660)