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

Re: [Clip] Testing Conditions?

Expand Messages
  • Phillip Sand Hansel II
    Thank you very much. I did start with IsError and skip, except in my newbieness, I said ^!Skip instead of skip . It did not work like I expected it to (but
    Message 1 of 11 , Jun 9, 2006
    • 0 Attachment
      Thank you very much. I did start with IsError and skip, except in my
      newbieness, I said "^!Skip" instead of "skip". It did not work like I
      expected it to (but it probably works like it is supposed to).

      The replace line is admittedly rather odd, may be my ignorance showing
      again.


      In one clip that I have, I find a word, and replace it with itself PLUS a
      descriptive comment (words after the :)
      ^!REPLACE LATED.OHMM LATED.OHMM : 18 FOOT 8 INCH LATERAL RESISTIVITY
      FROM IEL SWIC


      Adding these specific curve comments works great. But from these many
      individual curve possibilities, I make one generic curve name (DRESWS). What
      I am trying to do is to state the source curve in the generic curve's
      comment area.

      What I am trying to do is add a descriptive comment, "this generic curve was
      created from this specific curve".

      ^!REPLACE DRESWS.OHMM DRESWS.OHMM : DEEP RESISTIVITY [^%DRES%] SWIC

      So, if I find the specific curve LATED.OHMM in the file, there is another
      comment for the generic DRESWS curve that I want to change to reflect it's
      source.

      There are maybe 100 specific curves for Deep Resistivity (in thousands of
      wells), I've used the one in "this well" (LATED) to create a generic curve
      named (DRESWS), and I am trying to assign it's specific source in a comment
      (DRESWS came from LATED in this case).

      So far, I have been doing that with cut & paste and using my mind to make
      the decision over-and-over again. Although the logic is a little twisted, I
      think a clip would be a more elegant solution in the long run.

      Thanks to your help, I will get it working (along the lines I first started
      down before I got myself helplessly confused by adding 2 characters where
      they were not needed).



      Mr. Phillip Sand Hansel II
      http://philliphansel.com


      ----- Original Message -----
      From: "Alan_C" <acummingsus@...>
      To: <ntb-clips@yahoogroups.com>
      Sent: Friday, June 09, 2006 1:24 AM
      Subject: Re: [Clip] Testing Conditions?


      > Hi,
      >
      > AFAIK ^!IfTrue needs something that returns what is either true or false
      > in
      > Notetab.
      >
      > true or false or 1 or 0 returned fit that bill.
      >
      > AFAIK the ^!Find command does not do that. But the return (success or
      > failure) of the ^!Find command can be checked using ^!IfError as in the
      > next:
      >
      > (it says "if the item is not found, skip the next line of instruction" so
      > when
      > one of the ^!set lines gets skipped for example this one: ^!Set
      > %DRES%=LATED
      > what it means is that this line itself does not get run and then execution
      > begins again with the (next or following line) ^!SetCursor 1:1 in this
      > case.
      >
      > ^!SetCursor 1:1
      > ^!Find "LATED" IS
      > ^!IfError skip
      > ^!Set %DRES%=LATED
      > ^!SetCursor 1:1
      > ^!Find "ILDED" IS
      > ^!IfError skip
      > ^!Set %DRES%=ILDED
      > ^!SetCursor 1:1
      > ^!Find "AT90ED" IS
      > ^!IfError skip
      > ^!Set %DRES%=AT90ED
      >
      > I can't quite understand what you seek to do via the ^!replace command
      >
      > ^!replace "find_this" >> "replace_with_this" ISWA
      >
      > Alan.
      > On Thursday 08 June 2006 15:31, Phillip Sand Hansel II wrote:
      >> Greetings:
      >>
      >> I am trying to find out if a word is in a file I am editing, and if it is
      >> in there, change another variable based on the first one's existence. If
      >> it
      >> is not there, I want to see if perhaps the next item is there, etc...
      >>
      >> I am trying to say, "change the generic curve comment to reflect it's
      >> specific source curve name".
      >> (The generic DRES curve came from the specific curve named ILDED).
      >>
      >> ; Attempt to auto-replace second variable based on presence of first.
      >> ^!SetCursor 1:1
      >> ^!IfTrue ^!Find "LATED" ^!Set %DRES%=LATED
      >> ^!SetCursor 1:1
      >> ^!IfTrue ^!Find "ILDED" ^!Set %DRES%=ILDED
      >> ^!SetCursor 1:1
      >> ^!IfTrue ^!Find "AT90ED" ^!Set %DRES%=AT90ED
      >> ; etc... for many types of possible deep resistivity names, one of which
      >> is
      >> the source of my DRES curve.
      >>
      >> ^!Info ^%DRES%
      >> ; LAST STEP, change comment to the one that was found in the file.
      >> ^!REPLACE DRESWS.OHMM DRESWS.OHMM : DEEP RESISTIVITY [^%DRES%]
      >> SWIC
      >>
      > [ . . ]
      >
      >
      >
      > Fookes Software: http://www.fookes.us, http://www.fookes.com
      > Fookes Software Mailing Lists: http://www.fookes.us/maillist.htm
      >
      > Yahoo! Groups Links
      >
      >
      >
      >
      >
      >
    • hsavage
      ... it is in ... it is ... which is ... SWIC ... (probably ... Phillip, In your examples, ^!IfTrue ^!Find ILDED ^!Set %DRES%=ILDED, there are 3 clip commands
      Message 2 of 11 , Jun 9, 2006
      • 0 Attachment
        Phillip Sand Hansel II wrote:
        > Greetings:
        >
        > I am trying to find out if a word is in a file I am editing, and if
        it is in
        > there, change another variable based on the first one's existence. If
        it is
        > not there, I want to see if perhaps the next item is there, etc...
        >
        > I am trying to say, "change the generic curve comment to reflect it's
        > specific source curve name".
        > (The generic DRES curve came from the specific curve named ILDED).
        >
        > ; Attempt to auto-replace second variable based on presence of first.
        > ^!SetCursor 1:1
        > ^!IfTrue ^!Find "LATED" ^!Set %DRES%=LATED
        > ^!SetCursor 1:1
        > ^!IfTrue ^!Find "ILDED" ^!Set %DRES%=ILDED
        > ^!SetCursor 1:1
        > ^!IfTrue ^!Find "AT90ED" ^!Set %DRES%=AT90ED
        > ; etc... for many types of possible deep resistivity names, one of
        which is
        > the source of my DRES curve.
        >
        > ^!Info ^%DRES%
        > ; LAST STEP, change comment to the one that was found in the file.
        > ^!REPLACE DRESWS.OHMM DRESWS.OHMM : DEEP RESISTIVITY [^%DRES%]
        SWIC
        >
        > This does not work, and I am not sure of where I am going wrong
        (probably
        > punctuation), but want to show that I making some effort.
        >
        > Mr. Phillip Sand Hansel II

        Phillip,

        In your examples, ^!IfTrue ^!Find "ILDED" ^!Set %DRES%=ILDED, there are
        3 clip commands strung together. The ^!IfTrue another ^!If value.

        If, for instance, you had, ^!IfTrue "ILDED" ^!Set %DRES%=ILDED, and
        'ILDED' represented a true/false, 0/1, something that could be judged on
        a t/f basis it would work

        Like Alan, I'm not sure I understand the replace line. I modified the
        line in my example, is this what you intended? Alan gave you an option
        you could work with, here's another.

        <>····· Start Clip ·····<>
        H="Change Generic Curve Comment To Reflect Specific Source Curve Name"
        ^!ClearVariables
        ^!Jump 1
        ^!Find ILDED|AT90ED|LATED RS
        ^!IfError EXIT
        ^!Set %DRES%=^$GetSelection$
        ^!Info [L]^%DRES%
        ;
        ; LAST STEP, change comment to the one that was found in the file.
        ^!Replace "DRESWS.OHMM DRESWS.OHMM" >> ": DEEP RESISTIVITY [^%DRES%]"
        CIWS
        <>····· End Clip ·····<>

        Breakdown;

        Clears all variables

        ^!Jump 1 - moves cursor to top-left of doc

        ^!Find ILDED|AT90ED|LATED RS -- finds either of the 3 terms, using
        regex and terms separated by vertical bar. Finds the first occurrence
        of either of the 3, whichever appears first in the file. More than 3
        terms can be incorporated in the ^!Find using regex.

        ^!IfError EXITs clip if nothing found.

        ^!Set %DRES%=^$GetSelection$ -- The 'found' term is hi-lited by the
        ^!Find operation and assigned to the variable %DRES%.

        Info is informational, just shows you which term was the first found term
      • hsavage
        ... Phillip, In my example clip is an error. ^!Find ILDED|AT90ED|LATED RS, should be stated as, ^!Find (ILDED)|(AT90ED)|(LATED) RS, with each term in
        Message 3 of 11 , Jun 9, 2006
        • 0 Attachment
          hsavage wrote:
          > Phillip Sand Hansel II wrote:
          >> Greetings:
          >>
          >> I am trying to find out if a word is in a file I am editing, and if
          >>
          >> ; Attempt to auto-replace second variable based on presence of first.
          >> ^!SetCursor 1:1
          >>
          >> Mr. Phillip Sand Hansel II
          >
          > Phillip,
          >
          > <>····· Start Clip ·····<>
          > H="Change Generic Curve Comment To Reflect Specific Source Curve Name"
          > ^!ClearVariables
          > ^!Jump 1
          > ^!Find ILDED|AT90ED|LATED RS
          > ^!IfError EXIT
          > ^!Set %DRES%=^$GetSelection$
          > ^!Info [L]^%DRES%
          > ;
          > ; LAST STEP, change comment to the one that was found in the file.
          > ^!Replace "DRESWS.OHMM DRESWS.OHMM" >> ": DEEP RESISTIVITY [^%DRES%]"
          > CIWS
          > <>····· End Clip ·····<>

          Phillip,

          In my example clip is an error. ^!Find ILDED|AT90ED|LATED RS, should be
          stated as, ^!Find (ILDED)|(AT90ED)|(LATED) RS, with each term in
          parentheses, this applies to NoteTab Pro 4.95.

          ºvº
          06.06.09_11.04
          "Cooking III; How Not to Inflict Your Diets on Other People."
          hrs ø hsavage@...
        • Alan_C
          ... [ . . ] ... Superb. But it is different in that it makes just one pass through so as to locate only any one out of the three. Op s original clip, for
          Message 4 of 11 , Jun 9, 2006
          • 0 Attachment
            On Friday 09 June 2006 07:55, hsavage wrote:
            > Phillip Sand Hansel II wrote:
            > > Greetings:
            [ . . ]
            > <>····· Start Clip ·····<>
            > H="Change Generic Curve Comment To Reflect Specific Source Curve Name"
            > ^!ClearVariables
            > ^!Jump 1
            > ^!Find ILDED|AT90ED|LATED RS
            > ^!IfError EXIT
            > ^!Set %DRES%=^$GetSelection$
            > ^!Info [L]^%DRES%
            > ;
            > ; LAST STEP, change comment to the one that was found in the file.
            > ^!Replace "DRESWS.OHMM DRESWS.OHMM" >> ": DEEP RESISTIVITY [^%DRES%]"
            > CIWS
            > <>····· End Clip ·····<>

            Superb. But it is different in that it makes just one pass through so as to
            locate only any one out of the three.

            Op's original clip, for whatever reason, make three passes through, each time
            looking for one of the three (and if found, reset the var with what was
            found).

            So (OP) the var could get reset three times whereas in code above it only find
            one of the three and then set the var just once, even if all three are in
            doc.

            But I don't fully grasp what/why the OP reset the var up to three times given
            if three are found.

            So perhaps the above is what is needed.

            I'm just pointing out (mostly to the OP as I'm sure that H.S. knows already)
            that difference(s) exist.

            --
            Alan.
          • Don - HtmlFixIt.com
            I love IfError for just these kinds of situations.
            Message 5 of 11 , Jun 10, 2006
            • 0 Attachment
              I love IfError for just these kinds of situations.
              >> ^!IfError EXIT
            • Phillip Sand Hansel II
              Thank you. I very much appreciate your insight (hsavage, et al). ... looking for one of the three (and if found, reset the var with what was found). I knew my
              Message 6 of 11 , Jun 11, 2006
              • 0 Attachment
                Thank you. I very much appreciate your insight (hsavage, et al).

                >>Op's original clip, for whatever reason, make three passes through, each
                >>time
                looking for one of the three (and if found, reset the var with what was
                found).

                I knew my method was not elegant, I broke it down into steps I could
                understand. The RegEx method is much better CPU wise and maintenance wise. I
                mean, it will be easier for me to grow the list. On all wells, there is the
                possibility of hundreds, but in any one well, there is probably only one
                Deep Resistivity curve that I need to make a customized comment for. [Then
                there's a Medium, and a Shallow, a density, a gamma ray, a neutron and a
                sonic...etc... several different flavours of the same problem. When I get
                one worked out, then it is cut & paste cloning time.]

                It is awkward to explain, I should have posted an example (I will next
                time). However both respondents answered the question; one told me
                specifically what was wrong with my example, and the other answered the
                question in the way that I should have asked it if I had known better.

                The First Respondents suggestion worked, turns out I was adding a few
                characters ^! on the skip statement and when that didn't work, I modified
                everything radically to something that didn't work worse.

                I created quite a large clip out of the FR's logic, but see the advantages
                of Mr. hsavage's method, so I'll be converting that 1st effort to the RegEx
                method.

                Thanks a lot, pretty soon I'll be able to do half of my job without thinking
                and in just a few clicks. This won't get me more money, but it will get me a
                few more minutes to sit out on my deck and watch the birds. :-)

                Mr. Phillip Sand Hansel II
                http://philliphansel.com
              • Phillip Sand Hansel II
                Everyone questioned the Last Step... I think that was because I was using Tab delimited Replace. If you don t see the tabs, or if email stripped them, it is
                Message 7 of 11 , Jun 11, 2006
                • 0 Attachment
                  Everyone questioned the Last Step... I think that was because I was using
                  Tab delimited Replace. If you don't see the tabs, or if email stripped them,
                  it is harder to figure out.

                  Maybe it should look like this...
                  ^!Replace "DRESWS.OHMM" >> "DRESWS.OHMM : DEEP RESISTIVITY [^%DRES%]"
                  CIWS

                  I am trying to say, "if you find that word, replace it with itself, plus a
                  colon followed by a descriptive comment that also mentions it's source curve
                  name".

                  This comment and source curve everybody else types in manually (tedious and
                  prone to error; I shudder). I've got it 90% automatic and am trying to
                  squeeze in that most complicated last 8% (2% of the cases I probably won't
                  be able to clip my way out of, but that's not a problem considering.).

                  I've made a lot of clips that work; they may not be pretty, but they get the
                  job done. As I keep reading the list, I learn more elegant solutions.

                  Thanks again,
                  Mr. Phillip Sand Hansel II
                  http://philliphansel.com


                  ----- Original Message -----
                  From: "Alan_C" <acummingsus@...>
                  To: <ntb-clips@yahoogroups.com>
                  Sent: Friday, June 09, 2006 2:14 PM
                  Subject: Re: [Clip] Testing Conditions?


                  > ; LAST STEP, change comment to the one that was found in the file.
                  > ^!Replace "DRESWS.OHMM DRESWS.OHMM" >> ": DEEP RESISTIVITY [^%DRES%]"
                  > CIWS
                  > <>····· End Clip ·····<>
                • hsavage
                  ... each ... density, ... flavours of the ... cloning time.] ... thinking ... get me a ... Phillip, If there are, in fact, hundreds of possibles the way you
                  Message 8 of 11 , Jun 11, 2006
                  • 0 Attachment
                    Phillip Sand Hansel II wrote:
                    > Thank you. I very much appreciate your insight (hsavage, et al).
                    >
                    >>> Op's original clip, for whatever reason, make three passes through,
                    each
                    >>> time
                    > looking for one of the three (and if found, reset the var with what was
                    > found).
                    >
                    > On all wells, there is the possibility of hundreds, but in any one well,
                    > there is probably only one Deep Resistivity curve that I need to make a
                    > customized comment for. [Then there's a Medium, and a Shallow, a
                    density,
                    > a gamma ray, a neutron and a sonic...etc... several different
                    flavours of the
                    > same problem. When I get one worked out, then it is cut & paste
                    cloning time.]

                    > It is awkward to explain, I should have posted an example (I will next
                    > time). However both respondents answered the question; one told me
                    > specifically what was wrong with my example, and the other answered the
                    > question in the way that I should have asked it if I had known better.
                    >
                    > Thanks a lot, pretty soon I'll be able to do half of my job without
                    thinking
                    > and in just a few clicks. This won't get me more money, but it will
                    get me a
                    > few more minutes to sit out on my deck and watch the birds. :-)
                    >
                    > Mr. Phillip Sand Hansel II
                    > http://philliphansel.com

                    Phillip,

                    If there are, in fact, hundreds of possibles the way you might want to
                    go is with an array populated by a small database of you compilation.
                    If enough possibles are included in your custom list/database you could
                    probably get by without having to edit the clip, at least not too often.

                    The array/database method should apply to any other repetitious use of
                    variables. You can add the other flavors into one clip and possibly use
                    Wizards to make the preliminary choices.

                    ºvº
                    06.06.11_20.00
                    "Driving a Car Safely; A Skill You 'CAN' Acquire."
                    hrs ø hsavage@...
                  • hsavage
                    ... using ... stripped them, ... [^%DRES%] ... Phillip, Immediately apparent when double-arrow delimiter is used. ºvº 06.06.11_20.00 Driving a Car
                    Message 9 of 11 , Jun 11, 2006
                    • 0 Attachment
                      Phillip Sand Hansel II wrote:
                      > Everyone questioned the Last Step... I think that was because I was
                      using
                      > Tab delimited Replace. If you don't see the tabs, or if email
                      stripped them,
                      > it is harder to figure out.
                      >
                      > Maybe it should look like this...
                      > ^!Replace "DRESWS.OHMM" >> "DRESWS.OHMM : DEEP RESISTIVITY
                      [^%DRES%]"
                      > CIWS
                      >
                      > Thanks again,
                      > Mr. Phillip Sand Hansel II

                      Phillip,

                      Immediately apparent when double-arrow '>>' delimiter is used.

                      ºvº
                      06.06.11_20.00
                      "Driving a Car Safely; A Skill You 'CAN' Acquire."
                      hrs ø hsavage@...
                    Your message has been successfully submitted and would be delivered to recipients shortly.