Skip to content

Commit

Permalink
Merge pull request #503 from KxSystems/KXI-58865-2
Browse files Browse the repository at this point in the history
fix abnormal count of rows
  • Loading branch information
Philip-Carneiro-KX authored Jan 23, 2025
2 parents 212f92a + 525980a commit b012300
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/commands/serverCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1264,7 +1264,7 @@ export async function writeScratchpadResult(
let errorMsg;

if (result.error) {
errorMsg = result.errorMsg;
errorMsg = "Error: " + result.errorMsg;

if (result.stacktrace) {
errorMsg =
Expand Down
18 changes: 14 additions & 4 deletions src/services/resultsPanelProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,14 +191,24 @@ export class KdbResultsViewProvider implements WebviewViewProvider {
}

updatedExtractRowData(results: StructuredTextResults) {
const { columns, count } = results;
const { columns } = results;
const columnsArray = Array.isArray(columns) ? columns : [columns];

let dataLength = 0;
if (columnsArray.length > 0) {
const firstColumnValues = columnsArray[0].values;
if (Array.isArray(firstColumnValues)) {
dataLength = firstColumnValues.length;
} else {
dataLength = 1;
}
}

const rowData: { [key: string]: any }[] = Array.from(
{ length: count },
{ length: dataLength },
() => ({}),
);

const columnsArray = Array.isArray(columns) ? columns : [columns];

columnsArray.forEach((column) => {
const { name, values } = column;
values.forEach((value, index) => {
Expand Down

0 comments on commit b012300

Please sign in to comment.