Showing results for 
Search instead for 
Did you mean: 
Regular Visitor

Updating a text box from a variable



Quite new to Powerapps and struggling with updating a text box on a data card.


I have a sharepoint list with a canvas app.  I have a text box that I want to show the default value from the record but be able to change it from a pop-up that pulls names from the Office 365 connector.


I kinda had it working with a 'pop-up' box that pulled the data from office 365 and allowed me to use UpdateContext to set a variable. Then had an if statement on the default setting to check if the variable had data and if not use the data from the record.  Hope that makes sense so far.


If(IsBlank(locPR),ThisItem.'Preventitive Action Responsibility',locPR)

However once I used this on one record the variable would show on every record.

How do I fix this?


I tried resetting the variable to be Blank on the previous screen but that didn't work.  Tried changing the UpdateContext to a Set function which worked to clear the variable but wouldn't update the Text box.


Any ideas


Accepted Solutions

Hi @haywam59 ,

Use brackets liberally

(Action1 = aValue && Completed=No) || (Action2 = aValue && Completed=No)

OR (in case above)

Completed=No && (Action1 = aValue || Action2 = aValue)


Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.


View solution in original post

Super User III
Super User III

Hi @haywam59 ,

I am guessing that you are referring to items in a gallery and all are being updated - if so, try this for the current record selected

   !IsBlank(locPR) && ThisItem.IsSelected,
   ThisItem.'Preventitive Action Responsibility',


Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.


Hi Warren


No this is on the detail form.  From the list form that does have a gallery I then select which record I want to edit.  Each record now shows the same value that I set on a previous record.

OK Thanks @haywam59 ,

When you say "show on every record" do you mean the value in variable locPR stays the same and sets each record to its value?

How is locPR set and when?

Hi @haywam59 ,

Do you want to display a variable or default value in a datacard based on condition?

Could you tell me in details

1)when will you display this variable and when will you display default value?

2)this field's data type?

3)how do you set this variable? is this variable constant value or it will change based on some situations?

If you want to justify whether to display variable or default value, you could try this:


//condition1 is the formula that you want to display variable.condition1 is the formula that you want to display default value.



Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @haywam59 ,

A couple of query paths - please tag whichever suits your needs to continue the thread with.

Hi Warren


I use an initial screen with a gallery control to show all records within a dataset.  I then use another form (not a gallery control) to show the detail of a single record for editing.


When I go to the editform I may have some data in a field.  In this example its the name of a person that an action has been allocated to.  If I want to change the name of that person I can either overtype and update the form or I can use some way to look up the names, choose one and update the field.  So I am using a 'pop-up' rectangle with a link to the O365 users.  I choose one which set the value of a variable.  I was using UpdateContext to set the value and then an If function as the Default value for the text box on the datacard

If(isBlank(variablename), fieldname, variablename)

This worked to update that record.  However when I closed the edit form and chose a different record the variablename was still showing on that datacard.  I have tried setting the variablename="" but that doesn't appear to work.


From what I can see the suggested route for updating a text in a datacard field is to use a variable. And I am struggling to know how to reset the variable properly so that I can see the actual data on a different record and then change that one.

If I want to change the value of a field on an editform I can either overtype or use a pop-up which sets a variable.


The condition I use on the datacard is:



So I only want to set the variable when I want to change the value in the field, update the record on the editform and then clear the variable ready to edit another record

Hi @haywam59 ,

Firstly, you can set a Text Variable to Blank() so depending on how you set it - use the same method.


Also the Default of the data card probably should be


Which shows the value contained in the card if locPR is blank.

The possible other issue I see here with the "pop-up" selector is that to change a card with a value already in it requires you to Reset the control. If this control is on a form, the control resetting it also needs to be on that form. New records are OK as they are blank by default and will set to a Variable. Please tell me if this is an issue in your process.


Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.


Morning Warren


Thanks, I'll give that  a try.


So on the pop-up button something like:


Set(locPR, selectedName)



IS that correct??



Helpful resources

PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

PowerPlatform 768x460.png

Microsoft Learn

Check out our new Discover Your Career Path blog post series and get all the details.

Users online (2,546)