Link Lightboxes to Gallery Connected to Database

I have a gallery that populates images from a database. I’d like each image in the gallery to open a specific lightbox when clicked. Each lightbox is listed in the same database with the appropriate image.

From my research so far, I understand that this is not as straightforward as I’d hope.

I’m thinking I could use some code that opens a lightbox onItemClicked for the gallery… where the name of the lightbox is populated from a text field on the corresponding collection. Thoughts?

Unfortunately, I’m no good at coding. Here’s what I’ve come up with and, obviously, it isn’t working.

import wixData from ‘wix-data’ ;

export function gallery3_itemClicked ( event ) {

wixWindow . openLightbox ( name = “(‘#dataset’.lightbox”