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 / If row exists in sub-c...
Power Apps
Unanswered

If row exists in sub-collection, where value is datetime format

(0) ShareShare
ReportReport
Posted on by 35

I have a collection (called ABC) and a sub collection (called scheduleItems). The following works to check if the first item in the sub collection = 10:00 (and then changes a colour accordingly). 

If(Text(DateTimeValue(First(First(ABC).scheduleItems).start.dateTime),
DateTimeFormat.ShortTime24
) = "10:00",

Orange,RGBA(0,0,0,0))

 

But how would I create the above when looking for 'any' row that matches "10:00"?

Categories:
  • eka24 Profile Picture
    20,925 on at
    What you need to do is to remove first from your formula.
  • PGTips Profile Picture
    35 on at

    I've tried doing that, but it just complains about DateTimeValue having invalid arguments. Could you show an example of how you mean? 🙂

  • Slaverty Profile Picture
    218 on at

    I think a filter would do the job for you

     

    IF(CountRows(Filter(ABC, ScheduledItems = 10:00)) < 1, false, true)

     

    Add in whatever format conversion you require.

  • PGTips Profile Picture
    35 on at

    I understand the idea, thanks @Slaverty - but it still doesn't quite work. The date value I'm extracting is actually two layers of collection deep like this:

     
     
    Capture.PNG
  • PGTips Profile Picture
    35 on at

    OK I figured it out:

    If(CountRows(Filter(ABC,Text(DateTimeValue(First(scheduleItems).start.dateTime),DateTimeFormat.ShortTime24) = "11:00")) <1,true,false) 

     

    Nope, thought that worked but it doesn't. Still getting it wrong using first rather than filter

  • Slaverty Profile Picture
    218 on at

    Are you looking for any entries that match 10:00 within the "dateTime" table, or within the whole collection (scheduleItems/Start)?

  • PGTips Profile Picture
    35 on at

    Any item in ABC.scheduleItems where the start.dateTime value = 10:00.

     

    But the format the dateTime value is in, looks like this: 2020-02-03T10:00:00.0000000

  • PGTips Profile Picture
    35 on at

    Cracked it - this now works, where 10:00 is the time converted from the long string. 

     

    If(CountRows(Filter(First(ABC).scheduleItems, Text(DateTimeValue(start.dateTime),DateTimeFormat.ShortTime24) = "10:00"))=1,"True","False")

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

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 405 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 368

#3
WarrenBelz Profile Picture

WarrenBelz 244 Most Valuable Professional

Last 30 days Overall leaderboard