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

Notifications

Announcements

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

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:
I have the same question (0)
  • Community Power Platform Member Profile Picture
    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,989 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
    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
    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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 739 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard