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 Condition on drop d...
Power Apps
Answered

If Condition on drop down selection

(1) ShareShare
ReportReport
Posted on by 652
Hello,
 
I've been provided with below logic on this forum and I've marked the Solution as Answered, So posting as a new question. And below logic is not working as expected.
If(
(GroupDropDown.Selected.Value = "Group 1" And DataCardValue4.Text <> "") Or 
(GroupDropDown.Selected.Value = "Group 2" And !IsBlank(DataCardValue15.SelectedDate)),
"Completed",
"Pending"
)
GroupDropDown is the name of the dropdown field which has 2 choices i.e. Group 1 and Group 2.
I have 3 other fields i.e. DataCardValue4 (Text Input), DataCardValue15 (Date Picker) and DataCardValue10 (Text Input)
 
Below is my requirement:
  1. When Group 1 selected from drop down and DataCardValue15 (Date Picker) is blank, show text as "Pending" in DataCardValue10 and if date is added show text as "Completed"  in DataCardValue10
  2. When Group 2 selected from drop down and DataCardValue4 is blank, show text as "Pending" in DataCardValue10 and if some text/value is added show text as "Completed" in DataCardValue10
With the above formula, when I click New Button in my form and when Group 1 is selected from the drop down, the DataCardValue10 is automatically set to "Completed" though we haven't selected date in DataCardValue15 (Date Picker).
 
Below expression is set for New Button (OnSelect Property)
ResetForm(FormInspection);NewForm(FormInspection);
Please advise, on when user clicks New Button, DataCardValue10 should always be set to "Pending".
 
Thanks!
 
Categories:
I have the same question (0)
  • Suggested answer
    Inogic Profile Picture
    1,135 Super User 2025 Season 2 on at
    Hi,
     
    The issue arises because the formula logic doesn't fully align with your requirement. Additionally, when you click the New button, DataCardValue10 is being evaluated before any user input, defaulting incorrectly to "Completed."
    Fix:
    1. Set DataCardValue10 Default Property:
      Update the Default property of DataCardValue10 to dynamically check the conditions.
    If(
        GroupDropDown.Selected.Value = "Group 1",
        If(IsBlank(DataCardValue15.SelectedDate), "Pending", "Completed"),
        If(
            GroupDropDown.Selected.Value = "Group 2",
            If(IsBlank(DataCardValue4.Text), "Pending", "Completed"),
            "Pending"
        )
    )
    Explanation:
      • If Group 1 is selected and the Date Picker (DataCardValue15) is blank → "Pending".
      • If a date is selected → "Completed".
      • If Group 2 is selected and the Text Input (DataCardValue4) is blank → "Pending".
      • If text is entered → "Completed".
      • Any other case defaults to "Pending".
    1. Update the New Button (OnSelect Property):
      To ensure DataCardValue10 always resets to "Pending" on form load, modify the OnSelect of the New button:
    ResetForm(FormInspection);
    NewForm(FormInspection);
    UpdateContext({varStatus: "Pending"})
    1. Bind DataCardValue10 to the Context Variable:
      Update the Default property of DataCardValue10 to:
    varStatus
    1. Add Dynamic Updates (Optional):
      If you want DataCardValue10 to update as users interact, set the OnChange of GroupDropDown, DataCardValue4, and DataCardValue15:
    For GroupDropDown (OnChange):
    If(
        GroupDropDown.Selected.Value = "Group 1",
        UpdateContext({varStatus: If(IsBlank(DataCardValue15.SelectedDate), "Pending", "Completed")}),
        If(
            GroupDropDown.Selected.Value = "Group 2",
            UpdateContext({varStatus: If(IsBlank(DataCardValue4.Text), "Pending", "Completed")})
        )
    )
    For DataCardValue4 (OnChange):
    If(
        GroupDropDown.Selected.Value = "Group 2",
        UpdateContext({varStatus: If(IsBlank(DataCardValue4.Text), "Pending", "Completed")})
    )
    For DataCardValue15 (OnChange):
    If(
        GroupDropDown.Selected.Value = "Group 1",
        UpdateContext({varStatus: If(IsBlank(DataCardValue15.SelectedDate), "Pending", "Completed")})
    )
    Result:
    • On clicking the New button, DataCardValue10 will reset to "Pending".
    • As users select values in the dropdown, text input, or date picker, the status will correctly change to "Completed" or remain "Pending" based on the conditions
    Hope this helps.

    Thanks!

     

    Inogic Professional Services: Power Platform/Dynamics 365 CRM
    An expert technical extension for your techno-functional business needs
    Drop an email at crm@inogic.com 
    Service: https://www.inogic.com/services/ 
    Tips and Tricks: https://www.inogic.com/blog/ 
  • Verified answer
    WarrenBelz Profile Picture
    153,117 Most Valuable Professional on at
    Try this - sometimes blank, empty strings and zero dates have a habit of confusing things
    If(
       (
          GroupDropDown.Selected.Value = "Group 1" And 
          Len(DataCardValue4.Text) > 0
       ) Or 
       (
          GroupDropDown.Selected.Value = "Group 2" And 
          Value(DataCardValue15.SelectedDate) > 1
       ),
       "Completed",
       "Pending"
    )
     
    Please click Does this answer your question 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 a Like.
    MVP (Business Applications)    Visit my blog Practical Power Apps    LinkedIn    Buy me a coffee
  • Prem4253 Profile Picture
    652 on at
     
    Thanks to both.
     
    Provided expression working as expected.

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

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 272

Last 30 days Overall leaderboard