Skip to content

Commit

Permalink
fix(all): Fix in AS IMAGE generation of single row.
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigorodriguez committed Jul 23, 2023
1 parent e77b583 commit 618ff5a
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
10 changes: 10 additions & 0 deletions packages/basic.gblib/services/DialogKeywords.ts
Original file line number Diff line number Diff line change
Expand Up @@ -582,6 +582,16 @@ export class DialogKeywords {
await DialogKeywords.setOption({ pid, name: 'maxLines', value: count });
}

/**
* Define array as output.
*
* @example SET OUTPUT ARRAY
*
*/
public async setOutput({ pid, value }) {
await DialogKeywords.setOption({ pid, name: 'output', value: value });
}

/**
* Defines a custom user param to be persisted to storage.
*
Expand Down
7 changes: 7 additions & 0 deletions packages/basic.gblib/services/KeywordsExpressions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -625,6 +625,13 @@ export class KeywordsExpressions {
}
];

keywords[i++] = [
/^\s*(set output)(\s*)(.*)/gim,
($0, $1, $2, $3) => {
return `await dk.setOutput ({pid: pid, value: ${$3}})`;
}
];

keywords[i++] = [
/^\s*(set max lines)(\s*)(.*)/gim,
($0, $1, $2, $3) => {
Expand Down
4 changes: 3 additions & 1 deletion packages/basic.gblib/services/SystemKeywords.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1121,10 +1121,12 @@ export class SystemKeywords {
}
}

const outputArray = await DialogKeywords.getOption({ pid, name:"output" });

if (table.length === 1) {
GBLog.info(`BASIC: FIND returned no results (zero rows).`);
return null;
} else if (table.length === 2) {
} else if (table.length === 2 && !outputArray) {
GBLog.info(`BASIC: FIND returned single result: ${table[0]}.`);
return table[1];
} else {
Expand Down

0 comments on commit 618ff5a

Please sign in to comment.