Power Apps Exchange

Please login or click SIGN UP FOR FREE to create your PowerAppsUG account to join this user group.
 View Only

How to Display a Text Box IF DirectReports Exist

  • 1.  How to Display a Text Box IF DirectReports Exist

    Posted 12 days ago


    I'm trying to get a text box to appear within a gallery item but only if the selectable person has Direct Reports (people reporting to him/her). If the person was selected, and no one appeared as a direct report, then that person would not have direct reports. Essentially how the App works is that, if the person shown in the dark green box has Direct Reports, they appear in the bottom section in the light green boxes. If no Direct Reports exist, there will be no light green boxes (see the attached images - info redacted due to pulling from an Active Directory - PII). The blue box just shows the manager for the dark green box employee (not important for what I'm trying to do).

    I'm trying to make it so if someone in the light green area has Direct Reports, a text box will appear in their box that says something like "Click Here to View Direct Reports". If they don't have any, then the box would just be blank/invisible.

    I'm trying to set up the bottom section so that the equation always applies (not "OnClick"). The equation used to pull in the Direct Reports is "Office365Users.DirectReportsV2(varTopManager).value" (minus the quotes). varTopManager is a variable that is defined on App Start that simply says that a specific person is the TopManager so that the dark green box knows where to start in the Org Chart. The variable updates as each light green person is selected to the person that is selected.

    This is the video I was watching that helped me set up the app (minus the text box appearing if Direct Reports exist - that's all on me): Power Apps Org Chart - How to Build Tutorial - YouTube

    I'm new to PowerApps, and I wasn't great at coding in high school (still am not), so trying to troubleshoot code to make it look for Direct Reports for a "ThisItem" or possibly a "Parent" item is difficult for me.

    This is the code I was trying to use in the text box: "If(IsBlank(Office365Users.DirectReportsV2(ThisItem.userPrincipalName).value),"Click to View Subordinates","")" (no outside quotes).

    The text box propagates to all other light green direct reports if they are present, since it's a Gallery item.

    Direct Report Issue

    Christopher West