Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(Google Sheets Node): Update to returnAllMatches option #10440

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion packages/nodes-base/nodes/Google/Sheet/GoogleSheets.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export class GoogleSheets extends VersionedNodeType {
name: 'googleSheets',
icon: 'file:googleSheets.svg',
group: ['input', 'output'],
defaultVersion: 4.4,
defaultVersion: 4.5,
subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
description: 'Read, update and write data to Google Sheets',
};
Expand All @@ -25,6 +25,7 @@ export class GoogleSheets extends VersionedNodeType {
4.2: new GoogleSheetsV2(baseDescription),
4.3: new GoogleSheetsV2(baseDescription),
4.4: new GoogleSheetsV2(baseDescription),
4.5: new GoogleSheetsV2(baseDescription),
};

super(nodeVersions, baseDescription);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,19 @@ export const description: SheetProperties = [
options: [
dataLocationOnSheet,
outputFormatting,
{
displayName: 'Return only First Matching Row',
name: 'returnFirstMatch',
type: 'boolean',
default: false,
description:
'Whether to select the first row of the sheet or the first matching row (if filters are set)',
displayOptions: {
show: {
'@version': [{ _cnd: { gte: 4.5 } }],
},
},
},
{
displayName: 'When Filter Has Multiple Matches',
name: 'returnAllMatches',
Expand All @@ -154,6 +167,11 @@ export const description: SheetProperties = [
],
description:
'By default only the first result gets returned, Set to "Return All Matches" to get multiple matches',
displayOptions: {
show: {
'@version': [{ _cnd: { lt: 4.5 } }],
},
},
},
],
},
Expand Down Expand Up @@ -219,7 +237,12 @@ export async function execute(
const inputData = data as string[][];

if (lookupValues.length) {
const returnAllMatches = options.returnAllMatches === 'returnAllMatches' ? true : false;
let returnAllMatches;
if (nodeVersion < 4.5) {
returnAllMatches = options.returnAllMatches === 'returnAllMatches' ? true : false;
ShireenMissi marked this conversation as resolved.
Show resolved Hide resolved
} else {
returnAllMatches = options.returnFirstMatch === false ? false : true;
}

if (nodeVersion <= 4.1) {
for (let i = 1; i < items.length; i++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export const versionDescription: INodeTypeDescription = {
name: 'googleSheets',
icon: 'file:googleSheets.svg',
group: ['input', 'output'],
version: [3, 4, 4.1, 4.2, 4.3, 4.4],
version: [3, 4, 4.1, 4.2, 4.3, 4.4, 4.5],
subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
description: 'Read, update and write data to Google Sheets',
defaults: {
Expand Down
Loading