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

Question about: ^$GetPosInField

Expand Messages
  • steveadausa
    Hi Everybody, I don t really understand this function: ^$GetPosInField(Row;Col;Options; SearchCriteria )$ I *hope* what it does is find a certain word in the
    Message 1 of 3 , Jul 12, 2002
    • 0 Attachment
      Hi Everybody,

      I don't really understand this function:

      ^$GetPosInField(Row;Col;Options;"SearchCriteria")$

      I *hope* what it does is find a certain word in the file and
      then tell you the position of the word in the file.

      Is that correct, or is there another function for that?

      Thanks,

      Steve Adams (NTP 4.9)
    • silvermoonwoman2001
      ... Hi Steve, There is a clip than demonstrates use of that function in the SampleCode Library called Search Fields . Its for use in columnar text where
      Message 2 of 3 , Jul 12, 2002
      • 0 Attachment
        --- In ntb-clips@y..., "steveadausa" <steveadausa@y...> wrote:
        > Hi Everybody,
        >
        > I don't really understand this function:
        >
        > ^$GetPosInField(Row;Col;Options;"SearchCriteria")$
        >
        > I *hope* what it does is find a certain word in the file and
        > then tell you the position of the word in the file.
        >
        > Is that correct, or is there another function for that?
        >
        > Thanks,
        >
        > Steve Adams (NTP 4.9)

        Hi Steve,

        There is a clip than demonstrates use of that function in the
        SampleCode Library called "Search Fields". Its for use in columnar
        text where "fields" are like data base elements. What separates the
        columns is the delimiter character (e.g., tab in the sample).

        From what you say, it sounds like you either want the offset to your
        text from the beginning of the file or else the row and column. For
        the first, you could use ^$StrPos$ and search in ^$GetText$ or in
        ^$GetFileText(File)$. For the second you could use a ^!Find, then
        assign a variable to ^$GetRow$:^$GetCol$.

        Regards,
        Sheri
      • Jody
        Hi Steve, I think you are looking for: StrPos ^$StrPos( SubStr ; Str ;CaseSensitive)$ Returns the index position of SubStr in Str. Use the CaseSensitive
        Message 3 of 3 , Jul 19, 2002
        • 0 Attachment
          Hi Steve,

          I think you are looking for:

          StrPos
          ^$StrPos("SubStr";"Str";CaseSensitive)$

          Returns the index position of SubStr in Str. Use the
          CaseSensitive parameter to determine if the match should be case
          sensitive or not. Returns 0 if there is no match. Tab and line-
          break tokens are automatically converted to their real characters
          since version 4.6.

          Example: ^$StrPos("def";"abcdefghi";True)$
          Result: 4

          I replied to the other below...

          >I don't really understand this function:
          >
          >^$GetPosInField(Row;Col;Options;"SearchCriteria")$
          >
          >I *hope* what it does is find a certain word in the file and
          >then tell you the position of the word in the file.
          >
          > Is that correct, or is there another function for that?

          Not really. You need to know the search criteria and filed
          before searching for it. You might be missing the ;Col; part.
          Your file needs to be a delimited file, such as tab delimited.
          So...

          Row is obvious
          Col is not a column like each character, but a field number
          for the column in the delimited file.
          Below we would be looking for the date shown in the search
          criteria when it is in the third column. There would be
          col1[tab]col2[tab]then col3. The options are self explanatory,
          I think. ;) Perhaps a piratical use you be you want to get all
          the lines that have the date in the field. The lines could be
          sales, ;), when something was added, when it was uploaded, etc.

          ^!SetDelimiter ^t
          ^!Info ^$GetPosInField(1;3;i;"05/07/2002")$
          ; ^$GetPosInField(Row;Col;Options;"SearchCriteria")$
          ; Returns the position of a search criteria in the specified field in a delimited
          ; text. No match returns 0. You can use the following optional settings:
          ; T: Does not search for words only (search string can be found within longer words)
          ; I: Ignore character case
          ; W: Criteria must match whole field
          ; S: Criteria must be at start of field

          Happy Clip'n!
          Jody

          http://www.notetab.net

          Subscribe, UnSubscribe, Options
          mailto:Ntb-Clips-Subscribe@yahoogroups.com
          mailto:Ntb-Clips-UnSubscribe@yahoogroups.com
          http://groups.yahoo.com/group/ntb-clips
        Your message has been successfully submitted and would be delivered to recipients shortly.