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

How to set variable to a datasource column?

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?

1 ACCEPTED SOLUTION

Accepted Solutions

@Oskarkuus 

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.

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!

View solution in original post

3 REPLIES 3
Highlighted
Super User III
Super User III

@Oskarkuus 

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.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!
Highlighted

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)

@Oskarkuus 

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.

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!

View solution in original post

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (8,046)