'Get array of joined values from Google sheets

In a Google sheet I have objects (rows) which are unambiguously identifiable by combination of two of their values id and date stored in non adjacent columns. Now I need to check if a certain object of this type exist within this sheet and if so in which row. I'd like to have an array like object[<index = row no>][<id>+<delimiter>+<date>] that allows me to find and locate one of them by this:

sheet = SpreadsheetApp.openById('1234567890').getSheetByName('Entries List');
objectsIds = sheet.getRange(1, 5, 100).getDisplayValues();    // with 5 = column containing ids
objectsDates = sheet.getRange(1, 11, 100).getDisplayValues(); // with 11 = column containing dates

// Create array of objects with joint/combined value of id+#+date:
//                                 <-------ID---------->#<--date-->
consloe.log(objects[0]); // writes e. g. "4e6aa8-8f709d-a208b38#2022-02-19" which is unambiguously identifiable

sampleIdDate = sampleId + "#" + sampleDate;
rowOfFirstOccurance = objects.findIndex(e => === sampleIdDate);

Actually the delimiter can be omitted. What is the best way to create this array of combined values in one attribute/field?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source