cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Srinath
Helper III
Helper III

Working with Strings

Hi,

 

I am facing a situation in my app where i have to take values from a SP list which are comma separated and check whether the content matches with the name of the logged in user.

 

For eg: The data is stored in a column as value1,value2,value3.

 

I want each value to be checked with the name of the logged in user. 

I am able to get each value by splitting the string but face issues while comparing. How can this be achieved?

Any help will be greatly appreciated.

 

Regards
Srinath

1 ACCEPTED SOLUTION

Accepted Solutions
v-xida-msft
Community Support
Community Support

Hi @Srinath ,

Could you please share a bit more about the formula you used within your app?

 

Based on the needs that you mentioned, I think the If function and in operator could achieve your needs. Please consider take a try with the following formula (set the Text property of a Label to following😞

If(
   User().FullName in Split(
                            LookUp('Your SP List', FileredColumn = "xxxx", TextStringColumn),
                            ","
                      ),
   "Matche...",
   "Mismatch...."
)

Note: The TextStringColumn represents the Text column in your SP List, which is used to store the comma separated value.

 

Please consider take a try with above formula, then check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

5 REPLIES 5
WarrenBelz
Super User
Super User

Hi @Srinath ,

Is your list under 2000 items?

If so the easiest would be to Collect it (replace with your names)

ClearCollect(
   ShowColumns(
      colNames,
      YourListName,
      "YourStringField"
   )
)

Next it is best practice to set a variable for the user name at App OnStart

Set(vUser,User().FullName)

Then all you have to do is 

If(
   isBlank(
      Lookup(
         vUserName In colNames.YourStringField
      )
   ),
   Whatever you do when not there,
   Whatever you do when name is in list
)

The reason for the collection is that the In filter is not delegable

There are other solutions including using the Split function to turn the field into a list

 

Please click Accept as solution 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 Thumbs Up.

Pranav_Shroti
Kudo Collector
Kudo Collector

If you already have it in a single column, you need not split it. You can use a simple function FIND. Check the screenshot below:

Find returns the starting position of the string that was found. Position 1 is the first character of the string. Find returns blank if the string in which you're searching doesn't contain the string for which you're searching.

 

Find.PNG

More details: 

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-find

 

Hope this helps,

Pranav

@Pranav_Shrotiis correct, it is not something I use a lot and it slipped my mind. It is a better less complex solution

Hi @Pranav_Shroti ,

 

Thanks for the response.

 

Can I use the same to filter the data in a gallery according to the logged in user?

 

My column name is Instructors and values for a row are a,b,c

When 'b' is using the app i want to display only those rows where one of the instructor is 'b'.

Every row may or may not have multiple instructors.

 

Kindly help me out here.

 

Regards

Srinath

 

 

v-xida-msft
Community Support
Community Support

Hi @Srinath ,

Could you please share a bit more about the formula you used within your app?

 

Based on the needs that you mentioned, I think the If function and in operator could achieve your needs. Please consider take a try with the following formula (set the Text property of a Label to following😞

If(
   User().FullName in Split(
                            LookUp('Your SP List', FileredColumn = "xxxx", TextStringColumn),
                            ","
                      ),
   "Matche...",
   "Mismatch...."
)

Note: The TextStringColumn represents the Text column in your SP List, which is used to store the comma separated value.

 

Please consider take a try with above formula, then check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (3,026)