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
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (2,604)