Preview:
firstelem = List();
eachlist = List();
//
visual = Visual_Inspection[Door_ID_online = input.Door_ID_online].ID.getAll();
sizz = visual.size();
currentpos = (sizz - 1) % 4 + 1;
//
mapp = Map();
mapp = {1:0,2:1,3:2,4:3};
//fetch correct 1st visual inspection in current batch
fet = mapp.get(currentpos.toLong());
//
for each  viz in Visual_Inspection[Door_ID_online == input.Door_ID_online && archived = false] sort by Date_of_inspection desc
{
	eachlist.add(viz.ID);
}
if(eachlist.size() > 0)
{
	firstelem.add(eachlist.get(fet));
}
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter