Data Manipulation Utilities
List of Functions
Getting Started
import_helper("data_utils")Import the data_utils integration helper in the Integration Before Hook to expose the helper functions to the integration’s namespace.
extract_chars()
data_utils.extract_chars(field, start=0, stop=None, step=None)Takes str or Flex(None) input and returns spliced output using typical python string splicing logic. Returns None for Flex(None)
data_utils.extract_chars("test123abc", 4) -> "test"
data_utils.extract_chars("test123abc", 7, 100) -> "abc"
data_utils.extract_chars("test123abc", 0, 7, 2) -> "ts13"
data_utils.extract_chars("") -> ""
data_utils.extract_chars(None, 0, 7, 2) -> Noneextract_digits()
Given a str or Flex(None) input, and outputs all digits.
percent_to_decimal()
Given an int, float, Decimal, or number in str format and returns value in decimal format.
round_half_up()
Given an input of float, int, Decimal, or number in str format, outputs a Decimal number rounded to n decimal places. This implements the typical round half up strategy where 0.5 rounds up.
get_current_date_string()
Given a time zone and datetime format input, returns the current date str in the specified format.
All timezones in the pytz package are supported. Here are the major US time zones:
US/CentralUS/EasternUS/MountainUS/Pacific
You can use the following Python to capture the full list:
convert_date_string()
Given a date string and it’s date time format, converts to the specified output format as a date string. (default output format is "%Y-%m-%d")\
IndexGenerator
This class is intended to generate numbers sequentially. A typical use case would be to define field mapping paths with next() and .last so that the Field Mapping paths are dynamically generated and an Include For Each isn’t necessary.
Be aware that Integration Gateway evaluates the Value Column on the Field Mapping table before the Field column which can result in unintended behavior. e.g.:
Last updated
Was this helpful?