Forum

How to apply Compar...
 
Notifications
Clear all

How to apply Compare.OrdinalIgnorecase to List.PositionOf

4 Posts
2 Users
0 Reactions
255 Views
(@bluesky63)
Posts: 162
Estimable Member
Topic starter
 

Hi,

anyway can help in implementing the case sensitivity in List.PositionOf ?

for the attached lkianchoo suppose to return with Dept value, however the master table is Lkianchoo

 trying to apply case sensitivity using Compare.OrdinalIgnorecase, wrap the two parameters with Text.Upper() etc,  but encounter cannot convert a value of type Function to type Type,  or cannot convert a value of type List to type text etc

any workaround or solution will be appreciated

Thank you Sir/Madam

 
Posted : 29/07/2022 2:58 am
Riny van Eekelen
(@riny)
Posts: 1185
Member Moderator
 

Change the script to this:

let
Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Name", type text}, {"Age", Int64.Type}}),
#"Added Custom" = Table.AddColumn(#"Changed Type", "Index", each List.PositionOf(Master[Userid],[User Name],1,Comparer.OrdinalIgnoreCase
)),
#"Added Custom1" = Table.AddColumn(#"Added Custom", "Dept", each try Master[Dept]{[Index]} otherwise "Not found")
in
#"Added Custom1"

 
Posted : 29/07/2022 3:34 am
(@bluesky63)
Posts: 162
Estimable Member
Topic starter
 

Hi Riny

Wow,  so is possible to apply Comparer.OrdinalIgnoreCase to List,   and what does the 1 stand for ?

thank you so much Sir

 
Posted : 29/07/2022 4:21 am
Riny van Eekelen
(@riny)
Posts: 1185
Member Moderator
 

According to the M function reference, the place where I entered 1 is for an "optional occurrence parameter". Even though it says "optional" one would expect that you can leave it out and just type ......[User Name],,Comparer.OrdinalIgnoreCase.....

Do that you get error. Enter 0 or 1 will work just fine. Anything greater creates lists of occurrences.

Why you must fill in something when it's supposed to be optional , I don't know.

 
Posted : 29/07/2022 4:54 am
Share: