Gooday,
Can anyone please help decipher the below error and how to solve the problem will be much appreciated
let
Source = #“F_TransList(MSF900)”,
#“Detected Type Mismatches” = 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),
#“Added Index” = Table.AddIndexColumn(#“Detected Type Mismatches”, “Row Number” ,1),
#“Kept Errors” = Table.SelectRowsWithErrors(#“Added Index”, {“District”, “Period”, “Transaction No.”, “Tran Type”, “Jnl”, “Work Order”, “PO No.”, “JNL_ITEM”, “Invoice No.”, “Project No”, “CC”, “EE”, “Invoice Description”, “Amount”, “QUANTITY_ISS”, “STOCK_CODE”, “JnlNo_Jnlitem_AccCode”, “Parent”, “Cost Responsibility”, “CC_Description”, “EEParent”, “D_SAP-EEParent_map”}),
#“Reordered Columns” = Table.ReorderColumns(#“Kept Errors”, {“Row Number”, “District”, “Period”, “Transaction No.”, “Tran Type”, “Jnl”, “Work Order”, “PO No.”, “JNL_ITEM”, “Invoice No.”, “Project No”, “CC”, “EE”, “Invoice Description”, “Amount”, “QUANTITY_ISS”, “STOCK_CODE”, “JnlNo_Jnlitem_AccCode”, “Parent”, “Cost Responsibility”, “CC_Description”, “EEParent”, “D_SAP-EEParent_map”})
in
#“Reordered Columns”
Thank you in advance