Join Data Values with different parameters

Gold Contributor
Gold Contributor
Hello Everyone, I am looking into a way to join data values in the following way : {mobile Device} : {language}-{country} : {Page Name} ({productID}) thus have separation with (in order) : - : () In the join data value extension, this is not possible. Thus i am wondering if i can use multiple time the join data value, but how do i make sure that it will be processed in the right order (or that it will wait that all values are there) Or would you suggest to use a javascript module to handle that ? Thanks very much
4 REPLIES 4

Join Data Values with different parameters

Tealium Employee
It would be easiest to use a javascript extension to achieve that. Assuming all the variables are already in the data layer, something like this should do the trick.

b['JoinedVariable'] = b['mobileDevice'] + ":" + b['language'] + "-" + b['country'] + ":" + b['pageName'] + "(" + b['productId'] + ")";
However you would need to be careful that all the variables are strings and not objects or arrays.
Connecting data systems since the 1980s.

Join Data Values with different parameters

Employee Emeritus
You could also use a Set Data Values Extension to achieve this. Using the same code Steve provided you could do: Set: JoinedVariable (js) To: JS Code -> Paste the following into the text box: b['mobileDevice'] + ":" + b['language'] + "-" + b['country'] + ":" + b['pageName'] + "(" + b['productId'] + ")";

Join Data Values with different parameters

Gold Contributor
Gold Contributor
Just a quick question with this code, could i add an if like : b['mobileDevice'] + ":" + b['language'] + "-" + b['country'] + ":" + b['pageName'] + ( b['productId'] != 'undefined' && b['productId'] !=null) ?"(" + b['productId'] + ")" : ""; This way if the productID is not set, then it does not matter ?

Join Data Values with different parameters

Tealium Employee
You could actually use
b['productId'] || "defaultvalue"  
instead so you would end up with: b['mobileDevice'] + ":" + b['language'] + "-" + b['country'] + ":" + b['pageName'] + "(" + (b['productId']||'defaultvalue') + ")"; Which means that if there is no productId it would populate it with the defaultvalue
Connecting data systems since the 1980s.
Public