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() statement not ret...
Power Apps
Answered

If() statement not returning expected value

(0) ShareShare
ReportReport
Posted on by 111

Hi All

I have a dropdown which displays items in the format <name of doc><doc id><due date>. so an example would be:

Test Document 1 <1345> [22/02/2022]

 

I have two labels, one to hold doc id, and the other the date. These are then used in filtering a grid control. The formula used to extract the doc id and the date are similar but target the doc id in one and the date in the other. The issue is if() for the date label. If for some reason the date is blank it should 0 should be placed in the label otherwise the date is extracted and placed in the label. The problem is it's not placing anything in the label, i.e. using the example above, there is a date so should display the date, but it displays nothing!!

 

Here's the formula...

If(First(Split(Last(Split(DesignDocList.Selected.Result,"[")).Result,"]")).Result=Blank(),0,First(Split(Last(Split(DesignDocList.Selected.Result,"[")).Result,"]")).Result)

 

What have i missed??

 

Thanks for any insights 😊

 

cheers!

dj

Categories:
I have the same question (0)
  • Verified answer
    v-jefferni Profile Picture
    Microsoft Employee on at

    Hi @Flyingfishnm ,

     

    The reason is the true value and false value should be the same data type within the If statement. From you end, you have 0 as the true value which is Number while "22/02/2022" as the false value which is Text, so the statement will always return Blank as the result. To solve this issue, just make sure both values are Text type and write "0" the Text than 0 the Number.

     

    Hope this helps.

     

    Best regards,

    Community Support Team _ Jeffer Ni
    If this post helps, then please consider Accept it as the solution to help the other members find it.

  • Flyingfishnm Profile Picture
    111 on at

    Hi 

    Thanks so much for that gem of information, i've not come across this in other languages, but yes my problem is fixed.

    Thanks!

    dj

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

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 358 Most Valuable Professional

#2
11manish Profile Picture

11manish 214 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 185

Last 30 days Overall leaderboard