PIM Import Script Language
PIM supports powerful Import Script Language that allows the evaluation, manipulation and assignment of import values based on import data and business logic..
When working with PIM, the process of importing data is a critical operation that determines the accuracy, consistency, and usefulness of product data ultimately stored in the PIM. This data will be used across various sales and marketing channels. This data is sourced from multiple business systems, different product vendors and source channels. The complexity of this process is compounded by the diverse nature of data sources and the need for meticulous data transformation to fit the PIM system's schema. The power of a scripting language with comprehensive array functions, mathematical functions, variable handling, string functions, and assignments is essential. The ability to evaluate and execute transformation scripts for each data row during import allows for conditional checking and modification of import and saved values, ensuring that the data assigned to attributes is both accurate, optimized and conforms to standards.
Perhaps the most powerful aspect of using a scripting language in PIM data import is the ability to write evaluation and transformation scripts that can be executed for each row of import data. These scripts can conditionally check values and apply necessary transformations, ensuring that the data meets the PIM system's requirements. For example, if a product's weight is listed as exceeding a certain threshold, the script can flag it for review or automatically adjust the value if it's known to be a common error from a particular data source.
Allowed Script Function Calls
Mathematical Script Functions
Data import often requires on-the-fly calculations. Prices may need to be converted between currencies, dimensions might require conversion from one measurement system to another, and quantities may need to be adjusted based on inventory levels. A scripting language with built-in mathematical functions can perform these calculations seamlessly during the import process, ensuring that the data fed into the PIM system is accurate and ready for use.
Mathematical functions | |
ceil
|
Round fractions up
|
flor
|
Round fractions down
|
fmod
|
Returns the floating point remainder (modulo) of the division of the arguments
|
log
|
Natural logarithm
|
mt_rand
|
Generate a better random value
|
mt_strand
|
Seed the better random number generator
|
pow
|
Generate a random integer
|
sqrt
|
Square root
|
srand
|
Seed the random number generator
|
|
|
PIM Import Data Arrays
Assignments in scripting allow for the setting and updating of values associated with product attributes. During the import process, it's often necessary to assign default values, replace missing data, or update values based on certain conditions. The scripting language allows for straightforward and flexible assignments and can make these tasks simple and less error-prone.
PIM Import Scripting - Import Data Arrays. | |
$input
|
Data state of current data row as read from file. Overwriting these values is ignored by PIMInto.
|
$output
|
Post processing data state of current data row. These values will be consumed by PIMInto import process. To modify values consumed by PIMInto the output values should be set.
|
Script Variable Handling
Data import often requires on-the-fly calculations. Prices may need to be converted between currencies, dimensions might require conversion from one measurement system to another, and quantities may need to be adjusted based on inventory levels. The scripting language with built-in mathematical functions can perform these calculations seamlessly during the import process, ensuring that the data fed into the PIM system is accurate, transformed and ready for use.
PIM Import Scripting - Variable handling | |
empty
|
Determine whether a variable is empty
|
floatval
|
Get float value of a variable
|
intval
|
Get the integer value of a variable
|
is_array
|
Finds whether a variable is an array
|
is_binary
|
Finds whether a variable is a native binary string
|
is_bool
|
Finds out whether a variable is a boolean
|
is_double
|
Alias of is_float
|
is_float
|
Finds whether the type of a variable is float
|
is_int
|
Find whether the type of a variable is integer
|
is_integer
|
Alias of is_int
|
is_long
|
|
is_null
|
Finds whether a variable is NULL
|
is_numeric
|
Finds whether a variable is a number or a numeric string
|
is_real
|
Alias of is_float
|
is_scalar
|
Finds whether a variable is a scalar
|
is_string
|
Find whether the type of a variable is string
|
is_unicode
|
Finds whether a variable is a unicode string
|
isset
|
Determine whether a variable is set
|
strval
|
Get string value of a variable
|
unset
|
Unset a given variable
|
Array Functions
Array functions are indispensable when dealing with multiple values that are related to a single product attribute. For instance, a product might come in various colors or sizes, or may be used on a specific model of equipment from a specific manufacturer, and these variations need to be grouped and processed efficiently. The scripting language supports robust array operations and can allow the import process to manipulate these sets of data with ease, allowing for functions such as sorting, filtering, and mapping over the data to apply transformations at scale.
PIM Import Scripting - Array Functions | |
array_change_key_case
|
Changes all keys in an array
|
array_chunk
|
Split an array into chunks
|
array_combine
|
Creates an array by using one array for keys and another for its values
|
array_count_values
|
Counts all the values of an array
|
array_diff_assoc
|
Computes the difference of arrays with additional index check
|
array_diff_key
|
Computes the difference of arrays using keys for comparison
|
array_diff
|
Computes the difference of arrays
|
array_fill_keys
|
Fill an array with values, specifying keys
|
array_fill
|
Fill an array with values
|
array_flip
|
Exchanges all keys with their associated values in an array
|
array_intersect_assoc
|
Computes the intersection of arrays with additional index check
|
array_intersect_key
|
Computes the intersection of arrays using keys for comparison
|
array_intersect
|
Computes the intersection of arrays
|
array_key_exists
|
Checks if the given key or index exists in the array
|
array_keys
|
Return all the keys of an array
|
array_merge_recursive
|
Merge two or more arrays recursively
|
array_merge
|
Merge one or more arrays
|
array_multisort
|
Sort multiple or multi-dimensional arrays
|
array_pad
|
Pad array to the specified length with a value
|
array_pop
|
Pop the element off the end of array
|
array_product
|
Calculate the product of values in an array
|
array_push
|
Push one or more elements onto the end of array
|
array_rand
|
Pick one or more random entries out of an array
|
array_reverse
|
Return an array with elements in reverse order
|
array_search
|
Searches the array for a given value and returns the corresponding key if successful
|
array_shift
|
Shift an element off the beginning of array
|
array_slice
|
Extract a slice of the array
|
array_splice
|
Remove a portion of the array and replace it with something else
|
array_sum
|
Calculate the sum of values in an array
|
array_unique
|
Removes duplicate values from an array
|
array_unshift
|
Prepend one or more elements to the beginning of an array
|
array_values
|
Return all the values of an array
|
array
|
Create an array
|
arsort
|
Sort an array in reverse order and maintain index association
|
asort
|
Sort an array and maintain index association
|
compact
|
Create array containing variables and their values
|
count
|
Count elements in an array, or properties in an object
|
current
|
Return the current element in an array
|
each
|
Return the current key and value pair from an array and advance the array cursor
|
end
|
Set the internal pointer of an array to its last element
|
in_array
|
Checks if a value exists in an array
|
key
|
Fetch a key from an associative array
|
krsort
|
Sort an array by key in reverse order
|
ksort
|
Sort an array by key
|
natcasesort
|
Sort an array using a case insensitive "natural order" algorithm
|
natsort
|
Sort an array using a "natural order" algorithm
|
next
|
Advance the internal array pointer of an array
|
pos
|
Alias of current
|
prev
|
Rewind the internal array pointer
|
range
|
Create an array containing a range of elements
|
reset
|
Set the internal pointer of an array to its first element
|
rsort
|
Sort an array in reverse order
|
shuffle
|
Shuffle an array
|
sizeof
|
Alias of count
|
sort
|
Sort an array
|
String Functions
Product information is largely text-based, and string manipulation is a common requirement during data import. Whether it's formatting a product title, concatenating strings to form a unique identifier, or parsing and extracting information from a product description, string functions in the PIM import scripting language enables these tasks to be performed dynamically. This ensures that textual data is standardized and formatted correctly for the PIM system.
PIM Import Scripting - String Functions | |
chop
|
Alias of rtrim
|
count_chars
|
Return information about characters used in a string
|
explode
|
Split a string by string
|
implode
|
Join array elements with a string
|
join
|
Alias of implode
|
levenshtein
|
Calculate Levenshtein distance between two strings
|
ltrim
|
Strip whitespace (or other characters) from the beginning of a string
|
metaphone
|
Calculate the metaphone key of a string
|
money_format
|
Formats a number as a currency string
|
number_format
|
Format a number with grouped thousands
|
rtrim
|
Strip whitespace (or other characters) from the end of a string
|
similar_text
|
Calculate the similarity between two strings
|
soundex
|
Calculate the soundex key of a string
|
str_getcsv
|
Parse a CSV string into an array
|
str_ireplace
|
Case-insensitive version of str_replace.
|
str_repeat
|
Repeat a string
|
str_replace
|
Replace all occurrences of the search string with the replacement string
|
str_pad
|
Pad a string to a certain length with another string
|
str_repeat
|
Repeat a string
|
str_replace
|
|
str_rot13
|
Perform the rot13 transform on a string
|
str_shufffle
|
Randomly shuffles a string
|
str_split
|
Convert a string to an array
|
str_word_count
|
Return information about words used in a string
|
strcasecmp
|
Binary safe case-insensitive string comparison
|
strchr
|
Alias of strstr
|
strcmp
|
Binary safe string comparison
|
strcspn
|
Find length of initial segment not matching mask
|
stripos
|
Find position of first occurrence of a case-insensitive string
|
stristr
|
Get string length
|
strnatcasecmp
|
Case insensitive string comparisons using a "natural order" algorithm
|
strnatcmp
|
String comparisons using a "natural order" algorithm
|
strncasecmp
|
Binary safe case-insensitive string comparison of the first n characters
|
strncmp
|
Binary safe string comparison of the first n characters
|
strpbrk
|
Search a string for any of a set of characters
|
strpos
|
Find position of first occurrence of a string
|
strchr
|
Find the last occurrence of a character in a string
|
strrev
|
Reverse a string
|
strripos
|
Find position of last occurrence of a case-insensitive string in a string
|
strrpos
|
Find position of last occurrence of a char in a string
|
strspn
|
Find length of initial segment matching mask
|
strstr
|
Find first occurrence of a string
|
strtolower
|
Make a string lowercase
|
strtoupper
|
Make a string uppercase
|
strtr
|
Translate certain characters
|
substr_compare
|
Binary safe comparison of 2 strings from an offset, up to length characters
|
substr_count
|
Count the number of substring occurrences
|
substr_replace
|
Replace text within a portion of a string
|
substr
|
Return part of a string
|
trim
|
Strip whitespace (or other characters) from the beginning and end of a string
|
ucfirst
|
Make a string's first character uppercase
|
ucwords
|
Uppercase the first character of each word in a string
|
wordwrap
|
Wraps a string to a given number of characters
|
The use of the PIM import scripting language in the data import process allows for sophisticated data manipulation, ensuring that the information is accurate, consistent, and tailored to the needs of the business. By leveraging array functions, mathematical calculations, variable handling, string manipulation, and assignments, businesses can automate and refine the data import process. The ability to evaluate and transform data on a row-by-row basis with the PIM import script means that each piece of product information is given the attention it needs to serve its purpose effectively. In the competitive landscape of e-commerce and omnichannel retail, the right scripting language in PIM data import is a powerful ally in the quest for data excellence.