cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Revlock97
Frequent Visitor

Reference an Email of person/group type data from SP list in a Search function

Hello, I can't really make out how to reference an Email of a person/group type in my SP list and use it in a Search function.

 

I have a gallery that searches for the Holiday Hours of the user with respect to Email and its Title but it always returns an error. I have a separate app with the exact same code but the only difference is that its SP list column for Email is of a single line of text type and it works fine. I've used Emails.Email, User().Email = Emails.Emails, "Emails".Email nothing works.

If(IsBlank(Sum(Search(leaveDetailsGallery.AllItems, ThisItem.Title, "Emails"),HolidayHours )),0,Sum(Search(leaveDetailsGallery.AllItems,ThisItem.Title,"Emails"),HolidayHours))

 

Revlock97_0-1653539184224.png

Pardon the delegation warnings. I'll work on that now.

2 ACCEPTED SOLUTIONS

Accepted Solutions
WarrenBelz
Super User
Super User

Hi @Revlock97 ,

Try this

With(
   {
      wHours:
      Sum(
         Filter(
            leaveDetailsGallery.AllItems,
            Emails = ThisItem.Title
         ),
         HolidayHours
      )
   },
   If(
      wHours > 0,
      wHours,
      0
   )
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Visit my blog Practical Power Apps

View solution in original post

Hi @Revlock97 ,

Yes, that column type is problematic with Power Apps (I do not use them) and you need to be aware of the limitations at times. Try this

With(
   {
      StartDate: Date(2021,9,2),
      StartDateNow: Today()
   },
   Sort(
      Search(
         AddColumns(
            Filter(
               colTeamCalendar2,
               'Start Time' >= StartDate Or 'Start Time' <= StartDateNow
            ),
            "EmailAddress",
            Emails.Email
         ),
         txtSearcHistory.Text,
         "Title",
         "EmailAddress"
      ),
      'Start Time',
      Descending
   )
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Visit my blog Practical Power Apps

View solution in original post

4 REPLIES 4
WarrenBelz
Super User
Super User

Hi @Revlock97 ,

Try this

With(
   {
      wHours:
      Sum(
         Filter(
            leaveDetailsGallery.AllItems,
            Emails = ThisItem.Title
         ),
         HolidayHours
      )
   },
   If(
      wHours > 0,
      wHours,
      0
   )
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Visit my blog Practical Power Apps

@WarrenBelz 

It worked like a charm! Thank you so much 🙂

 

 

Revlock97
Frequent Visitor

@WarrenBelz Sorry but I don't suppose you could help me in referencing it using the Search function and the input.Text of a search bar?

 

 

 

With(
    {
        StartDate: Date(2021,9,1) + 1,
        StartDateNow: Date(Year(Today()),Month(Today()),Day(Today()))
        
    },
    Sort(Search(Filter(
        colTeamCalendar2,'Start Time' >= StartDate Or 'Start Time' <= StartDateNow),txtSearcHistory.Text,"Title","Emails"),'Start Time',Descending
    )
)

 

 

This is the code that worked when the Emails was still a single line of text type. But I still don't know how to incorporate it now that it is of a Group/Person type. I tried using the With function like in the Filter code you gave me but it doesn't work for Search.Text references.

Hi @Revlock97 ,

Yes, that column type is problematic with Power Apps (I do not use them) and you need to be aware of the limitations at times. Try this

With(
   {
      StartDate: Date(2021,9,2),
      StartDateNow: Today()
   },
   Sort(
      Search(
         AddColumns(
            Filter(
               colTeamCalendar2,
               'Start Time' >= StartDate Or 'Start Time' <= StartDateNow
            ),
            "EmailAddress",
            Emails.Email
         ),
         txtSearcHistory.Text,
         "Title",
         "EmailAddress"
      ),
      'Start Time',
      Descending
   )
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Visit my blog Practical Power Apps

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.

Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on June 15, 2022 at 8am PDT.

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.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Top Kudoed Authors
Users online (1,911)