Connecting different light boxes to gallery images dataset

yes, I guess my question is, since I have 28 different light boxes, how do i correspond the items in the gallery to the right lightboxes? I have the gallery connect to a database and so I cannot link each one to each image using the link function in the manage gallery panel.

Do i for example have to write the code below 28times with the different names?

wixWindow.openLightbox(‘Lightbox1’, $w(’ #dataset1 ').getCurrentItem());