xtk.session.Write - Will not update Data field on Output | Adobe Higher Education
Skip to main content
Level 4
February 3, 2023
解決済み

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

  • February 3, 2023
  • 1 の返信
  • 1854 ビュー

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?

 

このトピックへの返信は締め切られました。
ベストアンサー montezh2001

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

 

 

1 の返信

AkshayAnand
Community Advisor
Community Advisor
February 6, 2023

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

montezh2001作成者回答
Level 4
February 6, 2023

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

 

 

AkshayAnand
Community Advisor
Community Advisor
February 7, 2023

Hi @montezh2001 

 

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

 

Regards

Akshay