Announcement

Collapse
No announcement yet.

Do-More Writing Data to a CSV file with comma delimited data

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts


  • Do-More Writing Data to a CSV file with comma delimited data

    Ok, so I have my Do-More writing data to a PC using the STRPRINT and STREAMOUT instructions. I am wanting Time and Date as well as some text along with information from a register. I can get it to write all of this info, but the Time and Date do not allow me to put them in separate cells when used in the same instruction, nor will it let me put then in different columns. It wants to put it all in one column. I would like each bit of information in one row using about 4 columns. When I try to put a comma in to separate it, it triggers an overflow error in the DMLOGGER. I have tried everything. Here is the text in my STRPRINT Insturction. "#file:C:\USERS\CESTHER\MyLogFile.csv#" FmtDate(SDT0,us) "," D7 FmtTime(SDT0,24h) This will go into the excel just fine, however the Data in D7 and the time are in the same cell. I would like the the format to be Date, Time, Part Number, XXXX . Note that Part number is just text and XXXX is the part number extracted from D7. If I put the Date and Time Commands beside each other it will place them in the same cell. Then I cannot add commas text or anything without triggering the overflow in the DMLogger. This is as close as I can get. "#file:C:\USERS\CESTHER\MyLogFile.csv#" FmtDate(SDT0,us) FmtTime(SDT0,24h) "," D7 This will yield the following DATE TIME, XXXX. Again, Date and Time are in one cell together. The Data is in its own cell, however I cannot put any text between the two. And of course Date and time are in the same cell which is a problem. Can anyone tell me what I am doing incorrect?


  • #2
    What is the destination of your STRPRINT? Is it long enough to hold the full string? SS max length is only 64 characters. SL max length is 256. Could that be the issue?
    There are 10 kinds of people in this world, those who know binary, and those who do not.

    Comment



    • #3
      Destination or PRINT TO I assume is SS0. Automatically insert space after each term is checked. Power flow enabled is set.

      Comment



      • #4
        Length is not the issue. I can't even do FmtTime($Now,24h) and then put text behind it. It just doesn't like something.

        BTW Franji1, I 10 know binary! Nice quote!

        Comment



        • #5
          Originally posted by CEstherDurham View Post
          Destination or PRINT TO I assume is SS0. Automatically insert space after each term is checked. Power flow enabled is set.
          Change it to SL0 in your STRPRINT and your STREAMOUT.

          Not sure why you are seeing the error when you reduce the STRPRINT output - that may be due to something else (Append checked?). Regardless, change both instructions to SL0 and see if that makes the issue go away.
          There are 10 kinds of people in this world, those who know binary, and those who do not.

          Comment



          • #6
            That did it. I swapped it back to SS0 and it gave the overflow error in DMLogger. Using the SL0 makes the error go away and the data is now in column form in my excel. Thanks franji1! I don't understand why changing from a short to a long string works when my string is not over the 64 character limit. Unless I am not seeing something. I guess, date and time could be 16 characters registers, then if my D7 register is a 32 character, then that would do it. Wish there were a way of confirming that it wrote the data to file.......

            Comment



            • #7

              #file:C:\USERS\CESTHER\MyLogFile.csv# 38 chars
              FmtDate(SDT0,us) 12/31/2018 10 chars
              FmtTime(SDT0,24h) 23:59:59 8 chars
              "," 1 char
              D7 1 to 11 chars, but most likely 4 or less

              plus the space after each one, 5

              38+10+8+1+4+5 = 66 chars
              There are 10 kinds of people in this world, those who know binary, and those who do not.

              Comment

              Working...
              X