Converting a number-attribute to string in AS

Bronze Contributor
Bronze Contributor

Hi everyone,

One thing I've been unable to do so far is transform a number-attribute to a string-attribute for a specific connector.

Use-case:
We have a scoring system (number attribute on visitor level). Based on certain conditions this score is increased. At the end of the visit I'd like to send over the score with a connector. Sadly, this connector only accepts string values.

Problem:
As the number-attribute is created in AS, I want to use it directly from there to always have the latest "score"-value. In the connector mapping, I can't add quotationmarks ("") to the variable mapping (connector doesn't support this). So I have to transform the variable before configuring it in the connector.

One solution: 
I did think of adding a new string attribute that has an enrichment, but this would mean I'd have to manually create an enrichment with rules every possible score. 

Does anyone know how to do this? I can't imagine simple transformation of variables like from number to string would be impossible.

1 REPLY 1

Converting a number-attribute to string in AS

Bronze Contributor
Bronze Contributor

Hi BOoms,
You can use "Join Attributes" string enrichment for converting Number to String.

  1. Create a new String attribute.
  2. Select "Join Attributes" enrichment.
  3. Select Score(Number attribute) as first attribute.
  4. Leave second attribute as well as delimiter blank

And it's done.

Check below screenshots for reference:

string.png

 

 

 

 

 

 

 

 

 

 

 

Number to string.png

 

 

 

 

 

 

 

 

 

 

 

Hope this helps!!

Public