Highlighted

Join Data Values with different parameters

Rookie 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
Highlighted

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.
Highlighted

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'] + ")";
Highlighted

Join Data Values with different parameters

Rookie 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 ?
Highlighted

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