Iterating All Versions

Iterating All Versions
 1ot = impact.gui.output_toolbox
 2db = impact.active_database
 3
 4ot.clear()
 5
 6cust = db.customers.find_by_code("ACME CORP")
 7
 8if cust is not None:
 9    docs = cust.documents
10
11    if docs is None:
12        ot.add("No customer document support in the database")
13    else:
14        ot.add("customer document support is enabled in this database")
15
16        doc = docs.item("Acme Corporation Specifications.docx")
17
18        if not doc.isNone():
19            ot.add("Document: '" + doc.name + "', impact.creator: " + str(doc.added_by.login_id) + ", Size: " + str(doc.size) + " bytes")
20            ot.add("  IsLatestVersion: " + str(doc.is_latest_version))
21
22            for doc_v in doc.all_versions:
23                ot.add("version: " + str(doc_v.version.version_as_string) + ", ModifiedBy: " + str(doc_v.modified_by.login_id) + " at " + str(doc_v.modified_date_time))
24
25        else:
26            ot.add("Unable to locate document")
27else:
28    ot.add("Unable to locate a customer")
29
30