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

Re: [Clip] set file attribute of current file

Expand Messages
  • Eb
    Kudos to the genius who came up with the sort to detect the largest field, along with the formatting code. I m going to steal this technique for my own use.
    Message 1 of 29 , Oct 21, 2010
    • 0 Attachment
      Kudos to the genius who came up with the sort to detect the largest field, along with the formatting code. I'm going to steal this technique for my own use. Thanks (Diodem?).


      For testing purposes I used Don's data and output.

      If I may be so bold and offer some suggestions (it's always easier to come up with improvements than with an original idea<g>):


      --- In ntb-clips@yahoogroups.com, Don <don@...> wrote:
      > ...
      > I have a web application that exports this:
      > "Division","Abbrev","Team","All_Entries","M_Entries","F_Entries","Coach","Phone","Email"
      > "High School - (15)"," "," ","187","94","93"," "
      > "Michigan - Division 4","Alba","Alba","14","6","8",,,
      > ...


      > Clip after modification (thanks to all who contributed):


      Grab the input (from the write-protected file) into an array:
      ^!SetListDelimiter ^%nl%
      ;one line (gets fields 3..6)
      ^!SetArray %keepers%=^$GetDocMatchAll("^[^\,]*\,[^\,]*\,(([^\,]*\,){3}[^\,]*)";1)$
      ;end of one line

      then you can make a bunch of replacements, which will be much faster in an array, than in the document.

      ^!SetArray %keepers%=^$StrReplace(""";"";"^%keepers%";0;0)$
      ^!SetArray %keepers%=^$StrReplace(",";"^%tab%";"^%keepers%";0;0)$
      ^!SetArray %keepers%=^$StrReplace(" ^%tab%";"~^%tab%";"^%keepers%";0;0)$
      ;move totals record2 to end (after blank line)
      ^!SetArray %keepers%=^%keepers%^%nl%^%nl%Totals^%keepers2%
      ;blank line where rec2 was
      ^!ClearVariable %keepers2%

      I used the token '~' rather than the '.' in the above code to remove the confusion between the period as token and the period as special character. That way I can come back to the clip a year later and have a chance to understand what it does. To replace the "~" with " " at the end, a regex is needed, because for sopme reason the plain replace doesn't work.


      Cheers,


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