Expand my Community achievements bar.

SOLVED

Exporting variable values of javascript into a excel file through a workflow

Avatar

Level 4

Hi Team, 

 

Can we export a calculated variable value in javascript to an excel file through a workflow - 

 

Export can be like on a local laptop OR adobe folders inside explorer. 

 

For example : In the below ss we have a javascript and inside javascript we have some variable or some sql query result 

 

Ramaswami_0-1591296590560.png

 

 

 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hello @Ramaswami ,

Yes, you can export the JS variables in a CSV file.

 

You will have to use the enrichment activity to do so. But you can not use enrichment activity because there is only one javascript activity in your workflow. To make it work you will have to change the workflow to something like this.

manojk62306941_0-1591338355912.png

JS Activity:

 

manojk62306941_1-1591338505305.png

Enrichment activity:

manojk62306941_2-1591338547455.png

 

 

Since you want to automate this. There are 2 ways to get the files with automation.

1) Use data extraction and create the file in Adobe server itself.

2) If you want to receive it on your emails then you can add the delivery activity. (Note to do this you will have to use the file attachment by computation)

 

i have added the additional activities for your reference.

 

 


     Manoj
     Find me on LinkedIn

View solution in original post

7 Replies

Avatar

Community Advisor

Hi,

 

Yes you can export local variable value in your export file.

In your JS, define variable as:

vars.output=vars.recCount

 

And then file configuring columns of your export file. Add column using edit the expression and give value as: 

$(vars/@output)

Jyoti_Y_0-1591333134205.png

 

Thanks.

Avatar

Level 4
Thanks Jyo, initially it didn't worked for me because i only have javascript node and no query activity. we need to have a query activity with some test record in order to export such variables to files. Now i can be able to upload the files to S3 bucket. But i want the files to be exported to a folder in adobe explorer. How can i confiugre my file upload activity to point to adobe explorer file ?

Avatar

Correct answer by
Community Advisor

Hello @Ramaswami ,

Yes, you can export the JS variables in a CSV file.

 

You will have to use the enrichment activity to do so. But you can not use enrichment activity because there is only one javascript activity in your workflow. To make it work you will have to change the workflow to something like this.

manojk62306941_0-1591338355912.png

JS Activity:

 

manojk62306941_1-1591338505305.png

Enrichment activity:

manojk62306941_2-1591338547455.png

 

 

Since you want to automate this. There are 2 ways to get the files with automation.

1) Use data extraction and create the file in Adobe server itself.

2) If you want to receive it on your emails then you can add the delivery activity. (Note to do this you will have to use the file attachment by computation)

 

i have added the additional activities for your reference.

 

 


     Manoj
     Find me on LinkedIn

Avatar

Level 4
Hi @Deleted Account, Awesome, thanks for the workflow and suggestion it worked fine. Currently now i am exporting the file to S3 bucket through file upload activity. How can i export to Adobe explorer if i make a folder in adobe explorer and i want the file generated from the workflow to be stored in that file. How can i configure the file upload component to point to adobe folder. can you please suggest

Avatar

Community Advisor
You cannot directly place a file in Folder to browser it later. What you can do is after File Transfer activity write a javascript code to push that files in the public resources folder directory. So that you will be able to locate the file with Adobe explorer tab.

     Manoj
     Find me on LinkedIn

Avatar

Level 4
HI @Deleted Account, Do you have any js code like that to push the file into adobe resources. Also just a quick question, Can we use javascript code to read and write an excel file and export it to local system like how we do through html/css,/js, i want to write a javascript inside the javascirpt node of workflow to create an excel file and write my results into it and export to local drive.