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
BedrockMission!

Learn More

View all

Sign in to view all badges

How to read the first line of a text document in adobe campaign via javascript coding?

Avatar

Avatar
Validate 1
Level 1
mithiltaneja
Level 1

Like

1 like

Total Posts

5 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 1
View profile

Avatar
Validate 1
Level 1
mithiltaneja
Level 1

Like

1 like

Total Posts

5 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 1
View profile
mithiltaneja
Level 1

09-08-2017

Hi, please help me with this.

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Validate 1
Employee
Vapsy
Employee

Likes

369 likes

Total Posts

726 posts

Correct Reply

342 solutions
Top badges earned
Validate 1
Boost 50
Boost 5
Boost 3
Boost 250
View profile

Avatar
Validate 1
Employee
Vapsy
Employee

Likes

369 likes

Total Posts

726 posts

Correct Reply

342 solutions
Top badges earned
Validate 1
Boost 50
Boost 5
Boost 3
Boost 250
View profile
Vapsy
Employee

10-08-2017

Hi ,

The following code will print all the lines from a file into the workflow journal logs.

You can customize it to read only the first line

var file = new File( fName );

  var arr = [];

  file.open();

  try

  {

    for each(var line in file)

    {

      arr.push( line );

    }

    for ( var i = arr.length - 1; i >= 0; i-- )

      logInfo(arr[i]);

    logInfo( "###=====  " + fName );

  }

  finally

  {

    file.close();

  }

Hope this helps.

Regards,
Vipul

Answers (2)

Answers (2)

Avatar

Avatar
Boost 5
Level 2
_nkur
Level 2

Likes

11 likes

Total Posts

23 posts

Correct Reply

6 solutions
Top badges earned
Boost 5
Boost 3
Boost 10
Boost 1
Affirm 5
View profile

Avatar
Boost 5
Level 2
_nkur
Level 2

Likes

11 likes

Total Posts

23 posts

Correct Reply

6 solutions
Top badges earned
Boost 5
Boost 3
Boost 10
Boost 1
Affirm 5
View profile
_nkur
Level 2

10-08-2017

Yes, it is just use "vars.filename" instead of fName

Regards,

Ankur A.

Avatar

Avatar
Validate 1
Level 1
mithiltaneja
Level 1

Like

1 like

Total Posts

5 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 1
View profile

Avatar
Validate 1
Level 1
mithiltaneja
Level 1

Like

1 like

Total Posts

5 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 1
View profile
mithiltaneja
Level 1

10-08-2017

Hi Vipul,

Thanks for the code.

var file = new File( fName );

Can this code be modified to use a file downloaded from the file collector activity which is in temp db.

Could you please help me with that?