Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

Moving a Text File to SFTP

rahulg1930481
Level 4
Level 4

Hello

I was wondering if someone can show me how to create a text file with any dynamic content and move it to SFTP. Currently I am able to move only text files or CSVs containing any query results to sftp.

I am using Adobe Campaign Classic v6.7. The SFTP that I am trying to move is the one that came with the Adobe Campaign.

Thanks,

Ganesh

1 Accepted Solution
Vapsy
Correct answer by
Employee
Employee

HI Ganesh,

You can do so in a JS activity.

I have a query activity of which I'm trying to create a file. You can adapt it to your scenario

var query = xtk.queryDef.create(

  <queryDef schema="temp:query" operation="select">

    <select>

      <node expr="@deliveryId"/>

      <node expr="@broadLogId"/>

    </select>

  </queryDef>);

var result = query.ExecuteQuery();

// Create the txt file

var f = new File("/sftp/<customerName>/incoming/MyFolder/myFile.txt");

// Open file on Write mode

f.open("w");

for each (var record in result) {

     

    // Write on the file

    f.writeln(record.@deliveryId + "," + record.@broadLogId);

     

    } // end for

     

// Close file

f.close();

The file has been created on Adobe sFTP inside MyFolder

Regards,
Vipul

View solution in original post

1 Reply
Vapsy
Correct answer by
Employee
Employee

HI Ganesh,

You can do so in a JS activity.

I have a query activity of which I'm trying to create a file. You can adapt it to your scenario

var query = xtk.queryDef.create(

  <queryDef schema="temp:query" operation="select">

    <select>

      <node expr="@deliveryId"/>

      <node expr="@broadLogId"/>

    </select>

  </queryDef>);

var result = query.ExecuteQuery();

// Create the txt file

var f = new File("/sftp/<customerName>/incoming/MyFolder/myFile.txt");

// Open file on Write mode

f.open("w");

for each (var record in result) {

     

    // Write on the file

    f.writeln(record.@deliveryId + "," + record.@broadLogId);

     

    } // end for

     

// Close file

f.close();

The file has been created on Adobe sFTP inside MyFolder

Regards,
Vipul

View solution in original post