Skip to main content

Notifications

Power Apps - Error Handling
Suggested answer

Formula Error

Posted on 21 Nov 2024 16:31:02 by 8
Hi there is there someone that could help me fix my formulas? I've been going at them for quite some time now and would really like to just get past this stage. The first set of formulas can be seen below, dont mind the language. The region is set to Italy that's why I'm using (;) instead of (,) for separation. 
 
If(
    IsBlank(Form1.LastSubmit);  // Check if the form is new (blank record)
   
   
    EasyTravelFlow.Run(        // If new, create a new record
        Nome.Text;
        Dipartimento.Text;
        Tipologia.Text;
        Text(Data1.SelectedDate; "yyyy-mm-dd");
        Ora1.Selected.Value;
        Minuto1.Selected.Value;
        AeroportoPartenza1.Selected.Value;
        VoloPartenza1.Text;
        Text(Data2.SelectedDate; "yyyy-mm-dd");
        Ora2.Selected.Value;
        Minuto2.Selected.Value;
        AeroportoRientro1.Selected.Value;
        VoloRientro1.Text;
        Value(Costo.Text);
        Value(Int.Text);
        Round.Selected.Value
    );
    Patch(                         // If the form has been submitted before, update the existing record
        'Volo Database';           // Data source (SharePoint list)
        Form1.LastSubmit;          // The existing record to update (from Form1)
        {
            'Nome (John)': Nome.Text;
            Dipartimento: Dipartimento.Text;
            Tipologia: Tipologia.Text;
            'Data Partenza': Data1.SelectedDate;        // Pass DateTime directly
            'Aeroporto Partenza': { Value: AeroportoPartenza1.Selected.Value };
            'Volo Partenza': VoloPartenza1.Text;
            'Data Rientro': Data2.SelectedDate;
            'Aeroporto Rientro': { Value: AeroportoRientro1.Selected.Value };
            'Volo Rientro': VoloRientro1.Text;
            Costo: Value(Costo.Text);
            Int: Value(Int.Text);
            Round: { Value: Round.Selected.Value }
        }
    )
);  
Set(varShowPopup; false)        // Close the popup after the action (No semicolon after this statement)
--------------------------------------------------------------------------------------------------------------------------
Specifically I am getting the error on the ; here: 
); 
Set(varShowPopup; false)
 
It says the characters are unexpected. I am using characters in an unexpected way. Even though because of my region, the syntax (;) is correct.
 
Second set of formulas: 
// Initialize the screen
Set(isEditing; false);  // Default to new record mode
UpdateContext({ varShowPopup; false })  // Hide popup on screen load
 
Same issue with syntax (;) after the formula: Set(isEditing; false);
 
This is because I have an add/update button that should let the user add a new row to sharepoint (database), but also update the same row if need be. I don't want sharepoint to add a new row every time the user clicks add/update. The user may click add/update, and a new record is created in sharepoint, but if they realize there is a mistake they should be able to edit the same record within powerapps and consequently the same record in sharepoint gets updated, not that an entirely new row gets created. Ps. I copied and pasted these formulas from Chat GPT and my other ones work.   
 
I only have these two errors for now, but I would like to add other functions to my app, so I'll probably be back here. Thanks! 
  • bscarlavai33 Profile Picture
    bscarlavai33 289 on 22 Nov 2024 at 04:16:56
    Formula Error
     
    So like this:
     
     
    If(
        IsBlank(Form1.LastSubmit);;  // Check if the form is new (blank record)
       
       
        EasyTravelFlow.Run(        // If new, create a new record
            Nome.Text;
            Dipartimento.Text;
            Tipologia.Text;
            Text(Data1.SelectedDate; "yyyy-mm-dd");
            Ora1.Selected.Value;
            Minuto1.Selected.Value;
            AeroportoPartenza1.Selected.Value;
            VoloPartenza1.Text;
            Text(Data2.SelectedDate; "yyyy-mm-dd");
            Ora2.Selected.Value;
            Minuto2.Selected.Value;
            AeroportoRientro1.Selected.Value;
            VoloRientro1.Text;
            Value(Costo.Text);
            Value(Int.Text);
            Round.Selected.Value
        );;
        Patch(                         // If the form has been submitted before, update the existing record
            'Volo Database';           // Data source (SharePoint list)
            Form1.LastSubmit;          // The existing record to update (from Form1)
            {
                'Nome (John)': Nome.Text;
                Dipartimento: Dipartimento.Text;
                Tipologia: Tipologia.Text;
                'Data Partenza': Data1.SelectedDate;        // Pass DateTime directly
                'Aeroporto Partenza': { Value: AeroportoPartenza1.Selected.Value };
                'Volo Partenza': VoloPartenza1.Text;
                'Data Rientro': Data2.SelectedDate;
                'Aeroporto Rientro': { Value: AeroportoRientro1.Selected.Value };
                'Volo Rientro': VoloRientro1.Text;
                Costo: Value(Costo.Text);
                Int: Value(Int.Text);
                Round: { Value: Round.Selected.Value }
            }
        )
    );;  
    Set(varShowPopup; false);;        // Close the popup after the action (No semicolon after this statement)
  • Suggested answer
    jpespena Profile Picture
    jpespena 148 on 22 Nov 2024 at 03:44:08
    Formula Error
    Hi,
     
    If you have a form why not just use NewForm() and EditForm() functions?
     
    On your "Add" button, add this code on OnSelect property:
    ResetForm(Form1);
    NewForm(Form1)
    
    On your gallery, add this code on OnSelect property:
    ResetForm(Form1);
    EditForm(Form1)
    On your Form, add this on Item property:
    Gallery.Selected
     

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

October 2024 Newsletter…

October 2024 Community Newsletter…

Community Update Oct 28…

Power Platform Community Update…

Tuesday Tip #4 How to Conntact Support…

Welcome to a brand new series, Tuesday Tips…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 143,061

#2
RandyHayes Profile Picture

RandyHayes 76,308

#3
Pstork1 Profile Picture

Pstork1 63,795

Leaderboard

Featured topics