fix(all): Fix in AS IMAGE generation of single row.

This commit is contained in:
Rodrigo Rodriguez 2023-07-23 17:33:13 -03:00
parent e77b583ff1
commit 618ff5a296
3 changed files with 20 additions and 1 deletions

View file

@ -582,6 +582,16 @@ export class DialogKeywords {
await DialogKeywords.setOption({ pid, name: 'maxLines', value: count }); 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. * Defines a custom user param to be persisted to storage.
* *

View file

@ -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++] = [ keywords[i++] = [
/^\s*(set max lines)(\s*)(.*)/gim, /^\s*(set max lines)(\s*)(.*)/gim,
($0, $1, $2, $3) => { ($0, $1, $2, $3) => {

View file

@ -1121,10 +1121,12 @@ export class SystemKeywords {
} }
} }
const outputArray = await DialogKeywords.getOption({ pid, name:"output" });
if (table.length === 1) { if (table.length === 1) {
GBLog.info(`BASIC: FIND returned no results (zero rows).`); GBLog.info(`BASIC: FIND returned no results (zero rows).`);
return null; return null;
} else if (table.length === 2) { } else if (table.length === 2 && !outputArray) {
GBLog.info(`BASIC: FIND returned single result: ${table[0]}.`); GBLog.info(`BASIC: FIND returned single result: ${table[0]}.`);
return table[1]; return table[1];
} else { } else {