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 / IF Statement not working
Power Apps
Unanswered

IF Statement not working

(0) ShareShare
ReportReport
Posted on by 237

Hi,

 

I am trying to write an if statement to populate the 'Event Start Date' from my 1st list('Event Information'). I have two lists. List1('Event Information') is a parent list and List2('Checklist Details') is the child list. It is a one to many relationship between the two and the ID from 'Event Information' matches the title within 'Checklist Details'. I want to pull the 'Event Start Date' from my 'Event Information' list. However, I keep getting the following error. 

 

Please help! I am a beginner with these formulas

 

NPatel12498_0-1698074166425.png

 

Categories:
I have the same question (0)
  • realwillwright Profile Picture
    772 Moderator on at

    Hi @NPatel12498 

     

    Is this a SharePoint data source, if so, ID isn't classed as Text. If ID and Title are the same put ID in a Text or Value function depending on which type Title is. I would assume Text

    If(Text('Event Information'.ID) = Text('Checklist Details'.Title), 'Event Information'.'Event Start Date')
  • NP-18101421-0 Profile Picture
    237 on at

    After trying that, this is what I get:

     

    NPatel12498_0-1698078645334.png

    The datasource is SharePoint. 'Event Information' uses the regular ID and 'Checklist Details' uses Title which has a number but has data type as single line text. 

  • realwillwright Profile Picture
    772 Moderator on at

    Hi Can you try Value rather than Text

  • NP-18101421-0 Profile Picture
    237 on at

    Getting "Expected text value" error now

     

    NPatel12498_0-1698079870244.png

     

  • vivekravi Profile Picture
    241 on at

    Hi @NPatel12498 ,

     

    Maybe can you try using lookup function? Also can you provide more details like are you using a gallery or a text box?

  • NP-18101421-0 Profile Picture
    237 on at

    I am trying to pull the value into a Text Input field within a gallery. 

     

    Tried lookup:

    NPatel12498_0-1698085971105.png

     

  • vivekravi Profile Picture
    241 on at

    I think the issue is, since you have a one:many relationship, it is giving you an entire table, instead of a particular value for your filter formula. I used a gallery, in my case, to provide all the possible dates that matches the given criteria.

     

    The result of the above filter formula will always be a table and cannot be used within the default property of the 'textinput'. 

  • NP-18101421-0 Profile Picture
    237 on at

    The formula should only pull one record from Event Information because Event Information is the parent list whilst Checklist Details is the child list. The formula should be If the Title of the current item matches the ID from the Event Information List, then populate the Event Start Date.

  • vivekravi Profile Picture
    241 on at

    Exactly, This will pull up the entire record not just the Even start date, for the filter criteria. What we need is a field value, not a record.

  • realwillwright Profile Picture
    772 Moderator on at

    ok, so the formula should be

    Lookup('Event Information', ID = Value(Title)).'Event Start Date'

     This again might not work very well with SharePoint lists as both lists have the columns ID and Title.

     

    If that is the case you might have to create a collection and rename some of the columns

    ClearCollect(
     colEventInformation, 
     RenameColumns(
     'Event Information', 
     "ID", "EventId", 
     "Title", "EventTitle"
     )
    );
    Lookup(colEventInformation, EventID = Value(Title)).'Event Start Date'

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 796 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 327 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard