Creating Other Documents¶
Creating Other Documents¶
1ot = impact.gui.output_toolbox
2db = impact.active_database
3
4ot.clear()
5
6docs = db.documents
7
8if docs is None:
9 ot.add("No document support in the database")
10elif db.settings.other_documents:
11 ot.add("Other document support is enabled in this database")
12 ot.add(str(docs.total_count) + " documents currently in the database")
13
14 doc = docs.add(r"C:\\Documents\\ExampleDocument1.docx", "My First Document")
15
16 if not doc.isNone():
17 ot.add("Document '" + doc.name + "' successfully created")
18
19 if not doc.database_item.isNone():
20 ot.add("ERROR: DatabaseItem should not be set")
21
22 if not doc.customer.isNone():
23 ot.add("ERROR: customer should not be set")
24
25 ot.add("Added: " + str(doc.added_date_time) + " by " + str(doc.added_by.login_id))
26 ot.add("version: " + str(doc.version.version_as_string))
27 ot.add("Size: " + str(doc.size) + " bytes")
28 ot.add("Relationship Count: " + str(doc.relationships.count))
29
30 else:
31 ot.add("Unable to create new document")
32
33 # must reload IDocuments
34 docs = db.documents
35 ot.add(str(docs.total_count) + " documents currently in the database")
36
37
38