Hi,
I created a Power App that lists records of an Entity (Invoices). I also added a Text Input (PayAmount) control and a button (Pay All) in the Gallery where I added that Entity. I want to populate PayAmount with the value of the "Outstanding Balance" whenever I click Pay All. I tried using a Variable which will be set once I click Pay All and I used that variable as the "Default" of the PayAmount. Unfortunately when I click Pay All, it updates the PayAmount of all the Items in the list (See screenshot). Is there a way for the Pay All to only update the PayAmount of the Item on which I clicked it? Thank you.
Solved! Go to Solution.
This one wasn't as easy as I thought it would be. In my example, I used a checkbox instead of a button to simplify. The OnCheck and OnUncheck properties were
UpdateContext(
{var:If(
CountIf(
Gallery1.AllItems,Checkbox1.Value=true
)>0,true,false
)
}
)
The Default property of the textbox was
If(
Checkbox1.Value,ThisItem.Address,Blank()
)
In my example, I used City but you would use ThisItem.OutstandingBalance. BTW it gave me a headache just getting this far. I will leave it to you to figure out how to use a button instead of a checkbox.
Patch(Invoices,ThisItem, {PayAmount:Textinput1.Text*1})
*1 converts text to number.
Hi @Drrickryp ,
I'm encountering this error. Is it correct that I put it in the OnSelect of the button?
Yes. You need to have the name of the textinput box in the formula. PowerApps is not recognizing the name of your control. If that doesn't work try leaving off the*1. Your payamount field may be text. I had assumed it was a number.
I think it's looking for the PayAmount in the columns/fields of my Invoice Table, but the PayAmount is a Text Input that I only added in the Power App Gallery.
Wow @Cjlast , now you got me confused. If you aren't saving the data, what are you trying to do here ?
Oh sorry. There's another button that will collect the value of that Text Input. What the user would just want is the ability to automatically populate the Text Input with the Outstanding Balance Amount instead of typing the Amount.
Here's the overall look:
I was overthinking the problem,
Ok, you can just put in the Default property of the TextInput Box, ThisItem.OutstandingBalance, Assuming that is the name of the field that contains the outstanding balance for that record.
I tried what you suggested but it only defaults the value of the Text Input with the value of the Outstanding Balance. What I would want to achieve is for the Text Input to only be populated when I click the Pay All button and on the specific item only where I clicked the Pay all button.
This one wasn't as easy as I thought it would be. In my example, I used a checkbox instead of a button to simplify. The OnCheck and OnUncheck properties were
UpdateContext(
{var:If(
CountIf(
Gallery1.AllItems,Checkbox1.Value=true
)>0,true,false
)
}
)
The Default property of the textbox was
If(
Checkbox1.Value,ThisItem.Address,Blank()
)
In my example, I used City but you would use ThisItem.OutstandingBalance. BTW it gave me a headache just getting this far. I will leave it to you to figure out how to use a button instead of a checkbox.
The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.
This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.
User | Count |
---|---|
183 | |
52 | |
41 | |
40 | |
34 |
User | Count |
---|---|
252 | |
81 | |
71 | |
68 | |
66 |