Changing Properties¶
Changing Properties¶
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 if doc.checkout():
23 ot.add("Successfully checked out document")
24
25 columns = doc.type.columns
26 values = doc.active_checkout.values
27
28 values.save(columns.known_item(ipDocumentKnownColumn.dkcDescription).name, "My Second Document")
29
30 ot.add("Updating active document values")
31
32 if values.do_update():
33 ot.add("Successfully updated active document values")
34
35 if doc.active_checkout.checkin(ipDocumentVersion.dvMajor, "My Checkin Comment"):
36 ot.add("Successfully checked in document")
37 else:
38 ot.add("Unable to checkin document")
39
40 else:
41 ot.add("Unable to update active document values")
42
43 else:
44 ot.add("Unable to checkout document")
45
46 for item in doc.history:
47 ot.add(" Operation: " + str(item.operation_as_string) + " by " + str(item.modified_by.login_id) + " at " + str(item.modified_date_time))
48 if len(item.details) > 0:
49 ot.add(" " + str(item.details))
50
51 else:
52 ot.add("Unable to locate document")
53else:
54 ot.add("Unable to locate a customer")
55
56