Next and Previous links in link group slot

Hi,

I am trying to implement next/previous links for a link group slot.
Is there a simple way of doing this using velocity? The link group works fine and I can figure out the prev/next numeric value (if I am on link 2, prev = 1, next = 3 etc) but I cannot get the information I need to link to the previous/next items in the slot.

[COLOR=“DarkGreen”]#initslot(“orgLinkGroup” “”)
#set($counter = 0)
#if($sys.currentslot.relresults.size() > 0)
#foreach($relresult in $sys.currentslot.relresults)
#set($counter = $counter + 1)
#set($slottotal = $sys.currentslot.relresults.size())
#set($currentitem = $tools.math.toInteger($imageorder))
#set($prev = ($currentitem - 1))
#set($next = ($currentitem + 1))

	#if($currentitem == $counter)
	#set($prevlink = ??)
		#set($nextlink = ??)
		test
	#end

#end

##!$counter!
##)$currentitem(
– $prevlink – || ++ $nextlink +

#else

#end

#endslot("")[/COLOR]

Thanks

Should add that this is RX 6.5.2

I’ve still had no joy with this. Would be useful to know if anyone has tried to do something similar without having to set up DB publishing. Thanks

OK, have now found a solution to this. An Auto index was created for both the next and previous links with a query in each that pulls out the correct item information.