Copy & Paste Values Extension [LEGACY]

Prev Next

This extension is deprecated and has been replaced by Formula Fields. Learn more here.

The Copy & Paste Values extension is designed to efficiently replicate data from one field to another within your Rossum documents. It simplifies data consistency across different document sections, ensuring uniformity and accuracy in data handling.

Configuration Basics

To configure this extension once it’s activated, you’ll need to specify a ‘source field’ and a ‘target field’. Additionally, an optional ‘condition’ attribute can be used to apply the copying operation only when certain criteria are met. This conditional logic in the form of Pythonic expression adds a layer of flexibility, allowing for more targeted and dynamic data handling.

Example Configurations

Below are example configurations showcasing the varied applications of the Copy & Paste Values extension, from simple to advanced use cases.

Example 1: Simple copy from one field to another

Copies data from original_field to duplicate_field.

{
  "operations": [
    {
      "source_field": "original_field",
      "target_field": "duplicate_field"
    }
  ]
}

Example 2: Copying a header value to each line item

Duplicates a value from header_field to line_item_field for every line item.

{
  "operations": [
    {
      "source_field": "header_field",
      "target_field": "line_item_field"
    }
  ]
}

Example 3: Conditional copy

This setup copies data from conditional_source_field to conditional_target_field when condition_field equals ‘specific_value’.

{
  "operations": [
    {
      "condition": "{condition_field} == 'specific_value'",
      "source_field": "conditional_source_field",
      "target_field": "conditional_target_field"
    }
  ]
}

Example 4: Distribution of the PO number to the line items

The configuration of the extension below assigns the Order Number from the header to line items. If an Order Number is present at both header and line item levels, the line item value is prioritized in the calculated field. Otherwise, the header value is used for line items lacking their own

In this setup, the configuration involves two operations: the first distributes the header value to line items lacking an item_order_id, and the second copies item_order_id values where they exist. This results in a item_order_id_calculated column populated with PO numbers from across the document.

{
  "operations": [
    {
      "condition": "len({line_items}) > 0 and {item_order_id} == ''",
      "source_field": "order_id",
      "target_field": "item_order_id_calculated"
    },
    {
      "condition": "len({line_items}) > 0 and {item_order_id} != ''",
      "source_field": "item_order_id",
      "target_field": "item_order_id_calculated"
    }
  ]
}

Available configuration parameters

Attribute

Type

Required

Default value

Description

operations

list

yes

-

List of definitions of operations

condition

string

no

-

Python expression containing schema ids wrapped in the {}. The calculation is performed only if the condition matches (expression evaluates to True). Condition expression supports len() usage with multivalue schema fields to define condition based on number of items in the multivalue.

source_field

string

no

-

Schema ID of the field which is the source for the value (optional field). The function can work with no source, only with default values.

condition_false_source_field

string

no

-

Schema ID of the field, which is the source for the value when the condition is evaluated to false (optional field). The function can also work without any source, only with default values.
The parameter has no effect if no condition is defined for the operation.

target_field

string

yes

-

Schema ID of the field to which the result of the operation will be written.

value_conversion

string

no

-

Conversion applied to the transferred value. Possible options:

upper – Convert value to upper case.

lower – Convert value to lower case.

capitalize – Convert the first letter of each word in the value to upper case.

default_value

string/number/date

no

-

Default value to be put into the field when value of the source_field is empty or not defined.

condition_false_default_value

string/number/date

no

-

Default value to be put into the field when the value of the condition_false_source_field is empty or not defined.
This parameter has no effect if no condition is defined for the operation.

values_mapping

dict

no

-

A dictionary containing a mapping of the values to be put to the target_field to the values of the source_field.

If the value of the source_field equals one of the keys defined in this parameter, the value corresponding to the key is put into the target_field.

If source_field has no value or if the value of the source_field is not present in the dictionary’s keys, the default_value is used.

The values_mapping is not applied when the condition is evaluated to false. Only condition_false_default_value can be used in such cases.Note that mapping can only be applied to a field of the same cardinality (line item field or header field). Therefore having a header field as source_field and a line item field as target_field (or vice versa) is an invalid configuration. You can resolve the mentioned case by setting up 2 operations chained together, the first saving mapped value into a hidden field and the second distributing the value in the hidden field to line item fields.

queues

list of integers

no

-

Queues where the operations should be applied (a subset of queues to which the extension is assigned). List of queue IDs.

If not specified, the operation applies to all queues to which the function is assigned.

excluded_queues

list of integers

no

-

Queues where the action should NOT be applied (subset of queues to which the extension is assigned). List of queue IDs.

If not specified, the operation applies to all queues to which the function is assigned.

allow_target_update

boolean

no

false

true – allows user update of the field filled out by the function.

false – doesn’t allow user update of the field. The value will always be changed back after edit.

Conclusion

In conclusion, the Copy & Paste Values extension is an invaluable tool in Rossum for ensuring data consistency and accuracy across your documents. It streamlines your workflow by simplifying the process of duplicating and distributing values. If you encounter any challenges or have questions while setting up or using this extension, don’t hesitate to reach out to Rossum support for assistance. We’re here to help you optimize your document processing experience.