Latest revision number on sheet

I don’t know if this is what you mean, but I hope it can help.

def GetRevisionSequences(sheets):
    revisionSequences = []
    for sheet in sheets:
        sub_lst = []
        revision_Ids = sheet.GetAllRevisionIds()
        # print (revisions)
        for Id in revision_Ids:
            sub_lst.append(doc.GetElement(Id).SequenceNumber)
        revisionSequences.append(sub_lst)
    return revisionSequences

def GetAllRevisionsOnSheet(sheets):
    revisions = []
    for sheet in sheets:
        sub_lst = []
        revision_Ids = sheet.GetAllRevisionIds()
        for Id in revision_Ids:
            sub_lst.append(doc.GetElement(Id))
        revisions.append(sub_lst)
    return revisions

selectedSheets = forms.select_sheets()
allRevisions = GetAllRevisionsOnSheet(selectedSheets)
revisionSequences = GetRevisionSequences(selectedSheets)
latestIndex = [len(revList)-1 for revList in revisionSequences]
latestRevision = []
for sublst,ind in zip(allRevisions,latestIndex):
    latestRevision.append(sublst[ind])


print ("All revision sequences on sheets: ")
print (revisionSequences)
print ("---------------------------------------------------------------------")
print ("The latest index: ")
print (latestIndex)
print ("---------------------------------------------------------------------")
print ("The latest revision: ")
print (latestRevision)

1 Like