Expand my Community achievements bar.

Announcing the launch of new sub-community for Campaign Web UI to cater specifically to the needs of Campaign Web UI users!
SOLVED

xtk.session.Write - Will not update Data field on Output

Avatar

Level 3

All, 

 

I've asked this question before in a previous post, and never really got a good answer. Here's my dilemma: 

I'm creating a process that will convert a numeric into a string, where I format it to look like Currency (the Format Currency function in ACC does not work). So I create the following JS to perform this function, and to write out the data. The issue is, the data is being converted in the Script, but not posting to the field.  

montezh2001_1-1675443363150.png

 

I used an Enrichment prior to this script where I define the Currency field as NULL, and now I'm trying to populate the field with the var usd I create; but it returns NULL values. 

 

All this because I need the Currency field to appear with Commas. And using any of the OOTB Adobe functions to convert my numeric to String removes the Commas. 

 

What am I missing?

 

1 Accepted Solution

Avatar

Correct answer by
Level 3

@AkshayAnand , 

 

After reading other posts through Experience League, it seems using the write method I was using is not going to work because I'm trying to write to a temp table. So instead, I used a sqlExec and it works now. 

montezh2001_0-1675702970305.png

 

 

View solution in original post

4 Replies

Avatar

Community Advisor

Hi @montezh2001 

 

I used the below code and it worked fine.

var num = 123456789 ;
var usd = num.toString().replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,");
logInfo("Currecy is "+usd);

Customer_Name = 'abc';

xtk.session. Write (<Schema operation="update" key="@Customer_Name" xtkschema="cus:Schema" Customer_Name={Customer_Name} Currecy={usd}/>);

 

Please find the screenshot below :-

AkshayAnand_0-1675667343903.png

 

I used the regex code that I got from here.

 

Regards

Akshay

Avatar

Level 3

Akshay,

 

Looking at your code and the only difference I see is it looks like you are writing to a data schema established within Adobe (cus:Schema). I'm using the temp schema from the transition and using that to write to/update. I seem to have an issue every time and no one can really give me an answer why?

 

If you review my code - you'll see what I'm doing and my xtk.session.Write is configured the same as your example. But, thank you for your response. I fell like if I were to write this to a table, I wouldn't be having this issue.

 

Avatar

Correct answer by
Level 3

@AkshayAnand , 

 

After reading other posts through Experience League, it seems using the write method I was using is not going to work because I'm trying to write to a temp table. So instead, I used a sqlExec and it works now. 

montezh2001_0-1675702970305.png

 

 

Avatar

Community Advisor

Hi @montezh2001 

 

Thanks for the information and good to know it worked for you. 

 

Regards

Akshay