entity_last
entity_last (name[, doc])
This function returns the OID of the last element within the text or file entity specified by name, for the specified doc (or current document, if none given). Returns the null OID if entity is not a file or text entity or if there are no elements within the entity.