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

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
Super User
Super User

Re: How to set variable to a datasource 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.

View solution in original post

3 REPLIES 3
Super User
Super User

Re: How to set variable to a datasource column?

@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.
Oskarkuus
Level: Powered On

Re: How to set variable to a datasource column?

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)

Super User
Super User

Re: How to set variable to a datasource 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.

View solution in original post

Helpful resources

Announcements
Better Together’ Contest Finalists Announced!

'Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

thirdimage

Power Apps Community User Group Member Badge

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

sixthImage

Join THE global Microsoft Power Platform event series

Attend for two days of expert-led learning and innovation on topics like AI and Analytics, powered by Dynamic Communities

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

thirdimage

Microsoft Business Applications Virtual Launch

Join us for the Microsoft Business Applications Virtual Launch Event on Thursday, April 2, 2020, at 8:00 AM PST.

thirdimage

Community Summit North America

Innovate, Collaborate, Grow - The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (3,522)