Forum Discussion
Detection Type Mismatches
Hello,
Can you please help me on this error as I'm not sure what went wrong with the type mismatches. Truly appreciate the assistance.
= let
tableWithOnlyPrimitiveTypes = Table.SelectColumns(Source, Table.ColumnsOfType(Source, {type nullable number, type nullable text, type nullable logical, type nullable date, type nullable datetime, type nullable datetimezone, type nullable time, type nullable duration})),
recordTypeFields = Type.RecordFields(Type.TableRow(Value.Type(tableWithOnlyPrimitiveTypes))),
fieldNames = Record.FieldNames(recordTypeFields),
fieldTypes = List.Transform(Record.ToList(recordTypeFields), each [Type]),
pairs = List.Transform(List.Positions(fieldNames), (i) => {fieldNames{i}, (v) => if v = null or Value.Is(v, fieldTypes{i}) then v else error [Message = "The type of the value does not match the type of the column.", Detail = v], fieldTypes{i}})
in
Table.TransformColumns(Source, pairs)
2 Replies
- NaveenGandhi
Memorable Member
Hello Anonymous
Can you share the datatype of "Pairs" column and explain about the operation you are performing, Either with sample data or screenshot?Regards,
Naveen - Satoshi21New Member
Im getting the same issue, any solution you have found ?