cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Advocate I
Advocate I

Problem with updating a sharepoint list (operator/operand error)

Hello guys. 

 

So i've made an app for social events at our company. 

 

Currently, after you sign up for the event - you have to delete your signup if you have changes. 

 

Currently i wish to change this, but i am having trouble with the code for updateif

 

The working code for signing up is: 

 

Set(
    MDS;
    Main_ID
);;
Patch(
    Deltagerliste;
    Defaults(Deltagerliste);
    {
        SignupID: Text(
            Value(
                First(
                    Sort(
                        Filter(
                            Deltagerliste;
                            MDS = MainIDSignup
                        );
                        Value(SignupID);
                        Descending
                    )
                ).SignupID
            ) + 1
        );
        UniqueBooking: Text(
            Value(
                First(
                    Sort(
                        Deltagerliste;
                        Value(UniqueBooking);
                        Descending
                    )
                ).UniqueBooking
            ) + 1
        );
        Titel: Label1_3.Text;
        MainIDSignup: Label24.Text;
        Brugernavn: User().FullName;
        Deltager: "1";
        PlusOne: If(
            Checkbox1.Visible;
            (If(
                Checkbox1.Value = true;
                Text("1");
                Text("0")
            ));
            Text("0")
        );
        PlusKids: If(
            Dropdown1.Visible;
            Dropdown1.SelectedText.Value;
            Text("0")
        )
    }
);;
Navigate(
    Forside;
    None
);;

 

What i am trying to do is update PlusKids and PlusOne with the following code

 

UpdateIf(
    Deltagerliste;
    MainIDSignup = Main_ID;
    {
        PlusOne: If(
            Checkbox1.Visible;
            (If(
                Checkbox1.Value = true;
                Text("1");
                Text("0")
            ));
            Text("0")
        );
        PlusKids: If(
            Dropdown1.Visible;
            Dropdown1.SelectedText.Value;
            Text("0")
        )
    }
);;
Navigate(
    Forside;
    None
);;

 

I am getting some weird error that i am having trouble translating to English. But it seems to be something like

 

Expected operator error with a text along the lines of

"Operator expected. We are expecting an operator, ex "+", "*" or "&" this place in the formula"

 

The error is in my update code.

 

Any useful hints?

1 ACCEPTED SOLUTION

Accepted Solutions
Super User III
Super User III

@ABK 

Specifically for the Formula you are trying to change, consider the following formula instead:

 

UpdateIf(
    Deltagerliste;
    MainIDSignup = Main_ID;
    {
        PlusOne: If(Checkbox1.Visible && Checkbox1.Value; "1"; "0");
        PlusKids: If(Dropdown1.Visible, Dropdown1.Selected.Value; "0")
    }
);;

Navigate(
    Forside;
    None
);;

 

 

I am also guessing that perhaps your PlusKids might be a numeric column, in which case, change to the following:

 

UpdateIf(
    Deltagerliste;
    MainIDSignup = Main_ID;
    {
        PlusOne: If(Checkbox1.Visible && Checkbox1.Value; "1"; "0");
        PlusKids: Value(If(Dropdown1.Visible, Dropdown1.Selected.Value; "0"))
    }
);;

Navigate(
    Forside;
    None
);;

 

 

I hope this is helpful 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.
Check out my PowerApps Videos too!

View solution in original post

3 REPLIES 3
Super User III
Super User III

@ABK 

Specifically for the Formula you are trying to change, consider the following formula instead:

 

UpdateIf(
    Deltagerliste;
    MainIDSignup = Main_ID;
    {
        PlusOne: If(Checkbox1.Visible && Checkbox1.Value; "1"; "0");
        PlusKids: If(Dropdown1.Visible, Dropdown1.Selected.Value; "0")
    }
);;

Navigate(
    Forside;
    None
);;

 

 

I am also guessing that perhaps your PlusKids might be a numeric column, in which case, change to the following:

 

UpdateIf(
    Deltagerliste;
    MainIDSignup = Main_ID;
    {
        PlusOne: If(Checkbox1.Visible && Checkbox1.Value; "1"; "0");
        PlusKids: Value(If(Dropdown1.Visible, Dropdown1.Selected.Value; "0"))
    }
);;

Navigate(
    Forside;
    None
);;

 

 

I hope this is helpful 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.
Check out my PowerApps Videos too!

View solution in original post

@RandyHayes 

 

I kinda feel dumb.. 

I had spent so much time starring at codes that I just couldn't see that I was trying to use this under "Text" and not "OnSelect".

 

Therefore it obviously didn't work 🙂 


Thank you for your help anyway - accepted your answer as the code you provided works. 

@ABK 

It happens!

You know that's a sign you need to take a little break! 🙂

_____________________________________________________________________________________
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.
Check out my PowerApps Videos too!

Helpful resources

Announcements
News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

Power Apps Community Call

Power Apps Community Call- January

Check out the Power Apps Community Call for January 2021

PP Bootcamp Carousel

Global Power Platform Bootcamp

Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.

secondImage

Power Platform Community Conference On Demand

Watch Nick Doelman's session from the 2020 Power Platform Community Conference on demand!

Top Solution Authors
Top Kudoed Authors
Users online (5,698)