Sometimes a selector selects more than one element and we want to extract their concatenated values as a single value. The following function takes a separator and a sequence, and returns their concatenated values. To use this on your project, follow
these instructions.
{
"api": "1.0.2.1",
"parameters": {
"separator": {
"caption": "Separator",
"type": "text",
"default": ", "
},
"sequence": {
"caption": "Sequence Selector",
"type": "extractor"
}
}
}
Code: Select all
function (separator sequence)
Sequence.FirstOrDefault
· Sequence.Fold
· sequence
· function (a b)
+
· a
· separator
· b
As a quick example, suppose your project contains a selector called
PhoneNumbers that selects many elements on the page. Instead of just using a
Select.PhoneNumbers action, which would extract the first phone number only, the following code would extract all phone numbers separated by a comma (this example also assumes you've pasted the code above into your project and called it
Concatenate):
Code: Select all
Concatenate
· ", "
· Select.PhoneNumbers