cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ABK
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
RandyHayes
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
RandyHayes
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
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Top Solution Authors
Top Kudoed Authors
Users online (57,972)