0
votes

In the M language is there a way to ignore case when using commands like Table.TransformColumnTypes? I had a column named "Task" that was renamed "TASK" and is now causing an Expression Error. I didn't expect column headings to be case sensitive since that's not normally an issue in SQL.

The step formula looks like this:

= Table.TransformColumnTypes(#"Removed Columns",{{"Task", type text}, {"Employee Name", type text}})

which returns this error:

Expression.Error: The column 'Task' of the table wasn't found. Details: Task

As I go through and adjust the case of each instance of "Task", I also get errors with these commands that are still referencing the "Task" field:

Table.Group
Table.RemoveColumns
Table.Sort
Table.TransformColumns
Table.TransformColumnTypes
Text.Combine

Note that I found an article about using Comparer.OrdinalIgnoreCase but that appears to apply to data in the table and not the column headings.

1

1 Answers

1
votes

It can't be ignored,but you can rename all the column names by this formula:

= Table.RenameColumns(YourTableName,List.Transform(Table.ColumnNames(YourTableName),each {_,Text.Proper(_)}))

Comparer.OrdinalIgnoreCase only can be used in this condition:

= Text.Contains("abc","A", Comparer.OrdinalIgnoreCase) //returns true