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 / Contains or SubString ...
Power Apps
Answered

Contains or SubString function?

(2) ShareShare
ReportReport
Posted on by Microsoft Employee

Is there by chance a Contains or SubString function? Since I believe Office365.MyProfile() doesn't display if the current user is a Vendor or FTE, I was wondering if PowerApps has a way to determine if the Office365.MyProfile().Email or User().Email has the "v-" substring to determine whether or not they are a Vendor or FTE?

Categories:
I have the same question (0)
  • Verified answer
    rgruian Profile Picture
    on at

    There are several ways to accomplish this, the easiest of which is to use the "in" operator:

     

       "v-" in yourTextValue

     

    You can also use the Find function:

     

       Find(find_text, within_text, optional start_index)

     

    Yet another way to do it is to use the Left function:

     

      Left(yourTextValue, 2) = "v-"

     

     

     

  • kianlutu Profile Picture
    Microsoft Employee on at

    Thanks for your response.

     

    Now im running into the issue of trying to change the value of a drop down from an if statement using this logic.

     

    If( "v-" in yourTextValue, "Vendor", FTE)

     

    Power apps is complaining about expecting record values. How do I pull the record value from my dropdown?

  • rgruian Profile Picture
    on at

     

    What are you binding your dropdown to?

     

    Dropdowns, like listboxes and galleries, are typically bound to tabular data sources (tables), with one or more columns. The shell will make it possible for you to specify which of the columns/fields will be rendered in the dropdown. However, selecting one item will select the entire corresponding row of input.

     

    For example, assuming that you have a data source Employees with the following fields: Name, Category, Title.

     

    dropdown.Items = Employees

        Value = Name

     

    The specifics of "Vendor" vs "FTE" will be part of your tabular data, and will show up in the dropdown automatically.

     

    If on the other hand you just want to show a simple dropdown that lets you select between two options "Vendor" vs "FTE", do this instead:

     

    dropdown.Items = ["Vendor", "FTE"]

     

    It all depends on what your scenario calls for.

  • kianlutu Profile Picture
    Microsoft Employee on at

    So the scenario is we're pulling in a list from sharepoint and we want to automate the population of this dropdown field if possible where the options are "FTE" or "Vendor"

     

    What we have is...

     

    If("v-" in Office365Users.MyProfile().Email, DataCardValue.Items. = EmployeeType.Value = "Vendor", DataCardValue.Items. = EmployeeType.Value = "Vendor")

     

    DataCardValue is our dropdown

    EmployeeType is our tabular data source I guess

     

    The condition I believe is correct the last two parts don't seem to work still based on your feedback

     

    How can we switch the drop down to one of the tabular data sources, "FTE" or "Vendor"?

     

  • rgruian Profile Picture
    on at

    The formula you pointed out seems syntactically incorrect. Just a quick reminder, PowerApps has a functional language, whereby each element declares where it draws its value(s) from; as opposed to an imperative language whereby each element would push value(s) into other relevant elements. This is similar to what happens in Excel: each cell declares where it draws its value(s) from, and how those values are composed to form the final value flowing into the cell.

     

    Back to your example, it sounds like what you need is to populate the dropdown with a one-column table that contains two values: "Vendor", and "FTE".

     

    - If you are using a Form, try changing the type of your field to "Choice" in Sharepoint, and specify what the choices are. PowerApps should pick up this metadata automatically, and the FTE/Vendor choices will show up in the resulting form / dropdown.

     

    - If you are not using a Form but instead building a custom experience, then simply bind the dropdown to an inlined one-column table, like this:

        dropdown.Items = ["FTE", "Vendor"]

     

     

  • Community Power Platform Member Profile Picture
    on at

    Hi @rgruian ,

     

    Thanks for this. Is there a way to write multiple values with the 'in operator:

     

    For Example: "A", "B", "C" in datacard.

     

    I found that I needed to write it like this for it to work:

     

    "A" in datacard || "B" in datacard || "C" in datacard.

     

    Thank you.

     

    Regards,

     

    Daniel

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