Dynamic expressions allow us to automatically fill in the value of a field with simple Python commands. From dynamic expressions, we can access values stored in document properties or in other fields.
Dynamic expressions can be added from the field settings.
Click on Edit to open the editor and type your dynamic expression.
Some dynamic expressions and useful examples are listed below.
fil.filename #returns the uploaded file name sourcemetadata = filename
fil.life_cycle_state.name #returns the name of the current lifecycle state the doc is in. sourcemetadata = charact.ocr1
fil.author #returns the username of the document author. sourcemetadata = charact.ocr1
fil.author.first_name #returns the name of the document author. sourcemetadata = charact.ocr1
fil.creation_date #returns the creation date of the document. sourcemetadata = charact.ocr1
fil.version #returns the current version of the document. sourcemetadata = charact.ocr1
fil.serie.label #returns the space in which the document is located. sourcemetadata = charact.ocr1
fil.uuid #returns the internal document id
fil.validation_date #returns the validation date
You can also get values from other fields. The following shows how.
fil.gmv('metadata.Factura_ImporteFactura') #the internal name of the field in quotation marks (metadatatype)
It is also possible to use Python expressions to manipulate values, for example, if we want to keep the name of the file, but without the .pdf extension, we apply the Python function .replace()
fil.filename.replace(".pdf"," ") #delete .pdf by replacing it