Minor improvements to Quickbase Node

This commit is contained in:
Jan Oberhauser 2021-04-30 21:49:15 -05:00
parent 35cae02a36
commit 0b69310bed
3 changed files with 27 additions and 32 deletions

View file

@ -41,7 +41,7 @@ export async function quickbaseApiRequest(this: IExecuteFunctions | ILoadOptions
body,
qs,
uri: `https://api.quickbase.com/v1${resource}`,
json: true
json: true,
};

View file

@ -230,8 +230,6 @@ export class QuickBase implements INodeType {
if (operation === 'create') {
const tableId = this.getNodeParameter('tableId', 0) as string;
const useFieldIDs = this.getNodeParameter('useFieldIDs', 0) as boolean;
const simple = this.getNodeParameter('simple', 0) as boolean;
const data: IDataObject[] = [];
@ -244,7 +242,7 @@ export class QuickBase implements INodeType {
const columns = this.getNodeParameter('columns', i) as string;
const columnList = columns.split(',').map(column => column.trim());
if (useFieldIDs) {
if (options.useFieldIDs === true) {
for (const key of Object.keys(items[i].json)) {
record[key] = { value: items[i].json[key] };
}
@ -372,8 +370,6 @@ export class QuickBase implements INodeType {
const { fieldsLabelKey, fieldsIdKey } = await getFieldsObject.call(this, tableId);
const useFieldIDs = this.getNodeParameter('useFieldIDs', 0) as boolean;
const simple = this.getNodeParameter('simple', 0) as boolean;
const updateKey = this.getNodeParameter('updateKey', 0) as string;
@ -389,7 +385,7 @@ export class QuickBase implements INodeType {
const columnList = columns.split(',').map(column => column.trim());
if (useFieldIDs) {
if (options.useFieldIDs === true) {
for (const key of Object.keys(items[i].json)) {
record[key] = { value: items[i].json[key] };
}
@ -447,9 +443,6 @@ export class QuickBase implements INodeType {
if (operation === 'upsert') {
const tableId = this.getNodeParameter('tableId', 0) as string;
const useFieldIDs = this.getNodeParameter('useFieldIDs', 0) as boolean;
const simple = this.getNodeParameter('simple', 0) as boolean;
const updateKey = this.getNodeParameter('updateKey', 0) as string;
@ -467,7 +460,7 @@ export class QuickBase implements INodeType {
const columnList = columns.split(',').map(column => column.trim());
if (useFieldIDs) {
if (options.useFieldIDs === true) {
for (const key of Object.keys(items[i].json)) {
record[key] = { value: items[i].json[key] };
}

View file

@ -69,7 +69,7 @@ export const recordFields = [
description: 'The table identifier',
},
{
displayName: 'Insert Fields',
displayName: 'Columns',
name: 'columns',
type: 'string',
displayOptions: {
@ -87,25 +87,6 @@ export const recordFields = [
placeholder: 'Select Fields...',
description: 'Comma separated list of the properties which should used as columns for the new rows.',
},
{
displayName: 'Use Field IDs',
name: 'useFieldIDs',
type: 'boolean',
displayOptions: {
show: {
resource: [
'record',
],
operation: [
'create',
'upsert',
'update'
],
},
},
default: false,
description: 'Use Field IDs instead of Field Names in Insert Fields.',
},
{
displayName: 'Simplified Response',
name: 'simple',
@ -152,7 +133,14 @@ export const recordFields = [
},
default: [],
description: `Specify an array of field ids that will return data for any updates or added record. Record ID (FID 3) is always returned if any field ID is requested.`,
}
},
{
displayName: 'Use Field IDs',
name: 'useFieldIDs',
type: 'boolean',
default: false,
description: 'Use Field IDs instead of Field Names in Columns.',
},
],
},
/* -------------------------------------------------------------------------- */
@ -443,6 +431,13 @@ export const recordFields = [
default: [],
description: `Specify an array of field ids that will return data for any updates or added record. Record ID (FID 3) is always returned if any field ID is requested.`,
},
{
displayName: 'Use Field IDs',
name: 'useFieldIDs',
type: 'boolean',
default: false,
description: 'Use Field IDs instead of Field Names in Columns.',
},
// {
// displayName: 'Merge Field ID',
// name: 'mergeFieldId',
@ -583,6 +578,13 @@ export const recordFields = [
default: [],
description: `Specify an array of field ids that will return data for any updates or added record. Record ID (FID 3) is always returned if any field ID is requested.`,
},
{
displayName: 'Use Field IDs',
name: 'useFieldIDs',
type: 'boolean',
default: false,
description: 'Use Field IDs instead of Field Names in Columns.',
},
],
},
] as INodeProperties[];