Creating an item and assigning values in Java™ classes
Use replaceItemValue or appendItemValue in Document to create an item and assign a single value. Prefer replaceItemValue unless your intent is to create another item with the same name (not recommended).
From the Document level, use replaceItemValue to assign single values to items (providing that two items do not have the same name). From the Item level, use setDateTimeValue, setValueDouble, setValueInteger, and setValueString to set a single date-time, numeric, or text value. Use setValues in Item to set the values of a single or multi-value item; setValues passes a vector of DateTime, Double, Integer, or String values. In Item, qppendToTextList is convenient for adding values to a multi-value text item.
After creating or replacing an item, you must call save on the Document object containing the item or the update is lost when the program exits.
You can run a form's default value, translation, and validation formulas on the item that corresponds to a field with computeWithForm in Document.
Computed fields are not recalculated when you save a document. If you change items that affect a computed field and want the new value to be available immediately (for example, if you want the user to see the new value in a view or you want to use the new value in a calculation), you must calculate the value in the program.
The user cannot see an item as a field in the document unless you add the field to the form design. However, the item exists and can be accessed programmatically.
You can replace the value of an item in every document of a document collection with the stampAll method of DocumentCollection. This method writes immediately to the documents in storage. Be sure to save all documents (save method of Document) that you have modified before using stampAll on them. You do not have to save after stampAll.