|
101 | 101 | RowIndTable = Table.AddIndexColumn(#table(type table [RowNumber=Int64.Type], RowIndices), "Index"), |
102 | 102 | ExpandMissedRows = Table.Join(RowIndTable, {"RowNumber"}, Typed, {"RowN"},JoinKind.LeftOuter), |
103 | 103 | RemovedOtherColumns1 = Table.SelectColumns(ExpandMissedRows,{"Index", "outlineLevel"}), |
104 | | - Result = if Table.IsEmpty(sheetDataTable) then #table(type table [Index = number, outlineLevel = Int64.Type],{}) else RemovedOtherColumns1 |
| 104 | + PreSort = Table.Sort(RemovedOtherColumns1, {"Index"}), |
| 105 | + Result = if Table.IsEmpty(sheetDataTable) then #table(type table [Index = number, outlineLevel = Int64.Type],{}) else PreSort |
105 | 106 | in |
106 | 107 | Result, |
107 | 108 | ///////////////////////////////////////////////////////////////////////////////////////////// |
@@ -165,13 +166,15 @@ UnZipped = Table.Buffer(fnUnZip(File.Contents(FullPath))), |
165 | 166 |
|
166 | 167 | // invoke RowsOutline function to get separate index+outlineLevel table |
167 | 168 | AddOutlineTable = Table.AddColumn(MergedRelationsTarget, "RowsOutline", each fnRowsOutline([#"Attribute:Target"]), type table), |
168 | | - // Clean table |
| 169 | + |
| 170 | +// Clean table |
169 | 171 | RemovedColumns = Table.RemoveColumns(AddOutlineTable,{"Index", "Attribute:Id", "Attribute:Target", "Attribute:name", "Attribute:sheetId", "Attribute:id"}), |
170 | 172 |
|
171 | 173 | // join [AddOutlineTable] and [Data] by rows index |
172 | | - AddedRowsOutline = Table.AddColumn(RemovedColumns, "DataWithOutline", each Table.RemoveColumns(Table.Join([RowsOutline], {"Index"}, Table.AddIndexColumn([Data],"Index"), {"Index"}),{"Index"}), type table), |
| 174 | + AddedRowsOutline = Table.AddColumn(RemovedColumns, "DataWithOutline", each Table.RemoveColumns(Table.Join([RowsOutline], {"Index"}, Table.AddIndexColumn([Data],"Index"), {"Index"}), {"Index"}), type table), |
173 | 175 |
|
174 | 176 | // add outlines to Data or not |
175 | 177 | Result = if AddOutlinesToData or AddOutlinesToData = null then AddedRowsOutline else RemovedColumns |
| 178 | + |
176 | 179 | in |
177 | 180 | Result |
0 commit comments