cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Elitezone
Post Prodigy
Post Prodigy

Weird function Sharepoint list (LookUp)

Patch(
    Obrazy_obecnosc,
    LookUp(Obrazy_obecnosc,Last(Split('Imię i nazwisko'.Claims,"|")).Result = User().Email & Created = Today()),
    {
        Nazwa_zadania:Zadanie_nazwa.Text,Opis_zadania:Zadanie_opis.Text
    }
)

This function is always creating new record it cannot match LookUp.

 

And this function does not create any record at all or fill the existing record:

Patch(
    Obrazy_obecnosc,
    LookUp(Obrazy_obecnosc,Last(Split('Imię i nazwisko'.Claims,"|")).Result = User().Email),
    {
        Nazwa_zadania:Zadanie_nazwa.Text,Opis_zadania:Zadanie_opis.Text
    }
)

 

Obrazy_obecnosc is a Sharepoint List.

Imię i Nazwisko is name and surname field.

1 ACCEPTED SOLUTION

Accepted Solutions
v-xiaochen-msft
Community Support
Community Support

Hi @Elitezone ,

 

Glad to solve your problem.

If you have a new question, I suggest you create a new post and describe your new problem in detail.

I will be happy to continue to help you solve the problem.

 

Best Regards,

Wearsky

View solution in original post

3 REPLIES 3
v-xiaochen-msft
Community Support
Community Support

Hi @Elitezone ,

 

According to your description, let me explain why you encountered this problem.

  1. Last(Split('Imię i nazwisko'.Claims,"|")).Result returns lowercase value. The value returned by User().Email may have uppercase letters. So convert the string to lowercase.
  2. You should use &&. In logic, it means and.
  3. Today() only returns the date. Created returns the date and time. You should remove the time to compare them.

 

You can try the following code:

If(

    !IsBlank(

        LookUp(

            Obrazy_obecnosc,

            Last(

                Split(

                    'Imię i nazwisko'.Claims,

                    "|"

                )

            ).Result = Lower(User().Email) && DateValue(Text(Created)) = Today()

        )

    ),

    Patch(

        Obrazy_obecnosc,

        LookUp(

            Obrazy_obecnosc,

            Last(

                Split(

                    'Imię i nazwisko'.Claims,

                    "|"

                )

            ).Result = Lower(User().Email) && DateValue(Text(Created)) = Today()

        ),

        {

            Nazwa_zadania: Zadanie_nazwa.Text,

            Opis_zadania: Zadanie_opis.Text

        }

    )

)

Best Regards,

Wearsky

@v-xiaochen-msft 

It works very good. Do you have idea how to make it to save more than one record?

Currently it only saves one record (last one) and If I change input it replace it.

v-xiaochen-msft
Community Support
Community Support

Hi @Elitezone ,

 

Glad to solve your problem.

If you have a new question, I suggest you create a new post and describe your new problem in detail.

I will be happy to continue to help you solve the problem.

 

Best Regards,

Wearsky

Helpful resources

Announcements
PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

Top Solution Authors
Top Kudoed Authors
Users online (2,417)