Loader Helper Functions
This document provides a reference for all built-in loader, validation and monitoring functions available in OpenDataDSL.
currentEnv()
Category: Loader
Description: The platform environment the script is running against, with its name and api URL
Parameters:
Returns: Object
extractDates(text)
Category: Loader
Description: Finds the dates written in a line of text, such as 19 July 2025 or 14, 15 and 16 July 2025. Returns an object with the list of dates and the kind of text: single, list or range
Parameters:
text(String) - The text to read
Returns: Object
firstElementOf(items, value)
Category: Loader
Description: The position of the first item of a list that equals a value, ignoring case, or -1
Parameters:
items(List) - The listvalue(String) - The value to find
Returns: Integer
formatDateLocale(date, format, locale)
Category: Loader
Description: Converts a string to a Date using a date format and a locale for the month and day names
Parameters:
date(String) - The date textformat(String) - The date formatlocale(String) - The locale, e.g. es
Returns: Date
formatDates(items, suffix, format)
Category: Loader
Description: Converts each item of a list to a Date using a date format. The optional suffix is added to each value before it is parsed
Parameters:
items(List) - The list of valuessuffix(String) - Text to add to each value, or an empty stringformat(String) - The date format, e.g. dd/MM/yyyy
Returns: List
formatDatesWithLocale(items, suffix, format, locale)
Category: Loader
Description: Converts each item of a list to a Date using a date format and a locale for the month and day names
Parameters:
items(List) - The list of valuessuffix(String) - Text to add to each value, or an empty stringformat(String) - The date format, e.g. dd MMMM yyyylocale(String) - The locale, e.g. fr
Returns: List
formatHarvestDates(items, years, format)
Category: Loader
Description: Converts a list of day and month values in a harvest (crop) year to Dates, moving to the second year when the dates wrap round
Parameters:
items(List) - The list of valuesyears(String) - The harvest years, e.g. 2025/2026format(String) - The date format of the values with the year added
Returns: List
formatInteger(value, format)
Category: Loader
Description: Formats a whole number with leading zeros or a format string
Parameters:
value(Integer) - The numberformat(String) - The number of digits, e.g. 3 for 007, or a format such as %05d
Returns: String
formatListValues(items, locale)
Category: Loader
Description: Converts each number written in a locale in a list to a plain number
Parameters:
items(List) - The list of valueslocale(String) - The locale of the numbers
Returns: List
formatNumericValues(items)
Category: Loader
Description: Converts each numeric string in a list to a plain number, including values in scientific notation
Parameters:
items(List) - The list of values
Returns: List