cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
LB2019
Level: Powered On

undefined

I am creating a new app for a simple stock take. I have an edit form screen. The gallery at the top (gallery4) and  the form at the bottom (form1) I have an arrow up and an arrow down to change the value by "1" each click. I have used the following UpdateContext 

 

UpdateContext({Form1Increace: DataCardValue2 +1})

 

It works well but when I submit using my "Save" Button at the bottom the value in "DataCardValue2" stays the same it does not update when a different product is selected form the "Gallery4"

 

In the Defult Value for the "DataCardValue2" I have input an IF statement as follows.

 

If(IsBlank(Form1Increace),ThisItem.Stock,Form1Increace)

 

I think its the "ThisItem.stock" that is causing me problems but I dont know what to put in its place.

 

Also I have a Text Input Box (TextInput3) so that a maunal addition to the stock can update the Stock "DataCardValue2" so if its 100 item increase the user doesnt have to press the up arrow 100 times. This Update Contex is called "Form1Increase2". How do I add 2 update Contexts to the same data card (DataCardValue2)

2 REPLIES 2
Community Support Team
Community Support Team

Re: undefined

Hi @LB2019 ,

Could you please share a bit more about your scenario?

Do you want to update records or add new records in your Gallery via clicking "Save" button?

Further, do you bind your Edit form to your Gallery?

 

Based on the needs that you mentioned, I assume that you want to update existing records in your Gallery 4, is it true?

 

For your first question, I think this issue is related to the Context variable that you set. If you want the proper value to be displayed within your DataCardValue2 box, you need to clear your Context variable when you select a different product within your Gallery4.

I have made a test on my side, please take a try with the following workaround:

Set the OnSelect property of the Gallery4 or the "Navigate" button (">") within the Gallery4 to following:

UpdateContext({Form1Increase: Blank()})

Set the Default vlaue of the DataCardValue2 to following:

If(
IsBlank(Form1Increase),
ThisItem.Stock,
Form1Increace
)

 

For your second question, do you want to add 2 Update Contexts to the same data card (DataCardValue2)? Based on the needs that you mentioned, I have made a test on my side, please take a try with the following workaround:

Set the Default value of the DataCardValue2 to following:

If(
IsBlank(Form1Increase2),
If(
IsBlank(Form1Increase),
ThisItem.Stock,
Form1Increace
) Form1Increase2 )

Set the OnSelect property of the Gallery4 or the "Navigate" button (">") within the Gallery4 to following:

UpdateContext({Form1Increase: Blank()});
UpdateContext({Form1Increase2: Blank()})

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
LB2019
Level: Powered On

Re: undefined

Thank you for your help, so the reason I couldnt get it to work was because the button was not inside the gallery. 

 

I ended up using a simple patch, sometimes the solution comes from looking at it from a different direction.

 

Just if anyone else wants a solution the patch code I used was as follows

 

Patch(ProductTable, ThisItem, {Stock: TextInput7.Text - HiddenValue.Text})

 

Juat a note a did a text input "HiddenValue" and made the value "1" and then hid it on the page.

Helpful resources

Announcements
firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

SecondImage

Power Platform Summit North America

Register by September 5 to save $200

Users Online
Currently online: 215 members 4,622 guests
Please welcome our newest community members: