25.11 Collection keywords

AddItemInCollection

AddItemInCollection

This keyword is used to add an item in collection. It takes Collection Data & item to be added as data input arguments.

Input Arguments

Output

Example

If you want to add Item : dff in Collection (Data)

Data : [
“asd”,
“asdf”,
“add”
]

then you need to use AddItemInCollection keyword. The output will be

[
“asd”,
“asdf”,
“add”,
“dff”
]

Data Input Arguments:

Common Error conditions

This keyword fails in following common error scenarios as given below –

AddItemInKeyValuePairCollection

AddItemInKeyValuePairCollection

This keyword is used to add corresponding item in KeyValuePairCollection. It takes KeyValuePairCollection Data & item to be added as data input arguments.

Input Arguments

Output

Example

If you want to add

Item : {
“Key”: “3”,
“Value”: “rollno”
}

to the item in KeyValuePairCollection (Data)

Data : [
{
“Key”: “1”,
“Value”: “class”
},
{
“Key”: “2”,
“Value”: “sec”
}
]

then you need to use AddItemInKeyValuePairCollection keyword. The output will be

[
{
“Key”: “1”,
“Value”: “class”
},
{
“Key”: “2”,
“Value”: “sec”
},
{
“Key”: “3”,
“Value”: “rollno”
}
]

Data Input Arguments:

Common Error conditions

This keyword fails in following common error scenarios as given below –

CheckDuplicacyInCollection

CheckDuplicacyInCollection

This keyword is used to check the duplicacy in the given Collection. It takes Collection Data as as data input arguments.

Input Arguments

Output

Example

If you want to find out duplicacy in

Data : [
“asd”,
“asd”,
“asd”,
“asd”
]

then you need to use CheckDuplicacyInCollection keyword. The output will be True.

Data Input Arguments:

Common Error conditions

This keyword fails in following common error scenarios as given below –

CheckDuplicacyInKeyValuePairCollection

CheckDuplicacyInKeyValuePairCollection

This keyword is used to check the duplicacy in the given KeyValuePairCollection. It takes KeyValuePairCollection Data as as data input arguments.

Input Arguments

Output

Example

If you want to find out duplicacy in KeyValuePairCollection Data

Data : [
{
“Key”: “class”,
“Value”: “1”
},
{
“Key”: “rollno”,
“Value”: “20”
},
{
“Key”: “reg”,
“Value”: “40”
},
{
“Key”: “rollno”,
“Value”: “20”
}
]

then you need to use CheckDuplicacyInKeyValuePairCollection keyword. The output will be True.

Data Input Arguments:

Common Error conditions

This keyword fails in following common error scenarios as given below –

GetCollectionOfDelimitedString

GetCollectionOfDelimetedString

This keyword is used to get the Collection of String with no delimiter. It takes Collection Data & Delimiter as as data input arguments.

Input Arguments

Output

Example

If you want to get the Collection by removing the delimiter (comma) from the Apple, Carrot, Mango, Banana then then you need to use GetCollectionOfDelimetedString keyword. The output will be Apple Carrot Mango Banana.

Data Input Arguments:

Common Error conditions

This keyword fails in following common error scenarios as given below –

GetItemFromCollection

GetItemFromCollection

This keyword is used to get a particular item from the given Collection. It takes Collection Data & index of the item existing in the Collection Data, as as data input arguments.

Input Arguments

Output

Example

If you want to get the data existing at index 1 from Collection Data

: [

“a”,

“b”,

“c”

]

then then you need to use GetItemFromCollection keyword. The output will be b.

Data Input Arguments:

Common Error conditions

This keyword fails in following common error scenarios as given below –

GetItemFromKeyValuePairCollection

GetItemFromKeyValuePairCollection

This keyword is used to get a particular item from the given KeyValuePairCollection. It takes KeyValuePairCollection Data & index of the item existing in the KeyValuePairCollection Data, as as data input arguments.

Input Arguments

Output

Example

If you want to get the data existing at index 1 from KeyValuePairCollection Data

Data : [
{
“Key”: “class”,
“Value”: “10”
},
{
“Key”: “rollno”,
“Value”: “12”
}
]

then then you need to use GetItemFromKeyValuePairCollection keyword. The output will be

{
“Key”: “rollno”,
“Value”: “12”
}

.

Data Input Arguments:

Common Error conditions

This keyword fails in following common error scenarios as given below –

GetSizeOfCollection

GetSizeOfCollection

This keyword is used to get the size of the specified Collection. It takes Collection Data as as data input arguments.

Input Arguments

Output

Example

If you want to get the data existing at index 1 from KeyValuePairCollection Data

Data : [
{
“Key”: “class”,
“Value”: “10”
},
{
“Key”: “rollno”,
“Value”: “12”
}
]

then then you need to use GetItemFromKeyValuePairCollection keyword. The output will be

{
“Key”: “rollno”,
“Value”: “12”
}

.

Data Input Arguments:

Common Error conditions

This keyword fails in following common error scenarios as given below –

GetSizeOfKeyValuePairCollection

GetSizeOfKeyValuePairCollection

This keyword is used to get the size of the specified KeyValuePairCollection. It takes KeyValuePairCollection Data as as data input arguments.

Input Arguments

Output

Example

If you want to get size of the KeyvaluePairCollection Data

Data : [
{
“Key”: “a”,
“Value”: “1”
},
{
“Key”: “b”,
“Value”: “2”
},
{
“Key”: “c”,
“Value”: “3”
}
]

then then you need to use GetSizeOfKeyValuePairCollection keyword. The output will be 3.

Data Input Arguments:

Common Error conditions

This keyword fails in following common error scenarios as given below –

InsertItemInCollection

InsertItemInCollection

This keyword is used to insert the given item in the Collection data. It takes Collection Data, Value & index of data to be inserted as as data input arguments.

Input Arguments

Output

Example

If you want to insert “e” value data at index 1 in Collection Data

Data : [
“a”,
“b”,
“c”
]
*

then then you need to use InsertItemInCollection keyword. The output will be

[
“a”,
“e”,
“b”,
“c”
]

Data Input Arguments:

Common Error conditions

This keyword fails in following common error scenarios as given below –

InsertItemInKeyValuePairCollection

InsertItemInKeyValuePairCollection

This keyword is used to insert the given item in the KeyValuePairCollection data. It takes KeyValuePairCollection Data, Value & index of data to be inserted as as data input arguments.

Input Arguments

Output

Example

If you want to insert

* Value : {
“Key”: “c”,
“Value”: “03”
}
Index : 1

value data at index 1 in Collection Data

* Data : [
{
“Key”: “a”,
“Value”: “01”
},
{
“Key”: “b”,
“Value”: “02”
}
]  

then then you need to use InsertItemInKeyValuePairCollection keyword. The output will be

[
{
“Key”: “a”,
“Value”: “01”
},
{
“Key”: “c”,
“Value”: “03”
},
{
“Key”: “b”,
“Value”: “02”
}
]

Data Input Arguments:

Common Error conditions

This keyword fails in following common error scenarios as given below –

MergeCollection

MergeCollection

This keyword is used to merge the 2 given Collection data. It takes Collection Data to be merged as as data input arguments.

Input Arguments

Output

Example

If you want to merge

* Data1 : [
“a”,
“b”,
“c”
]

&
* Data2 : [
“1”,
“2”,
“3”
]

then then you need to use InsertItemInKeyValuePairCollection keyword. The output will be

[
“a”,
“b”,
“c”,
“1”,
“2”,
“3”
]

Data Input Arguments:

Common Error conditions

This keyword fails in following common error scenarios as given below –

MergeKeyValuePairCollection

MergeKeyValuePairCollection

This keyword is used to merge the 2 given KeyValuePairCollection data. It takes KeyValuePairCollection Data to be merged as as data input arguments.

Input Arguments

Output

Example

If you want to merge

* Data1 : [
{
“Key”: “1”,
“Value”: “AA”
},
{
“Key”: “2”,
“Value”: “BB”
}
]

&
* Data2 : [
{
“Key”: “A”,
“Value”: “11”
},
{
“Key”: “B”,
“Value”: “22”
}
]

then then you need to use MergeKeyValuePairCollection keyword. The output will be

[
{
“Key”: “1”,
“Value”: “AA”
},
{
“Key”: “2”,
“Value”: “BB”
},
{
“Key”: “A”,
“Value”: “11”
},
{
“Key”: “B”,
“Value”: “22”
}
]

Data Input Arguments:

Common Error conditions

This keyword fails in following common error scenarios as given below –

RemoveItemFromCollection

RemoveItemFromCollection

This keyword is used to remove a particular item from the given Collection data. It takes Data & Index of the item to be removed as as data input arguments.

Input Arguments

Output

Note: If No Index is given then it removes index 0 data from the Collection.

Example

If you want to remove Index 1 data from the Collection Data

* Data : [
“ABCD”,
“EFGH”,
“IJKL”
]
then then you need to use RemoveItemFromCollection keyword. The output will be

[
“ABCD”,
“IJKL”
]

Data Input Arguments:

Common Error conditions

This keyword fails in following common error scenarios as given below –

RemoveItemFromKeyValuePairCollection

RemoveItemFromKeyValuePairCollection

This keyword is used to remove a particular item from the given KeyValuePair Collection data. It takes Data & Index of the item to be removed as as data input arguments.

Input Arguments

Output

Note: If No Index is given then it removes index 0 data from the Collection.

Example

If you want to remove Index 1 data from the KeyValuePairCollection Data

* Data : [
{
“Key”: “a”,
“Value”: “Apple”
},
{
“Key”: “b”,
“Value”: “Ball”
},
{
“Key”: “c”,
“Value”: “Cat”
}
]
Index : 1

then then you need to use RemoveItemFromKeyValuePairCollection keyword. The output will be

[
{
“Key”: “a”,
“Value”: “Apple”
},
{
“Key”: “c”,
“Value”: “Cat”
}
]

Data Input Arguments:

Common Error conditions

This keyword fails in following common error scenarios as given below –

ReverseCollection

ReverseCollection

This keyword is used to reverse the given Collection Data. It takes Collection Data to be reversed as as data input argument.

Input Arguments

Output

Note: If there is single Collection value then it will remain same.

Example

If you want to reverse Collection Data

* Data : [
“ABCDEFG”,
“1234567”
]

then then you need to use ReverseCollection keyword. The output will be

[
“1234567”,
“ABCDEFG”
]

Data Input Arguments:

Common Error conditions

This keyword fails in following common error scenarios as given below –

ReverseKeyValuePairCollection

ReverseKeyValuePairCollection

This keyword is used to reverse the given KeyValuePairCollection Data. It takes KeyValuePair Collection Data to be reversed as as data input argument.

Input Arguments

Output

Note: If there is single KeyValuePair Collection value then it will remain same.

Example

If you want to reverse Collection Data

* Data : [
{
“Key”: “A”,
“Value”: “1”
},
{
“Key”: “B”,
“Value”: “2”
}
]

then then you need to use ReverseKeyValuePairCollection keyword. The output will be

[
{
“Key”: “B”,
“Value”: “2”
},
{
“Key”: “A”,
“Value”: “1”
}
]

Data Input Arguments:

Common Error conditions

This keyword fails in following common error scenarios as given below –

SetGlobalVariableCollection

SetGlobalVariableCollection

This keyword is used to set the Global Variable Collection data as per the given Data. It takes VariableName & Data as as data input argument.

Input Arguments

Output

Example

If you want to set Collection Data

* VariableName : string

* Data : [

"Laptop",

"Desktop",

"Keyboard"

]

For a particular Global Variable Collection data then you need to use SetGlobalVariableCollection keyword. The output will be True.

Data Input Arguments:

Common Error conditions

This keyword fails in following common error scenarios as given below –

UpdateItemInKeyValuePairCollection

UpdateItemInKeyValuePairCollection

This keyword is used to update the particular item in the given KeyValuePair Collection. It takes Data, Item & Index as as data input arguments.

Input Arguments

Output

Example

If you want to update the item existing at index 1 with new value ("Key": "Unix",

"Value": "2"). The input value is  

* Data : [

{

"Key": "Apple",

"Value": "1"

},

{

"Key": "Mac",

"Value": "2"

},

{

"Key": "Windows",

"Value": "3"

}

]

* Item : {

"Key": "Unix",

"Value": "2"

}

The output value will be

[

{

"Key": "Apple",

"Value": "1"

},

{

"Key": "Unix",

"Value": "2"

},

{

"Key": "Windows",

"Value": "3"

}

]

then you need to use UpdateItemInKeyValuePairCollection keyword.

Note: If the index value is not given then it will update the item existing at index 0.

Data Input Arguments:

Common Error conditions

This keyword fails in following common error scenarios as given below –

UpdateValueInCollection

UpdateValueInCollection

This keyword is used to update the particular Value in the given Collection data. It takes Data, Value & Index as as data input arguments.

Input Arguments

Output

Example

If you want to update the item existing at index 2 with new value (Value: 4; Index: 2). If the input value is

* Data : [

"1",

"2",

"3"

]

* Value : 4

Index : 2

Then the output value will be

[

"1",

"2",

"4"

]

In this case, you need to use UpdateValueInCollection keyword.

Note: If the index value is not given then it will update the item existing at index 0.

Data Input Arguments:

Common Error conditions

This keyword fails in following common error scenarios as given below –

GetIndexValueFromCollection

Article

No items found.
Contact us