Hi,
Table.AddColumn appears to not enforce the column type, or convert the value to the required type.
I'll illustrate this with an example:
let Source = #table ( type table [Description = text], { {"To the right you should see 51, true, text"} } ), #"Added Custom" = Table.AddColumn(Source, "Added Column", each 51, type text), #"Added Custom1" = Table.AddColumn(#"Added Custom", "Value is Text", each Value.Type([Added Column]) = type text), Custom1 = Table.AddColumn(#"Added Custom1", "Schema", each Table.Schema(#"Added Custom1") ), #"Expanded Schema" = Table.ExpandTableColumn(Custom1, "Schema", {"Name", "Kind"}, {"Schema.Name", "Schema.Kind"}), #"Filtered Rows" = Table.SelectRows(#"Expanded Schema", each ([Schema.Name] = "Added Column")), #"Removed Columns" = Table.RemoveColumns(#"Filtered Rows",{"Schema.Name"}), #"Renamed Columns" = Table.RenameColumns(#"Removed Columns",{{"Schema.Kind", "Column type"}}) in #"Renamed Columns"
This returns a table where we see: 51, false, text instead of 51, true, text, as I'm putting a value of type number into a column of type text, and the convesion is not being made.
This is already mentioned in this other post where we are encouraged to read the language spec. So I did, and it is a bit convoluted, bu that is the way the language is designed.
That being said, whilst the langueage specification does allow for a number value to be placed in a text column (or text field in a record), there is nothing to say that Table.AddColumn shouldn't raise an error, as it is a library function, not a language primitive, or at the very least a warning.
More specifically, when this is loaded into the model, the type mismatch will throw an error in the model, but that mashup engine won't show that error when I then click on show errors. As such, there is no way to know what happened, and that is a problem that needs solving.
The mashup engine should either throw an error in this instance, or some sort of warning, to aid debugging of this problem.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.