# Datalogging more than 1 line...PLEASE HELP

**URL:** <https://tech-community.robotics.abb.com/t/datalogging-more-than-1-line-please-help/7976>\
**Category:** RobotStudio\
**Created:** [November 22, 2017, 4:26pm UTC](https://tech-community.robotics.abb.com/t/datalogging-more-than-1-line-please-help/7976 "2017-11-22T16:26:32Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![sizemorejk](https://dub1.discourse-cdn.com/flex005/user_avatar/tech-community.robotics.abb.com/sizemorejk/32/1753_2.png) [@sizemorejk](https://tech-community.robotics.abb.com/u/sizemorejk)\
**Post date:** [November 22, 2017, 4:26pm UTC](https://tech-community.robotics.abb.com/t/datalogging-more-than-1-line-please-help/7976/1 "2017-11-22T16:26:32Z")

</div>

Hello,

So I am trying to log more than one cycle to a data file.

Here is what I have so far:

MODULE WriteToFile

VAR iodev datalog;

VAR string stDate;

VAR string stTime;

PROC rCycleTimes()

IF DInput(JoeyTry)=1 THEN

stDate:=CDate();

stTime:=CTime();

Open “HOME:”\File:=“SawPart1CT.csv”,datalog\Write;

Write datalog,stDate+“,”+stTime+“,”+“Cycle Time =”\Num:=ClkRead(CycleClock);

Close datalog;

ENDIF

IF DInput(JoeyTry)=0 THEN

stDate:=CDate();

stTime:=CTime();

Open “HOME:”\File:=“SawPart2CT.csv”,datalog\Write;

Write datalog,stDate+“,”+stTime+“,”+“Cycle Time =”\Num:=ClkRead(CycleClock);

Close datalog;

ENDIF

ENDPROC

ENDMODULE

For some reason I can only log one instance then nothing else gets logged in the CSV file.

Only one instance logged and there seems to be no way to have it go to the next line in the CSV file as well.

I honestly feel like I am missing something simple. Please help and thank you ahead of time

HAPPY THANKSGIVING AND GOD BLESS

Joey

---

<div class="post-metadata">

**Author:** ![lemster68](https://dub1.discourse-cdn.com/flex005/user_avatar/tech-community.robotics.abb.com/lemster68/32/1945_2.png) [@lemster68](https://tech-community.robotics.abb.com/u/lemster68)\
**Post date:** [November 22, 2017, 4:54pm UTC](https://tech-community.robotics.abb.com/t/datalogging-more-than-1-line-please-help/7976/2 "2017-11-22T16:54:52Z")

</div>

It looks like you are saying that the next instance overwrites the previous. That is what I would expect from the code, too. When you reopen the comdevice, you need to add the optional argument \append , which will add new lines.

---

<div class="post-metadata">

**Author:** ![sizemorejk](https://dub1.discourse-cdn.com/flex005/user_avatar/tech-community.robotics.abb.com/sizemorejk/32/1753_2.png) [@sizemorejk](https://tech-community.robotics.abb.com/u/sizemorejk)\
**Post date:** [November 22, 2017, 5:09pm UTC](https://tech-community.robotics.abb.com/t/datalogging-more-than-1-line-please-help/7976/3 "2017-11-22T17:09:15Z")

</div>

Wow Thank you so much for the fast response!!!

May I ask, please, where would that \append go in the code?

---

<div class="post-metadata">

**Author:** ![lemster68](https://dub1.discourse-cdn.com/flex005/user_avatar/tech-community.robotics.abb.com/lemster68/32/1945_2.png) [@lemster68](https://tech-community.robotics.abb.com/u/lemster68)\
**Post date:** [November 22, 2017, 5:36pm UTC](https://tech-community.robotics.abb.com/t/datalogging-more-than-1-line-please-help/7976/4 "2017-11-22T17:36:40Z")

</div>

Sure,  
Open “HOME:”\File:=“SawPart2CT.csv”,datalog\Write\Append;

---

<div class="post-metadata">

**Author:** ![sizemorejk](https://dub1.discourse-cdn.com/flex005/user_avatar/tech-community.robotics.abb.com/sizemorejk/32/1753_2.png) [@sizemorejk](https://tech-community.robotics.abb.com/u/sizemorejk)\
**Post date:** [November 22, 2017, 5:55pm UTC](https://tech-community.robotics.abb.com/t/datalogging-more-than-1-line-please-help/7976/5 "2017-11-22T17:55:34Z")

</div>

I actually just figured it out when you sent the answer lol. Thank you so much for your help.

---

<div class="post-metadata">

**Author:** ![lemster68](https://dub1.discourse-cdn.com/flex005/user_avatar/tech-community.robotics.abb.com/lemster68/32/1945_2.png) [@lemster68](https://tech-community.robotics.abb.com/u/lemster68)\
**Post date:** [November 22, 2017, 7:01pm UTC](https://tech-community.robotics.abb.com/t/datalogging-more-than-1-line-please-help/7976/6 "2017-11-22T19:01:39Z")

</div>

You are welcome.
