cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
jharville1
Helper IV
Helper IV

Recognize character as a delimiter in collection, compare collection to current user info, and execute a function if match is true

Hello!

 

I have one collection that is created in the OnStart of my app:

 

jharville1_1-1613459475399.png

 

^^ The collection, colLegalGroup, is a collection that pulls the "routeEmail" column from my SharePoint list, 'cfa review materials'. The "routeEmail" column of my SharePoint list contains either one email address, or multiple email addresses (each separated by a semi-colon)

 

142am.png

---------------------------------------------------------------------------------------------

 

Essentially, what I am trying to do is to compare the routeEmail column from my colLegalGroup collection to the email address of the currently logged in user ... and if they are a match, the screen will navigate to EditScreen1. If they are not a match, the screen will navigate to DetailScreen1.

 

 

This is the code that I used for the comparison (implemented within the OnSelect of a Record in my BrowseGallery):

 

jharville1_0-1613459339831.png

 

The above code works, but not to the extent that I'd like it. If I am currently logged in with the Gmail email address (123@gmail.com), but have the Gmail email address typed in with another email address (in the case: abc@yahoo.com) in my SharePoint list separated by a semi-colon (but not in its own row) ... the comparison does not work and it takes the user to the DetailScreen1, even though 123@gmail.com exists in the SharePoint List. If 123@gmail.com is typed in its own row (and not with another email address separated by a semi-colon), the comparison will work and it will navigate to the EditScreen1.

 

142am.png

 

My question is:

1) Is a semi-colon the default delimiter (separator) for multiple items in a column of a SharePoint List?

2) If so, how would I be able to modify my code to use the semi-colon as a delimiter and recognize the email addresses typed before and after the semi-colon as separate items?

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
HenryARPhillips
Continued Contributor
Continued Contributor

So in that case I would expect to see something like:

 

Clear(colTestSplit);
ForAll(cfa review materials,Collect(colTestSplit,Split(routeEmail,";")))

 

Not sure if the List Name will come through exactly like that, but it should auto predict as you start to type in the Formula.

 

Also the above is presuming you have added the list to the app as a data source.

 

Basically from the above example you should be able to see where the List is going in and Column.

View solution in original post

8 REPLIES 8
HenryARPhillips
Continued Contributor
Continued Contributor

Hi,

 

Have you tried looking at utilising the Split Funtion. 

 

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

 

I would say that the common delimiter would have been a comma.

 

Also what might be worth a shot is when looking to see if the email is present try an In operator.

 

@HenryARPhillips 

 

Hello,

 

Yes, I have tried using the Split() function.

 

jharville1_0-1613500095632.png

^^ I've tried nesting the Split() function inside of the First() function, and it only pulls the first item before the semi-colon. However, I want all items that are separated by a semi-colon. I tried removing the First() function while leaving the Split() function inside it, and no items are pulled at all.

 

(I used a Data Table and Labels for testing purposes to see what is pulled).

 

HenryARPhillips
Continued Contributor
Continued Contributor

Hi,

 

Why don't you try something like:

HenryARPhillips_0-1613514254199.png

 

@HenryARPhillips 

 

Thank you for the response. What was the "Users" variable you used and where did it come from?

 

jharville1_1-1614016967178.png

 

Here is the error details:

 

jharville1_0-1614016449897.png

^^Somehow it isn't liking my code. The Clear() function didn't throw any errors. I understand we created the colTestSplit in the Clear() function as our new collection to hold what is eventually split, but think the error is coming from where you put "Users" in your code. I just need to know what is the equivalent object in my code since everything is named differently on my end.

 

Thank you!

HenryARPhillips
Continued Contributor
Continued Contributor

Hi,

 

So for me I have confusingly got a SharePoint List connected to the App called split and a Users column within. So I am basically doing a ForAll entries in the List called Split, Split on the values in the Users column.

HenryARPhillips_0-1614019821529.png

But looking at your above examples you are doing the same? Out of interest what type of SP List column is routeEmail and ColRev?

Mine was just a 

HenryARPhillips_1-1614019917415.png

 

So my SharePoint list is actually called 'cfa review materials' ...

and my column that contains the email addresses is called "routeEmail"

 

"routeEmail" is a single line of text-type column

HenryARPhillips
Continued Contributor
Continued Contributor

So in that case I would expect to see something like:

 

Clear(colTestSplit);
ForAll(cfa review materials,Collect(colTestSplit,Split(routeEmail,";")))

 

Not sure if the List Name will come through exactly like that, but it should auto predict as you start to type in the Formula.

 

Also the above is presuming you have added the list to the app as a data source.

 

Basically from the above example you should be able to see where the List is going in and Column.

View solution in original post

@HenryARPhillips 

 

And that worked perfectly. Thank you so much. It makes a ton of sense to put the Collect() inside of the ForAll() to parse through all materials of my SharePoint List.

 

Thanks again, I really do appreciate it!

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

secondImage

Power Apps Community Call

Please join us on Wednesday, October 20th, at 8a PDT. Come and learn from our amazing speakers!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Users online (2,481)