Loading ...
Sorry, an error occurred while loading the content.

more csv file questions....

Expand Messages
  • BHCS
    Just after my earlier post of this topic this morning I found Jody s NoteBlock library & the Reorder fields... clip -- & it s driving me crazy (guess that
    Message 1 of 4 , Nov 5, 2003
    • 0 Attachment
      Just after my earlier post of this topic this morning I found Jody's
      NoteBlock library & the "Reorder fields..." clip -- & it's driving me
      crazy (guess that comes with trying to learn this clip stuff on the fly
      when I'm in a time crunch). Anyhow, it strips the quotes that surround
      each field (,"field contents", becomes ,field contents,) which I don't
      want; but I can't figure out where his code is selecting the contents of
      each field so that I can edit it to incl the quotes. Next, when finished
      it puts a comma at the beginning of each line (but not on the first
      line) which I also don't want. Its also got a fixed number of fields it
      can work with (9) - is there a way to code it to examine the first line
      & count fields, then make the user input dialog reflect the actual
      number of fields in a record? I also want it NOT to change the source
      file at all since it generates a new file with the changes (this would
      get me an "audit trail" & let me work on the original w/o having to
      restore a backup if something gets screwed up. Finally, it makes lots of
      mistakes: field contents from one record often get repeated in several
      adjacent records (I think the var for the field doesn't get emptied
      after writing a new, re-ordered record & so if the next record had
      nothing in the corresponding field it gets the value from the previous
      record). If this is the problem, what would be the code for emptying the
      field vars before re-filling them at the time of parsing the next
      record/line?

      I realize that I can put back in the missing quotes & remove the leading
      comma with a S&R after this file is generated but I'm trying to
      eliminate steps here and keep it as automatic as possible as I've got
      someone in the office who is not familiar with NTP who will do most of
      the day to day running of the clip.

      Any help with this will be very appreciated!

      PS, thinking about one of my abv complaints while writing probably is
      dangerous but I want to toss out this ?.
      - could I edit the delimiters vars & dialog on Jody's Reorder clip to
      give a choice of "," instead of just a comma (,)? That should preserve
      all of the 'internal' quotes leaving just the ones at the beg & end of
      the lines to figure out (this is important also as sometimes I find
      commas in the notes fields that are NOT delimiters).


      Bill,

      Bill Harriff ComputerSystems
      PO Box 3286
      Ashland, OR 97520
      1-541-482-7385 (Voice & Fax)
      1-541-951-3680 (Cell)
    • Alan C.
      On Wed, 05 Nov 2003 14:49:40 -0800, BHCS wrote: [ . . ] ... does so at ^$GetField(Row;Col)$ ... looks as if when ^$GetField puts it into a variable is when
      Message 2 of 4 , Nov 5, 2003
      • 0 Attachment
        On Wed, 05 Nov 2003 14:49:40 -0800, BHCS wrote:
        [ . . ]
        >�[ . . ] Anyhow, it strips the quotes that surround
        >�each field (,"field contents", becomes ,field contents,) which I don't
        >�want; but I can't figure out where his code is selecting the contents of
        >�each field

        does so at ^$GetField(Row;Col)$


        >so that I can edit it to incl the quotes.

        looks as if when ^$GetField puts it into a variable is when the quotes get stripped

        i tried strreplace and some others, not yet found a way (work around, etc.) (to preserve quotes)

        next, demo, can see what's selected versus what dumps from variable into doc.
        --

        ^!Menu File/New
        ^!InsertText ""field contents","does becomes","strips quotes""
        ^!SetDelimiter ","
        ^!Set %Get1%=^$GetField(1;2)$
        ; ^$GetField(Row;Col)$
        ; ^!Info ^%Get1%
        ^!Delay 15
        ^!Menu File/New
        ^!InsertText ^%Get1%
        ---------------------------

        dunno if feasible or not

        (untested) just the thought of running a replace on your source doc first of all and replace all quotes with ~

        then your delimiter be

        ~,~

        then do your processing based on that delimiter

        at end of clip run then in your new doc run a replace again, replace all ~ with "

        --
        Alan.
      • Jody
        Hi BHCS, ... I ll write you private eMail about that since it is most likely an issue I have to deal with. You do have to choose a delimeter though and I m not
        Message 3 of 4 , Nov 6, 2003
        • 0 Attachment
          Hi BHCS,

          >Just after my earlier post of this topic this morning I found Jody's
          >NoteBlock library & the "Reorder fields..." clip -- & it's driving me
          >crazy (guess that comes with trying to learn this clip stuff on the fly
          >when I'm in a time crunch).

          I'll write you private eMail about that since it is most likely
          an issue I have to deal with. You do have to choose a delimeter
          though and I'm not sure if I tested with "," which if I remember
          correctly that is NoteTab's default. I'll have to take a look
          later. Could you send me a few lines of sample text to play with
          please. mailto:ntb-clips-owner@yahoogroups.com

          Take care,
          Jody Adair

          The whole world doth err save you and me,
          and even thou doest err some!
          http://clean-funnies.com
          http://notetab.net, http://fookes.us
          http://sojourners-software.com
        • David Elliott
          While I have doen a lot of work in NoteTab with CSV files, I found CSVdb (found at http://home.hccnet.nl/s.j.francke/software/software.htm) to be useful
          Message 4 of 4 , Nov 6, 2003
          • 0 Attachment
            While I have doen a lot of work in NoteTab with CSV files, I found
            CSVdb (found at
            http://home.hccnet.nl/s.j.francke/software/software.htm) to be useful
            carrying out a lot of the actions you are trying to program into
            notetab.

            I will tell you an approach I have taken.

            I use "superarrays"

            The files I work with always have header rows with fieldnames so
            basically I read the first line of the CSV and try to "guess" what
            the delimiter is by going through and looking for the ","|";"|etc.
            I parse the first line header information and store the fieldnames
            into an array (^%fieldname%).

            These fieldnames then become array variable names that I can read
            each column into as an array (^%%fieldname^%i%%). So Row1 is
            fieldnames in an array across. The subsequent rows are parsed column-
            wise into arrays using a loop from 1 to ith field.

            You can then present picklists of fieldnames for dropping, extracting
            etc. The nice thing is that you can basically write a subroutine to
            handle the loading and then manipulate the data through fields.

            I'm sorry I don't have an example of code here at work. I must also
            warn you that the ^%%fieldname^%i%% notation is twitchy to get used
            to! I use this for writing HTML tables or link lists where I have
            CSV databases that are then line-by-line wrapped in HTML code.

            Hope these suggestions help and that you check out Sam Franke's
            excellent program.

            DE
          Your message has been successfully submitted and would be delivered to recipients shortly.