Also Read, How to Download Jitterbit Studio in Windows, Linux, and Mac.
1. Dict():
The Jitterbit Dict() function is used to build an empty dictionary. Similar to other programming's dictionary, Jitterbit dictionary exhibits similar behavior. The data is organized into key-value pairs. A dictionary's value may be in any permissible data type, but its key must always be in string or have a string representation.
There are built-in functions for adding, deleting, and changing dictionary data to making the Jitterbit dictionary mutable or dynamic. In contrast to temporary storage, file storage, and global variables, the Jitterbit dictionary can be utilized to store data in memory relatively effectively and with minimal letency.
My_Dictionary_1=Dict(); //Return: {}, An empty Dictionary. My_Dictionary_2= {} //Return: {}, An empty Dictionary.
My_Dictionary_1 = Dict(); My_Dictionary_1['a'] = 10; My_Dictionary_1['b'] = 20; WriteToOperationLog(My_Dictionary_1); //Return: [a=>"10",b=>"20"]
//Another way to create a dictionary is to use "{}", but we cannot directly add data to the dictionary as we can with the Dict() function. temp_Dict = {}; temp_Dict["Rat"] = "Micky Mouse"; WriteToOperationLog(temp_Dict); //Return: {} //We must need to use AddToDict() function to add the data into the dictionary if the initilzation start with '{}'. My_Dictionary_2 = {}; AddToDict(My_Dictionary_2, "Country", "USA"); WriteToOperationLog(My_Dictionary_2); //Return: [Country=>"USA"]
2. Map():
The Jitterbit Map() function provides another way to create a dictionary, but unlike the Dict() function, we cannot directly add data to the dictionary; instead, we must use AddToDict() to do so.
temp_dictionary = Map();
//Dictionary Declaration my_dict= Map(); AddToDict(my_dict,"Cat","Tom"); my_dict['Rat']= "Jerry"; WriteToOperationLog(my_dict); //Return: [Cat=>"Tom",Rat=>"Jerry"]
//The "HasKey" will be extremely useful if we need to update the existing dictionary values. my_dict_2= Map(); my_dict_2["Rat"]= "Jerry" //If the first argument is not a dictionary or the key was not found, it returns false, else Update the value. If(HasKey(my_dict_2, "Rat"), my_dict_2["Rat"]="Micky Mouse"); //Return: [Rat=>"Micky Mouse"]
3. Array():
A list of elements with the same date type are created in an ordered list using the Jitterbit Array() function. The values in an array can be retrieved individually by iterating the array using a loop call as an array does not store values as a "key:value" pair.
// Option 1 to create Array list. $Marks = Array(); // Option 2 to create Array list. $Mobile_Stock = {1, 2, 3};
// Create an empty array and set values arr = Array(); arr[0] = "value1 in index 0"; arr[1] = "value2 in index 1"; //Return: {value1 in index 0,value2 in index 1}
arr = {1, 2, 3}; value = 1; FindValue(value, arr, arr) == value; //Return: 1, (true) value = 4; FindValue(value, arr, arr) == value; //Return: 0. (false)
4. HasKey():
The Jitterbit Hashmap() function iterates through each key in the given dictionary until it finds the "key," returning 'True' if the "key" exists and false otherwise. It also helps to prevent the dictionary from overwriting the Key or creating duplicate data. This function allows for updates, deletions, and creations the records.
HasKey(<dict>, <key>);
//The "HasKey" will be extremely useful if we need to update the existing dictionary values. my_dict_1= Map(); //If the first argument is not a dictionary or the key was not found, it returns false. If(HasKey(my_dict_1, "Rat"), my_dict_1["Rat"]="Micky Mouse"); //Return: None or Empty or Blank response
// It will check the condition if the Key is not available in Dictionary then it will Add the new KEY and Value. otherwise it will not not perform any activity. my_dict_2 = Dict(); If(!HasKey(my_dict_2, "Dog"), my_dict_2["Dog"]="Bully"); my_dict_2["Cat"] = "Tom" // Simplest way to add. //Return: [Cat=>"Tom",Dog=>"Bully"] //If the Key is not available in Dictionary then it will Add the new KEY and Value, otherwise manual error message will print which may be helpfull to debug the failure condition. If(!HasKey(my_dict_2, "Dog"), my_dict_2["Dog"]="Bully New", "Condition Failed: Key Already Present in Dictionary"); //Return: Condition Failed: Key Already Present in Dictionary.
Toipc Covered:
Jitterbit studio tutorial
Jitterbit Scripting language
Jitterbit array
Jitterbit Dictionary
4. GetKeys():
The Jitterbit GetKeys() function iterates through each items in the given dictionar and returns only the Keys without its value. The keys return in the array format.
GetKeys(<dict>);
//The "GetKeys" will be extremely useful when we need to fetch only the keys from the existing dictionary. My_Dictionary_3 = Dict(); My_Dictionary_3['a'] = 10; My_Dictionary_3['b'] = 20; //Calling function. GetKeys(My_Dictionary_3); //Return: {a, b}
// if the Key is not available in Dictionary then it will not return anything. my_dict_2 = Dict(); //empty Dictionary GetKeys(my_dict_2); //Return: Return Null or empty list.
5. CollectValues():
The Jitterbit CollectValues() function iterates through each items in the given dictionar and returns only the values without its Keys. The Values return in the array format.
CollectValues(<dict>, <namesArray>);
//The "CollectValues" will be extremely useful when we need to fetch only the Values from the existing dictionary. My_Dictionary_4 = Dict(); My_Dictionary_4['a'] = 100; My_Dictionary_4['b'] = 200; //Calling function. CollectValues(My_Dictionary_4, GetKeys(My_Dictionary_4)); //Return: {100, 200}
// if the Value is not available in Dictionary then it will not return anything except placeholder. My_Dictionary_4 = Dict(); My_Dictionary_4['a'] = 100; My_Dictionary_4['b'] = ''; //Calling function. CollectValues(My_Dictionary_4, GetKeys(My_Dictionary_4)); //Return: {100,}