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 / Multiple conditions
Power Apps
Answered

Multiple conditions

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi guys, 

So i have a button that needs to patch to a SharePoint List, I need it to first check if the list already has that item in it, then check if the value of a checkbox is True, then after this I need it to patch a Name an a Date depending on the jobtitle of the user. If the jobtitle equals "Praktikant" it needs to just patch this, however, if it is not, then I need it to just patch their name and the date? I have tried the formula as seen under the text, however, in this case it patches both. Anyone got any ideas on how to make sure that it patches "Praktikant" if this is the jobtitle, but then their actual name if it is not 🙂 

If(
 And(
 IsBlank(
 LookUp(
 Onsdag;
 Medarbejdernr = Medanr.Text;
 false
 )
 );
 'Onsdag()'.Value = true
 );
 'Office365-brugere'.MyProfile().JobTitle = Label6.Text;
 Set(
 gBlItemPatched;
 Patch(
 Onsdag;
 Defaults(Onsdag);
 {
 Title: Label6.Text;
 Dato: Dato1.Text
 }
 )
 );
 Set(
 gBlItemPatched;
 Patch(
 Onsdag;
 Defaults(Onsdag);
 {
 Title: User().FullName;
 Medarbejdernr: Medanr.Text;
 Dato: Dato1.Text
 }
 )
 )
)

 

Thanks In advance. 
- Tobi 

Categories:
  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    @Anonymous I found it a little hard to follow your code because you are using semi-colon's instead of commas throughout your code. I didn't know you could do that? I guess if it works then you can?

     

    Anyway, with this in mind, I think you need a comma to separate off your 'Else' statement. See below, try changing this semi-colon to a comma and see if that works?

     
  • mdevaney Profile Picture
    29,993 Moderator on at

    @Anonymous 

    Just wanted to chime in and let you know the reason semi-colon works for the OP is because of their language settings.  I am not sure which languages do this but so far I have experienced it for forum members whose language is Portugese and Spanish.  See the picture below for more details.

     

    Capture.PNG

     

    More info at the Official MS Docs for global apps

    https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/global-apps

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    @mdevaney thanks mate, that's something I wasn't aware of.

     

     

  • AnneZC Profile Picture
    65 on at

    Hi @Anonymous ,

    It looks to me like you are missing a second If statement (shown in the logic below in blue).

     

    Is your logic supposed to be: 

    If (the item does not already exist and the check box is true)

    Then

          If the Job Title = Label6.Text

          Then Create item with Title and Date

          Else Create item with Name and Date

     

     

     

  • Verified answer
    v-xida-msft Profile Picture
    Microsoft Employee on at

    Hi @Anonymous ,

    Based on the formula you provided, I think there is something wrong with it.

     

    I have made a test on my side, please consider modify your formula as below:

    If(
     IsBlank(LookUp(Onsdag; Medarbejdernr = Medanr.Text)) && 'Onsdag()'.Value = true;
     If(
     Office365Users.MyProfile().JobTitle = Label6.Text;
     Set(
     gBlItemPatched;
     Patch(
     Onsdag;
     Defaults(Onsdag);
     {
     Title: Label6.Text;
     Dato: Dato1.Text
     }
     )
     );
     Set(
     gBlItemPatched;
     Patch(
     Onsdag;
     Defaults(Onsdag);
     {
     Title: User().FullName;
     Medarbejdernr: Medanr.Text;
     Dato: Dato1.Text
     }
     )
     )
     )
    )

    Please consider take a try with above solution, then check if the issue is solved.

     

    Best regards,

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 393 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 328

#3
WarrenBelz Profile Picture

WarrenBelz 278 Most Valuable Professional

Last 30 days Overall leaderboard