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

Re: [Clip] How do I get array data back

Expand Messages
  • Bauke P. de Vries
    Hello, I m trying to write a clip to append a row from one file to another file. The to -file s name is based on the first field of the row in the
    Message 1 of 19 , Sep 11, 2005
    • 0 Attachment
      Hello,

      I'm trying to write a clip to append a row from one file to another
      file. The "to"-file's name is based on the first field of the row in the
      "from"-file. The "from"-file has about 250 rows and for every row there
      should be a "to"-file. Must be checked.

      The problem is that I don't get any filenames from the filename-array in
      the second loop (loop2). I've tried it with another counter (%n%) but
      that doesn't work either.

      Must be a beginnes question (I am beginner). Couldn't find it in the doc's.

      Thanks in advance for helping me!

      Clip below

      ^!SetDebug 1

      ^!Jump Text_Start
      ^!SetWordWrap OFF
      ^!SetDelimiter ,
      ^!SetArray %Filenamen%=""
      ^!SetArray %Regels%=""
      ^!Set %rnr%=0

      :loop1
      ^!Inc %rnr%
      ^!Set %SGTicker%=^$GetField(^%rnr%;1)$
      ^!If ^$StrCopyRight(^%SGTicker%;2)$ <> AS ^!Goto loop1
      ^!SetArray %Filenamen^%rnr%%=^%SGTicker%.sg.txt
      ^!SetArray %Regels^%rnr%%=^$GetLine(^%rnr%)$
      ^!If ^$GetRow$ = ^$Calc(^$GetLineCount$-1)$ Skip
      ^!Goto loop1

      ^!Set %rnr%=0

      :loop2
      ^!Inc %rnr%
      ^!IfFileExist ^%Filenamen^%rnr%% ^!Goto bestaat ELSE ^!Goto bestaatniet


      :bestaat
      ^!Info bestaat !!!!!!!!!!!!!!!
      ^!Goto end

      :bestaatniet
      ^!Info bestaat niet !!!!!!!!!!!!!!!
      ^!Goto end


      :end
      ^!Info rnr = ^%rnr%
      ^!Info filenaam = ^%Filenamen^%rnr%%
      ^!Info regel = ^%NL%^%Regels^%rnr%%

      Met vriendelijke groet,

      *Bauke P. de Vries
      *
    • Ian D. Davies
      I notice that you are not running through loop2. You only process the first item in loop2 then fall through to :bestaat . You need a goto at the bottom of the
      Message 2 of 19 , Sep 11, 2005
      • 0 Attachment
        I notice that you are not running through loop2. You only process the first
        item in loop2 then fall through to ":bestaat". You need a goto at the bottom
        of the loop sending you backup to loop2.

        ----- Original Message -----
        From: "Bauke P. de Vries" <bpdevries@...>
        To: <ntb-clips@yahoogroups.com>
        Sent: Sunday, September 11, 2005 9:45 AM
        Subject: Re: [Clip] How do I get array data back


        > Hello,
        >
        > I'm trying to write a clip to append a row from one file to another
        > file. The "to"-file's name is based on the first field of the row in the
        > "from"-file. The "from"-file has about 250 rows and for every row there
        > should be a "to"-file. Must be checked.
        >
        > The problem is that I don't get any filenames from the filename-array in
        > the second loop (loop2). I've tried it with another counter (%n%) but
        > that doesn't work either.
        >
        > Must be a beginnes question (I am beginner). Couldn't find it in the
        > doc's.
        >
        > Thanks in advance for helping me!
        >
        > Clip below
        >
        > ^!SetDebug 1
        >
        > ^!Jump Text_Start
        > ^!SetWordWrap OFF
        > ^!SetDelimiter ,
        > ^!SetArray %Filenamen%=""
        > ^!SetArray %Regels%=""
        > ^!Set %rnr%=0
        >
        > :loop1
        > ^!Inc %rnr%
        > ^!Set %SGTicker%=^$GetField(^%rnr%;1)$
        > ^!If ^$StrCopyRight(^%SGTicker%;2)$ <> AS ^!Goto loop1
        > ^!SetArray %Filenamen^%rnr%%=^%SGTicker%.sg.txt
        > ^!SetArray %Regels^%rnr%%=^$GetLine(^%rnr%)$
        > ^!If ^$GetRow$ = ^$Calc(^$GetLineCount$-1)$ Skip
        > ^!Goto loop1
        >
        > ^!Set %rnr%=0
        >
        > :loop2
        > ^!Inc %rnr%
        > ^!IfFileExist ^%Filenamen^%rnr%% ^!Goto bestaat ELSE ^!Goto bestaatniet
        >
        >
        > :bestaat
        > ^!Info bestaat !!!!!!!!!!!!!!!
        > ^!Goto end
        >
        > :bestaatniet
        > ^!Info bestaat niet !!!!!!!!!!!!!!!
        > ^!Goto end
        >
        >
        > :end
        > ^!Info rnr = ^%rnr%
        > ^!Info filenaam = ^%Filenamen^%rnr%%
        > ^!Info regel = ^%NL%^%Regels^%rnr%%
        >
        > Met vriendelijke groet,
        >
        > *Bauke P. de Vries
        > *
        >
        >
        >
        >
        >
        > Fookes Software: http://www.fookes.us, http://www.fookes.com
        > Fookes Software Mailing Lists: http://www.fookes.us/maillist.htm
        >
        > Yahoo! Groups Links
        >
        >
        >
        >
        >
        >
      • acummingsus
        ... the first ... the bottom ... ^!IfFileExist ^%Filenamen^%rnr%% ^!Goto bestaat ELSE ^!Goto bestaatniet ^!IfFileExist ^%Filenamen^%rnr%% bestaat ELSE
        Message 3 of 19 , Sep 11, 2005
        • 0 Attachment
          --- In ntb-clips@yahoogroups.com, "Ian D. Davies" <iddavies@s...> wrote:
          > I notice that you are not running through loop2. You only process
          the first
          > item in loop2 then fall through to ":bestaat". You need a goto at
          the bottom
          > of the loop sending you backup to loop2.

          ^!IfFileExist ^%Filenamen^%rnr%% ^!Goto bestaat ELSE ^!Goto bestaatniet

          ^!IfFileExist ^%Filenamen^%rnr%% bestaat ELSE bestaatniet

          The latter is correct. (^!Goto is not used) yes, help says goto label
          true else goto label false (the help tries to be on the terse side)

          also saw some other problems. Early on you setarray to an empty
          string. To declare or pre declare is not needed in the clip language.
          Set is the keyword for the compiler/interpreter to launch that/a line
          of code so to speak.

          Set something once again to a new value, can do (which overwrites the
          old variable content).

          ================
          in clip help see: ^!Append

          Once have 1. used ^!Append then can 2. ^!Set . . .

          whenever want launched/ignited/processed (eval?) but there is no eval
          in clip language (so, append then set as a substitute for eval)

          Certainly this is not for always. But it is only when you do not want
          it immediately Set so to speak (use ^!Append only when need to build
          up to it and then "^!Set" at a later point/place).

          Mostly always is to just use only the Set command (with exception of
          the mentioned ocasion.)
          ================

          I didn't try to run your clip. I'm on Linux at the moment and looked
          at your clip.

          [ snip -- see previous post for to see the clip ]

          Alan.
        • hsavage
          ... first ... Bauke, Would you mind sending your latest clip version and several sample lines from a file you re trying to manipulate. It should be a big
          Message 4 of 19 , Sep 11, 2005
          • 0 Attachment
            Ian D. Davies wrote:
            > I notice that you are not running through loop2. You only process the
            first
            > item in loop2 then fall through to ":bestaat".
            >
            > ----- Original Message -----
            >
            >> Hello,
            >>
            >> I'm trying to write a clip to append a row from one file to another
            >> file. The "to"-file's name is based on the first field of the row in the
            >> "from"-file. The "from"-file has about 250 rows and for every row there
            >> should be a "to"-file. Must be checked.
            >>
            >> The problem is that I don't get any filenames from the filename-array in
            >> the second loop (loop2). I've tried it with another counter (%n%) but
            >> that doesn't work either.

            Bauke,

            Would you mind sending your latest clip version and several sample lines
            from a file you're trying to manipulate. It should be a big help.

            ºvº
            05.09.11
            hrs > hsavage@...
          • acummingsus
            ... Oh, yes, you are (likely may be) (you are) short circuiting your clip at that point. ... ^!Inc %rnr% ^!IfFileExist ^%Filenamen^%rnr%% bestaat ELSE
            Message 5 of 19 , Sep 11, 2005
            • 0 Attachment
              --- In ntb-clips@yahoogroups.com, "acummingsus" <acumming@c...> wrote:
              > --- In ntb-clips@yahoogroups.com, "Ian D. Davies" <iddavies@s...> wrote:
              > > I notice that you are not running through loop2. You only process
              > the first
              > > item in loop2 then fall through to ":bestaat". You need a goto at
              > the bottom
              > > of the loop sending you backup to loop2.

              Oh, yes, you are (likely may be) (you are) short circuiting your clip
              at that point.

              :loop2
              ^!Inc %rnr%
              ^!IfFileExist ^%Filenamen^%rnr%% bestaat ELSE bestaatniet


              :bestaat
              ^!Info bestaat !!!!!!!!!!!!!!!
              ^!Goto end

              :bestaatniet
              ^!Info bestaat niet !!!!!!!!!!!!!!!
              ^!Goto end
              ==============================

              it will ONLY do one record. It is so because whenever use ELSE

              makes it an either/or thing

              either it goes to point A

              or else it goes to point B.

              In this case (point A and B I mean to be the two of your labels ie
              colon_____) Each label ends/kills the clip as in ^!Goto end

              Thus:

              :bestaat
              ^!Info bestaat !!!!!!!!!!!!!!!
              ^!Goto end

              :bestaatniet
              ^!Info bestaat niet !!!!!!!!!!!!!!!
              ^!Goto end
              ===================================

              That's fine if that's what you want (want to end whenever passes
              through either of those labels **just once**.
              --

              But to recap:

              ^!IfFileExist ^%Filenamen^%rnr%% bestaat ELSE bestaatniet

              that line sends it to either of those two labels AND both (since both,
              then either) of those two labels then *ends/kills* the clip.

              But you seek for it to NOT end after only one record. So, in order to
              do so, the logic of your clip must be changed.

              Alan.
            • abairheart
              ... Does your source file have paths for these filenames? If not, NoteTab will not likely find them. Abair
              Message 6 of 19 , Sep 12, 2005
              • 0 Attachment
                --- In ntb-clips@yahoogroups.com, "Bauke P. de Vries" <bpdevries@h...>
                wrote:
                > Hello,
                >
                > I'm trying to write a clip to append a row from one file to another
                > file. The "to"-file's name is based on the first field of the row in the
                > "from"-file. The "from"-file has about 250 rows and for every row there
                > should be a "to"-file. Must be checked.
                >
                > The problem is that I don't get any filenames from the filename-array in
                > the second loop (loop2). I've tried it with another counter (%n%) but
                > that doesn't work either.

                Does your source file have paths for these filenames? If not,
                NoteTab will not likely find them.

                Abair
              • Bauke P. de Vries
                Thank you all for your information! I learn a lot this way. My clip now is functioning. I m trying to write a clip to append a row from one file to another
                Message 7 of 19 , Sep 13, 2005
                • 0 Attachment
                  Thank you all for your information!

                  I learn a lot this way. My clip now is functioning.

                  I'm trying to write a clip to append a row from one file to another
                  file. The "to"-file's name is based on the first field of the row in the
                  "from"-file. The "from"-file has about 250 rows and for every row there
                  should be a "to"-file. Must be checked.

                  Just one little problem left:
                  I want the "to"-file checked for duplicate rows (after coping the new
                  row). Here a duplicate row is a row where the first two fields (name,
                  date) are the same.
                  Only the last one of the dupl. rows should be kept.

                  Thanks in advance for helping and excuse my use of English (beiing Dutch)

                  Met vriendelijke groet,

                  *Bauke P. de Vries
                  *
                • Alan C.
                  ... Great! ... How are you copying new row? I asked because, if you can, it might be easy to ready the new row but to then use a variable inside the find
                  Message 8 of 19 , Sep 14, 2005
                  • 0 Attachment
                    On Tue, 13 Sep 2005 14:41:15 +0200, Bauke P. de Vries wrote:
                    > Thank you all for your information!
                    >
                    > I learn a lot this way. My clip now is functioning.

                    Great!

                    > I'm trying to write a clip to append a row from one file to another
                    > file. The "to"-file's name is based on the first field of the row in the
                    > "from"-file. The "from"-file has about 250 rows and for every row there
                    > should be a "to"-file. Must be checked.
                    >
                    > Just one little problem left:
                    > I want the "to"-file checked for duplicate rows (after coping the new
                    > row).

                    How are you "copying" new row? I asked because, if you can, it might be easy to "ready" the new row but to then use a variable inside the find command to search for dupes (in doc if it is a doc) and to then "copy" or not "copy" new row as desired.

                    There is great multiplicity of differing ways in which to do what you want. But the easiest to get to where you want is dependent upon what you already have right now.

                    So if you shared/share some sample lines of the "to" and "from" files (include a few unwanted duplicate lines) along with the clip that you are using at this point, it would help us better contrive some possibilities that would work for you.

                    > Here a duplicate row is a row where the first two fields (name,
                    > date) are the same.
                    > Only the last one of the dupl. rows should be kept.

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