Hello,
I've written a CUI method to instantiate a new Tech Doc from within the "Parts" page, and its' fields are set, including which schema to use.
There's a necessity to build out this new corresponding tech doc with a very specific content. I want to insert and start building the Tech Doc programmatically within this method. I've seen this example here:
//MethodTemplateName=CSharp:Aras.TDF.ContentGenerator(Strict); ItemDocumentElement targetItem = targetElement as ItemDocumentElement; if (targetItem != null) { targetItem.ClearChilds(); // if referenced item was set, then if (!targetItem.IsEmpty) { TableDocumentElement tableElement = (TableDocumentElement) this.Factory.NewTable("Table", 3, 5); tableElement.GetCell(0, 0).AddChild(this.Factory.NewText("Title", "Item Info Table")); for (int i = 0; i < tableElement.CellCount; i++) { tableElement.MergeCells(0, i, MergeDirection.Right); } tableElement.GetCell(1, 0).AddChild(this.Factory.NewText("Title", "Id")); tableElement.GetCell(1, 1).AddChild(this.Factory.NewText("Title", "Name")); tableElement.GetCell(1, 2).AddChild(this.Factory.NewText("Title", "Classification")); tableElement.GetCell(1, 3).AddChild(this.Factory.NewText("Title", "Status")); tableElement.GetCell(1, 4).AddChild(this.Factory.NewText("Title", "Date of creation")); tableElement.GetCell(2, 0).AddChild(this.Factory.NewText("Title", targetItem.ItemId)); tableElement.GetCell(2, 1).AddChild(this.Factory.NewText("Title", targetItem.GetItemProperty("name", " "))); tableElement.GetCell(2, 2).AddChild(this.Factory.NewText("Title", targetItem.GetItemProperty("classification", " "))); tableElement.GetCell(2, 3).AddChild(this.Factory.NewText("Title", targetItem.GetItemProperty("state", " "))); tableElement.GetCell(2, 4).AddChild(this.Factory.NewText("Title", targetItem.GetItemProperty("created_on"))); targetItem.AddChild(tableElement); } }
With aras innovator, inn.newItem("tp_block", "tp_GetDocument");, I am able to reference the document I intend to fetch (considering that it exists at this statement, otherwise I also create it first)
My main issue to tackle now is how to, with this document variable in cache, create new Item Document Elements, such as a Break, Chapter, Section, etc. Is this possible? Is there a way to get reference to the root Item Document Element?
Thank you