Hi there,
You have the right idea with the '&'. As you can see at the bottom in the 'de-bugging' area, It is returning an Array containing the common elements - it will always return another Array, as it has no idea how many matches there might be, so this ensures that the returned type is consistent for any number of matches.
However, you're not sending the result to the output - the data there is probably the result of a previous experiment, as the ins and outs remember their values, even between FS sessions. You need to use the "output" method to send the result out to the connector.
You then have a choice - you could change the output connector to be String Array type, and just directly output the result...
If you just want the one match, de-reference the first array item and send that...
You might need to take care with that to make sure that there is only one match - if the result array is empty, de-referencing will return 'nil' rather than a String. You can do this with an 'if' that checks the array size...
Code: Select all
result = (@in1 & @in2)
if result.size == 1
output 0, result[0]
else
# Some other action
end
To treat all of the data as Integers rater than Strings, just change the connectors to Integer Arrays and Integer types - there's only one kind of Ruby Array that can hold data of any type.