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.
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?
Solved! Go to Solution.
Views
Replies
Total Likes
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.
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 :-
I used the regex code that I got from here.
Regards
Akshay
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.
Views
Replies
Total Likes
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.
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies