I have a datasource that is a sharepoint list.
In my datasource i have a column called "xtype" and "xtype2"
I want to to push a button and update a textinput field on my app so that the datasource to the textinput changes.
For example
If user press button1 it sets textinput1 to have xtype in it´s Text option.
If user press button2 it sets textinput1 to have xtype2 in it´s Text option.
I have tried setting a variable on the Onselect on each button.
Likse this:
Set(buttonvar;xtype)
Set(buttonvar;xtype2)
Then put buttonvar in the textinput1 field
But i get error that xtype and xtype2 does not exist.
But they do...
What am i doing wrong?
Solved! Go to Solution.
Let me see if I understand you properly...
You have a Gallery - not an EditForm. Outside of the Gallery you have a 2 Buttons. One (let's call) "xtype" and the other "xtype2". If the user presses "xtype" you want the values in the textinput controls that you have in your Gallery to all change to reflect the xtype column of the item in the gallery. If the user presses "xtype2" you want to have all the textinput controls in the gallery change to reflect the xtype2 column of the item.
If that is the case, then you can take this approach:
On the OnSelect of the xtype button, set this formula : UpdateContext({showXtype2: false})
On the OnSelect of the xtype2 button, set this formula: UpdateContext({showXtype2: true})
On the TextInput control in your Gallery, set the Default property to this formula: If(showXtype2, ThisItem.xtype2, ThisItem.xtype)
That will give you what I described above.
Let's see how that works for you.
Firstly, I am assuming you are working in an EditForm and thus on just one record. AND, that your button is within your Form. This response is predicated on that assumption.
What you can do is adjust your formulas to the following (on their respective buttons):
Set(buttonvar; ThisItem.xtype) Set(buttonvar; ThisItem.xtype2)
And, of course, the default value for your textinput would be buttonvar.
If the above assumptions are not the case, then post back and we can punt at another option.
I tried those codes but they do not work.
I get the same error.
I am working in an gallery.
I want to change the gallery labels when i press a button outside of the gallery.
so if i press button1 set textinput1 to xtype (column)
if i press button2 set textinput1 to xtype2(column)
Let me see if I understand you properly...
You have a Gallery - not an EditForm. Outside of the Gallery you have a 2 Buttons. One (let's call) "xtype" and the other "xtype2". If the user presses "xtype" you want the values in the textinput controls that you have in your Gallery to all change to reflect the xtype column of the item in the gallery. If the user presses "xtype2" you want to have all the textinput controls in the gallery change to reflect the xtype2 column of the item.
If that is the case, then you can take this approach:
On the OnSelect of the xtype button, set this formula : UpdateContext({showXtype2: false})
On the OnSelect of the xtype2 button, set this formula: UpdateContext({showXtype2: true})
On the TextInput control in your Gallery, set the Default property to this formula: If(showXtype2, ThisItem.xtype2, ThisItem.xtype)
That will give you what I described above.
Let's see how that works for you.
Stay up tp date on the latest blogs and activities in the community News & Announcements.
Mark your calendars and join us for the next Power Apps Community Call on January 20th, 8a PST
Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.
User | Count |
---|---|
198 | |
177 | |
64 | |
34 | |
32 |
User | Count |
---|---|
339 | |
273 | |
115 | |
74 | |
57 |