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

Re: [Clip] FarClips in Large Libraries

Expand Messages
  • Ian NTnerd
    Art, Far clip does have some limitations compared to a clip in the same library. 1. If you use a common far clip that needs to call a clip in the starting
    Message 1 of 4 , Aug 2, 2012
    View Source
    • 0 Attachment
      Art,

      Far clip does have some limitations compared to a clip in the same library.

      1. If you use a common far clip that needs to call a clip in the
      starting library. You need to use far clip to call the clip in the
      starting library.
      My example:
      I use far clips for common functions. These I put in a clip called
      "call" The most used clip is a loop clip. Called "loopA" that needs an
      array called ^%arrayA%. I pass the farclip a parameter that is the
      subroutine clip. The subroutine is in the calling clips library. So my
      call is complex but saves a lot of other coding. Using ^$GetLibraryName$
      makes the clip more transportable to other clips.

      ^!farclip "call:loopA" ^$GetLibraryName$:actionforeacharrayitem

      2. Custom functions as opposed to a clip can't be called from far clips
      as such. However that limitation can be worked around by using a local
      custom function as a wrapper for a far clip.
      example:
      I have a custom function ^$xdigits()$ that adds zeros in front of a
      number so it is the required length. That is if the function is used
      ^$xdigits(5;10)$ then 00010 will be returned. You can add a local clip
      called ^$farfunc()$ that takes as many parameters as you choose to build
      it for. It acts like a function but it calls farclips that have a single
      variable that is then inserted as the result of the farfunc. I don't use
      this as much as ^!farclip but it has its uses.

      In the local library
      H="Test"
      Fill this number to four digits ^$farclip(call:xdigits;4;1)$

      H="~farfunc"
      ; FarFunc can call some functions in another clipbook
      ; xdigits, 2digit,
      ^!setlistdelimiter ;
      ^!set %input%=^&
      ^!setarray %part%=^%input%
      ^!set %param%=^$StrReplace("^%part1%;";"";"^%input%";No;No)$
      ^!farclip "^%part1%" ^%param%
      ^!result ^%outvalue%

      ---------------------
      In the far library named "call"
      ---------------------
      H="~xdigits"
      ; Output a set number of digits, that is padded with zeros.
      ; ^$xdigits(2;5)$ would return 05
      ; ^$xdigits(4;50)$ would return 0050
      ; can be called as a far function by farfunc clip.
      ; example ^$farfunc(call:xdigits;4;5)$ will return 0005
      ^!SetListDelimiter ;
      ^!SetArray %numb%=^&
      ^!set %digits%=^%numb1%
      ^!if ^$IsNumber(^%numb2%)$=1 switch else outofrange

      :switch
      ^!if ^$StrSize("^%numb2%")$>^%digits% outofrange
      ^!set %zeros%=^$calc(^%digits%-^$StrSize("^%numb2%")$)$
      ^!set %outvalue%=^$StrFill(0;^%zeros%)$^%numb2%
      ^!goto endxdigits

      :outofrange
      ^!info Out of range. No number with between 1 and ^%digits% digit input.
      The script will exit.
      ^!goto exit
      :endxdigits
      ^!result ^%outvalue%

      That is the issues I see. Surmountable but require some modification work.

      Ian

      On 3/08/2012 8:46 AM, Art Kocsis wrote:
      >
      > I am forced to bite the bullet to reorganize and partition
      > my clip library as it is way past too large and unwieldy.
      >
      > Although most of the interclip calls will stay within a given section,
      > some do not. To prevent future breakage, I am considering changing
      > all of the clip calls to FarClips.
      >
      > Is there any penalty or gotchas for doing this when a called clip is in
      > the same library and the Far attribute is unnecessary?
      >
      > Any other tips or suggestions on organizing large libraries?
      >
      > Thanks for your suggestions,
      >
      > Art
      >
      >




      [Non-text portions of this message have been removed]
    Your message has been successfully submitted and would be delivered to recipients shortly.