web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / How to set a column in...
Power Apps
Unanswered

How to set a column in a global variable record to blank?

(0) ShareShare
ReportReport
Posted on by 634

I have a situation where I need to set a part of a global variable(record) to blank if a certain action is taken. I've tried the following but it's a no-go. Is there a way to do this?

 

Set(glbFormData.'First Value', Blank());

UpdateContext({glbFormData.'First Value': Blank()});

 

Categories:
I have the same question (0)
  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @Future_Vision 

    Please consider changing your Formula to the following:

    Set(glbFormData, Patch(glbFormData, {'First Value': Blank()}))

     

    I hope this is helpful for you.

  • Future_Vision Profile Picture
    634 on at

    @RandyHayes 

    I've already tried that but every form that uses glbFormData, as the item, freaks out. 


    Invalid Formula. Expected a value compatible with 'Data Source'

    What's worse is that even though I remove that formula the error remains. 

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @Future_Vision 

    Yes, the error will remain because you have changed the schema of the variable.  The PowerApp designer will not re-evaluate the schema unless you exit and enter back to edit.

     

    So...your glbFormData does NOT have a 'First Value' column in it.  What is it that you are trying to do then with this?

  • Future_Vision Profile Picture
    634 on at

    @RandyHayes 
    I see what happened. I used the wrong column name. Should have been crfeb_firstvalue. Error is gone now, however, doing something like this sets all of the fields, that use a DSI, to blank even though the data still exists in the glbFormData variable

     

     

    If(!("1st" in Source_CB.Selected.crfeb_source), Set(glbFormData, Patch(glbFormData, {crfeb_firstvalue: Blank()})))

     

     

    The typical DSI looks like 

    {crfeb_source:Parent.Default}

     

    Is this because the glbFormData variable needs to be reevaluated somehow?

     

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @Future_Vision 

    Yes, giving the wrong name will certainly do that.  Nothing more frustrating than even misspelling a column and then the designer re-evaluates all the schema before you can correct it.  Once that happens...the designer is "lost".  You've got to exit and start again.  I with there was a "re-evaluate schemas" option in the designer.

     

    As for the other issue you are seeing - can you describe that a little more?

  • Future_Vision Profile Picture
    634 on at

    When I change the combobox that has this formula in the OnChange property it sets that combobox and every other combobox to show no values. At least visually.

     

    If(!("1st" in Source_CB.Selected.crfeb_source), Set(glbFormData, Patch(glbFormData, {crfeb_firstvalue: Blank()})))

     

    If I add a label and set the text to the datacard default value like this then there is data showing since it is pulling from the glbFormVariable. (First Value DC is obviously blank now if I try to access its default)

     

    Source_DC.Default

     

  • Future_Vision Profile Picture
    634 on at

    Hmmm. ResetForm works to get those values back but it also resets the field I changed that triggers the ResetForm thereby resetting it's value as well.

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @Future_Vision 

    If you're changing the record variable that is the Item of the editform, it should update the values on the form itself.  However, keep in mind that once a control is changed (i.e. a dropdown, etc) it will retain its value.

     

    So, instead of resetting the form, consider resetting the controls that appear to be losing their values.

  • Future_Vision Profile Picture
    634 on at

    Hmm. Maybe I am overcomplicating things. This seems like a lot of work for little functionality.

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @Future_Vision 

    Chances are...

     

    Usually when you start introducing in OnChange actions, things are going the wrong way.

    You are trying (in the OnChange) to set a FirstValue to blank.  I would ask this - is the FirstValue a field of your form?  If so, then you should be looking at it from the perspective of the control in the form getting the value it needs based on the condition rather than trying to slip the change in underneath to the form record.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 551

#2
WarrenBelz Profile Picture

WarrenBelz 430 Most Valuable Professional

#3
Valantis Profile Picture

Valantis 298

Last 30 days Overall leaderboard