🐛 Fix issue looking up values with multiple empty rows (#1701)

This commit is contained in:
Ricardo Espinoza 2021-04-24 12:56:47 -04:00 committed by GitHub
parent 3904f7d568
commit 4d74e1fdea
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -409,9 +409,18 @@ export class GoogleSheet {
inputData[keyRowIndex],
];
// Standardise values array, if rows is [[]], map it to [['']] (Keep the columns into consideration)
for (let rowIndex = 0; rowIndex < inputData?.length; rowIndex++) {
if (inputData[rowIndex].length === 0) {
for (let i = 0; i < keys.length; i++) {
inputData[rowIndex][i] = '';
}
}
}
// Loop over all the lookup values and try to find a row to return
let rowIndex: number;
let returnColumnIndex: number;
lookupLoop:
for (const lookupValue of lookupValues) {
returnColumnIndex = keys.indexOf(lookupValue.lookupColumn);