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

Community site session details

Session Id : TrKwPuwPBNQGCKvLFkaPFh
Power Apps - Building Power Apps
Unanswered

varFormData is showing errors when I set another variable

Like (0) ShareShare
ReportReport
Posted on 11 Aug 2021 15:02:27 by 14

Hello, 

 

I built an app where users can report an issue on a flight and a checklist is assigned to that specific issue on a specific flight. The app is working just fine with all of the formulas I wrote in.

 

However, when I set another variable set(varUser, User()), it somehow trips up the varFormData I set for my form and now it gives me an error. 

 

Here are the errors that are showing:

 

HomeScreen Plus Icon to enter new event

aadona_0-1628693859865.png

HomeScreen Caret Icon to view an entry

aadona_1-1628693956488.png

OtherScreens to display information

aadona_2-1628694052034.png

To submit new entry:

aadona_3-1628694086180.png

 

what gives?

  • aadona Profile Picture
    14 on 12 Aug 2021 at 00:55:05
    Re: varFormData is showing errors when I set another variable

    Hi Randy, 

     

    The users will be able to view the specific checklist tied to the event and also edit the status of the checklist item. In my checklist screen, I already have formulas to patch the edits to the status of the checklist item.

     

    For this case, would the above function that you wrote work?

     

     

  • RandyHayes Profile Picture
    76,287 Super User 2024 Season 1 on 11 Aug 2021 at 22:05:34
    Re: varFormData is showing errors when I set another variable

    @aadona 

    Yes, I wondered about that last bit in your formulas.

    So, is the check list something the user sees and can edit, or is that just a behind-the-scenes list that you simply do not want to recreate?

     

    If it is behind the scenes, then the formula could easily be changed to:

    If(!LookUp('ISD Incidents Checklist Info', ISDIncidentID = Self.LastSubmit.ID, true),
     Collect('ISD Incidents Checklist Info',
     ForAll(colISDCheckList,
     {Status: Status,
     ISDChecklistItemID: ID,
     ISDIncidentID: Self.LastSubmit.ID,
     Checklist: Checklist
     }
     )
     )
    );
    
    Set(varShowSpinner, false);
    Navigate(HomeScreen)

    This would check to see if there are any child records in the checklist info list that match the parent ID.  If not, then it will create them, otherwise it will skip.

  • aadona Profile Picture
    14 on 11 Aug 2021 at 21:44:59
    Re: varFormData is showing errors when I set another variable

    Thank you, Randy. This makes total sense now. You are exactly correct. I had two different schemas. I will definitely try to implement the proper way of splitting the forms. 

     

    I have my app set up this way. When a user submits a new entry, a checklist is also created and both are tied using the ISDIncidentID and Self.LastSumbitID relationship.

     

    When my users go back and edit the entry though, how would we rewrite the formula to where it will only update the changes but it will not recreate a new checklist everytime they SubmitForm?

     

  • RandyHayes Profile Picture
    76,287 Super User 2024 Season 1 on 11 Aug 2021 at 20:40:31
    Re: varFormData is showing errors when I set another variable

    @aadona 

    This commonly happens when you try to alter a variable with the formulas like you have.  Essentially, you have someplace in your app that has a different schema in it.

     

    If your app loads up in edit mode with the error you are seeing, then you will need to examine all of the formulas where you are setting the variable to find the discrepancy. 

     

    If your app loads in edit and there are no errors initially, then the error is occurring when you change a formaul using that variable.   

    The PowerApps editor must infer the schema for everything in it.  Schemas are required for everything.  When you set a variable to a particular schema (even if it is derived directly from the datasource), if you then make alterations to the formulas to change a value in-place (i.e. you try to set a column in the same set statement) and you accidentally do something that changes the schema - even a misspelling of a column name, then the editor re-evaluates the schema inference.  This happens pretty quickly and if you don't catch your misspelling or other issue before the re-evaluation occurs, then the editor "gets lost".  It then thinks that the columns are something different than they are and it remembers the mistake you made and causes the error you are seeing.  There is ONLY one way to resolve that when it happens, and that is to exit the designer and go back in.

     

    I would suggest implementing the form splitting properly in the app so that you are not working with a variable like that which "builds" on itself and can cause this problem.  Keeping in mind also that when you split the forms properly and submit your data with the SubmitForm, you will also get back the error checking capability that you are currently not accounting for in your formula - among other things missing.

     

  • aadona Profile Picture
    14 on 11 Aug 2021 at 20:15:18
    Re: varFormData is showing errors when I set another variable

    Hi RandyHayes, 

     

    The video is really helpful! Thank you! 

     

    I'm still encountering some errors in my app. All my Set(varFormData...) functions show an error that says "Incompatible type. We can't evaluate your formula because the context variable types are incompatible with the types of values in other places in your app."

     

    Do you have more insight?

  • RandyHayes Profile Picture
    76,287 Super User 2024 Season 1 on 11 Aug 2021 at 15:11:01
    Re: varFormData is showing errors when I set another variable

    @aadona 

    You should be setting your variable in the OnSuccess action of your form:

       Set(varFormData, Self.LastSubmit)

     

    However, you are using a Patch method to split your forms, so you are losing all of the functionality that the form brings to you to allow this.  I would advise NOT splitting the form in that way, but instead using one form to be the master form.  I have a video on how to split forms properly in PowerApps without losing any of the functionality in them.  It's worth taking a look at it to get an idea on how to do this without the steps you are taking and without the hassle you are experiencing.

     

    Once you have the form properly set up, then your Submit action will be:

    Set(varShowSpinner, true);
    SubmitForm(yourMasterForm)

    And your OnSuccess action of the master form will be:

    Collect('ISD Incidents Checklist Info',
     ForAll(colISDCheckList,
     {Status: Status,
     ISDChecklistItemID: ID,
     ISDIncidentID: Self.LastSubmit.ID,
     Checklist: Checklist
     }
     )
    );
    
    Set(varShowSpinner, false);
    Navigate(HomeScreen)

    Note, your original formula used the ForAll incorrectly, the above uses it as intended.

     

    I hope this is helpful for you.

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

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 791 Most Valuable Professional

#2
MS.Ragavendar Profile Picture

MS.Ragavendar 410 Super User 2025 Season 2

#3
mmbr1606 Profile Picture

mmbr1606 275 Super User 2025 Season 2

Loading complete