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

Columnar data display

Expand Messages
  • Harvey R. Savage
    Hi ALL, Anyone can jump on this. I m trying to figure an easy way to display numbers right justified. I ve tried most of the string functions that looked like
    Message 1 of 10 , Jun 30, 2001
    • 0 Attachment
      Hi ALL,

      Anyone can jump on this.

      I'm trying to figure an easy way to display numbers right
      justified. I've tried most of the string functions that looked
      like they might work, no success yet.

      This is one of my last attempts, I thought sure it would work but
      the generated numbers are still left column justified.

      :Loop
      (various clip language looping instructions)
      ^$StrFormat(^$GetFileSize(^%dir%^%name^%index%%)$;1;8;False)$^%nl%
      ^!Goto Loop

      True or False has no apparent effect on left-right justification.

      I think I can do it in 2 or 3 lines of code but ideally I would
      like the entire instruction on the same line. Trying to keep
      processing time to a minimum.

      Also, I tried using a Mask but couldn't find a combination that
      worked with output. Seems as if Masks only work with a WIZARD.

      Any responses welcome!

      hrs
    • Alan C.
      Hi Harvey, ^$StrFormat( ^$GetFileSize(c: temp test.jpg)$ ;40;40;False)$ ^$StrFormat( ^$GetFileSize(c: temp test.jpg)$ ;40;8;False)$ both the above had same
      Message 2 of 10 , Jun 30, 2001
      • 0 Attachment
        Hi Harvey,


        ^$StrFormat("^$GetFileSize(c:\temp\test.jpg)$";40;40;False)$

        ^$StrFormat("^$GetFileSize(c:\temp\test.jpg)$";40;8;False)$

        both the above had same output for me shoved over to the right located same on output from each of the above.

        U might been miss quotes on 1st strform field.

        (r justified) Output:

        785408

        ----
        bye. Alan.
      • Harvey R. Savage
        ... Alan, Thanks for the response. I guess I should be clearer about what I want. I have this; I want this; 14011 14011 1370
        Message 3 of 10 , Jun 30, 2001
        • 0 Attachment
          Alan C wrote:
          >
          > Hi Harvey,
          >
          > ^$StrFormat("^$GetFileSize(c:\temp\test.jpg)$";40;40;False)$
          >
          > ^$StrFormat("^$GetFileSize(c:\temp\test.jpg)$";40;8;False)$
          >
          > both the above had same output for me shoved over to the right located same on output from each of the above.
          >
          > U might been miss quotes on 1st strform field.
          >
          > (r justified) Output:
          >
          > 785408
          >
          > ----
          > bye. Alan.

          Alan,

          Thanks for the response. I guess I should be clearer about what
          I want.

          I have this; I want this;

          14011 14011
          1370 1370
          1370 1370
          14140 14140
          14140 14140
          9 9
          34661 34661
          222 222
          1092 1092
          8501 8501
          7381024 7381024
          1177 1177
          1177 1177
          25061 25061

          I don't have a problem starting at column 40 but I want the
          numbers right aligned.

          hrs
        • Stephen Riddle
          Hi Harvey, Quite sometime ago there was a thread called Maiking numbers line up or something like that. I believe there were several successful clips. I have
          Message 4 of 10 , Jun 30, 2001
          • 0 Attachment
            Hi Harvey,
            Quite sometime ago there was a thread called "Maiking numbers line up"
            or something like that.
            I believe there were several successful clips.
            I have one of them I could send you and we could adapt it.
            I know I've got it because I found it and used it last week.
            What the clip does is breaks the rows of numbers up into an array, and
            adds spaces so that each line is the same length.
            I'll have to look at it again, but I think it is not e x a c t l y what
            you wanted.\
            Stephen

            "Harvey R. Savage" wrote:
            >

            > I'm trying to figure an easy way to display numbers right
            > justified. I've tried most of the string functions that looked
            > like they might work, no success yet.
            >
            >
          • Alan C.
            Hi Harvey, ... Now that you and I called my attention to it I see that strformat does the same for me as it does for you. I have fun tinkering. Following got
            Message 5 of 10 , Jun 30, 2001
            • 0 Attachment
              Hi Harvey,

              >I don't have a problem starting at column 40 but I want the
              >numbers right aligned.

              Now that you and I called my attention to it I see that strformat does the same for me as it does for you.

              I have fun tinkering. Following got numbers rh aligned for me.

              ^!Set %fsiz%=^$GetFileSize(c:\temp\test.jpg)$
              ^!Set %fsiz%=________^%fsiz%
              ^!Set %fsiz%=^$StrCopyRight(^%fsiz%;8)$
              ^!Set %fsiz%=^$StrFormat("_";40;8;False)$^%fsiz%
              ^!Set %fsiz%=^$StrReplace("_";"^%SPACE%";"^%fsiz%";False;False)$
              ^%fsiz%^%NL%

              could reduce the number from 40 in strformat if don't want it that far over on the page.

              bye. Alan.
            • Harvey R. Savage
              ... Hi Stephen, and Alan, Stephen, if you can lay your hands on that clip I would like to see it, thanks. Alan also sent a few lines of code that I haven t had
              Message 6 of 10 , Jul 1, 2001
              • 0 Attachment
                Stephen Riddle wrote:
                >
                > Hi Harvey,
                > Quite sometime ago there was a thread called "Maiking numbers line up"
                > or something like that.
                > I believe there were several successful clips.
                > I have one of them I could send you and we could adapt it.

                > I'll have to look at it again, but I think it is not e x a c t l y what
                > you wanted.\
                > Stephen
                >
                > "Harvey R. Savage" wrote:
                > >
                >
                Hi Stephen, and Alan,

                Stephen, if you can lay your hands on that clip I would like to see it, thanks.

                Alan also sent a few lines of code that I haven't had an opportunity to study yet.

                This all started a few days ago when soneone on the Clips list wanted to do Filenames and Sizes. I dislike columns of numbers that don't line up so for my own satisfaction I have been working on the problem.

                About midnight on June 30, I stumbled across the answer so I'll include the finished clip anyone wanting and willing can try it. Here it is;

                ;_hrs_created_7/1/01_2:01:27a_hsavage@...
                ^!Clearvariables
                ;------verrry long line
                ^!Set %dir%=^?{(T=D)&Browse to Directory=c:\};^%Space%%Ext%=^?{(H=10)File &Types==_All Files^=*.*|Html^=*.*htm*|Text^=*.txt|Html & Text^=*.*htm*;*.txt|Outline^=*.otl|Clipbook Library^=*.clb|Ini^=*.ini|Foxbase Programs^=*.prg;*.fmt}
                ;
                ^!SetListDelimiter |
                ^!Set %Name%=^$GetFiles(^%dir%;^%Ext%)$
                ^!Set %Name%=^$StrReplace(^%dir%;^%EMPTY%;^%name%;False;False)$
                ^!SetArray %name%=^%Name%
                ^!Set %index%=0
                ^!Toolbar New Document
                :loop
                ^!Inc %index%
                ^!If ^%index% > ^%name0% end
                ;------extremely long line with no spaces
                ^%name^%index%%^%Space%^$StrFill(^$DecToChar(183)$;^$Calc(40-(^$StrSize(^%name^%index%%)$))$)$^$StrFill(^%Space%;^$Calc(8-(^$StrSize(^$GetFileSize(^%dir%^%name^%index%%)$)$))$)$^$GetFileSize(^%dir%^%name^%index%%)$^%nl%
                ;
                ^!Goto Loop
                :end
                ^!Save AS dirlist.txt


                hrs
              • Harvey R. Savage
                ... This is a P.S. I forgot to mention, I you have an extremely long filename, say in this case, over 40 characters the clip will error out. When I ran the
                Message 7 of 10 , Jul 1, 2001
                • 0 Attachment
                  Harvey R Savage wrote:
                  >
                  > Stephen Riddle wrote:
                  >
                  > > "Harvey R. Savage" wrote:
                  > > >
                  > Hi Stephen, and Alan,
                  >
                  > Stephen, if you can lay your hands on that clip I would like to see it, thanks.
                  >
                  > Alan also sent a few lines of code that I haven't had an opportunity to study yet.
                  >

                  This is a P.S.

                  I forgot to mention, I you have an extremely long filename, say
                  in this case, over 40 characters the clip will error out. When I
                  ran the clip on my Windows folder I hit a filename that was 55
                  characters. The way clip is set up now it should handle
                  fileSizes up to, and including, 8 digits, that would be a
                  filesize of up to 99999999 bytes. Any thing larger would
                  probably error out also.

                  hrs


                  ;_hrs_created_7/1/01_2:01:27a_hsavage@...
                  ^!Clearvariables
                  ;------verrry long line
                  ^!Set %dir%=^?{(T=D)&Browse to
                  Directory=c:\};^%Space%%Ext%=^?{(H=10)File &Types==_All
                  Files^=*.*|Html^=*.*htm*|Text^=*.txt|Html &
                  Text^=*.*htm*;*.txt|Outline^=*.otl|Clipbook
                  Library^=*.clb|Ini^=*.ini|Foxbase Programs^=*.prg;*.fmt}
                  ;
                  ^!SetListDelimiter |
                  ^!Set %Name%=^$GetFiles(^%dir%;^%Ext%)$
                  ^!Set %Name%=^$StrReplace(^%dir%;^%EMPTY%;^%name%;False;False)$
                  ^!SetArray %name%=^%Name%
                  ^!Set %index%=0
                  ^!Toolbar New Document
                  :loop
                  ^!Inc %index%
                  ^!If ^%index% > ^%name0% end
                  ;------extremely long line with no spaces
                  ;^%name^%index%%^%Space%^$StrFill(^$DecToChar(183)$;^$Calc(40-(^$StrSize(^%name^%index%%)$))$)$^$StrFill(^%Space%;^$Calc(8-(^$StrSize(^$GetFileSize(^%dir%^%name^%index%%)$)$))$)$^$GetFileSize(^%dir%^%name^%index%%)$^%nl%
                  ;
                  ^!Set
                  %a%=^%name^%index%%^%Space%^$StrFill(^$DecToChar(183)$;^$Calc(40-(^$StrSize(^%name^%index%%)$))$)$
                  ;
                  ^!Set
                  %b%=^$StrFill(^%Space%;^$Calc(8-(^$StrSize(^$GetFileSize(^%dir%^%name^%index%%)$)$))$)$^$GetFileSize(^%dir%^%name^%index%%)$^%nl%
                  ^%a%^%b%
                  ;
                  ^!Goto Loop
                  :end
                  ^!Save AS dirlist.txt
                • thefrank
                  Hi Harvey, ... There were several clips generated from that thread, built using different methods. While each method did the job, some were much faster that
                  Message 8 of 10 , Jul 1, 2001
                  • 0 Attachment
                    Hi Harvey,

                    > > ...if you can lay your hands on that clip...

                    There were several clips generated from that thread, built using
                    different methods. While each method did the job, some were much
                    faster that others, some just easier to use, and some more reliable.

                    My notes say that Stephen, Wheeler, Dan, and myself were involved in
                    that thread, but there may have been others. Seems I recall the
                    person who started the thread was never heard from again...

                    This is the clip I use now, which includes elements or methods from
                    many of the submissions (watch for wrapped lines):


                    ---------------------------------

                    ^!Set %Count%=^$GetTextLineCount$
                    ^!SetListDelimiter ":"
                    ^!SetArray %ST%=^$GetDate(hh:nn:ss)$
                    ^!Set %RightMargin%=^?[Set Right Margin nnn spaces=45]
                    ^!Jump Doc_End
                    ^!InsertText ^%NL%
                    ^!Jump 1
                    :LOOP
                    ^!Set %ThisLine%=^$GetLineSize$
                    ^!Set %MoveRight%=^$Calc(^%RightMargin%-^%ThisLine%)$
                    ^!Set %StrFill%=^$StrFill(^%SPACE%;^%MoveRight%)$
                    ^!Replace "{\d+\n}" >> "^%StrFill%\1" RS
                    ^!IfError SHOWTIME
                    ^!Goto Loop
                    :SHOWTIME
                    ^!SetArray %ET%=^$GetDate(hh:nn:ss)$
                    ^!Set %Ssec%=^$Calc(^%ST3% + ^%ST2% * 60 + ^%ST1% * 3600)$
                    ^!Set %Esec%=^$Calc(^%ET3% + ^%ET2% * 60 + ^%ET1% * 3600)$
                    ^!If ^%Ssec%>^%Esec% ^!Inc %Esec% 86400
                    ^!Set %secs%=^$Calc(^%Esec%-^%Ssec%)$
                    ^!Set %hrs%=^$StrCopyRight("0^$Calc( ^%secs% DIV 3600)$";2)$
                    ^!Set %min%=^$StrCopyRight("0^$Calc((^%secs%-3600*^%secs%DIV3600)
                    DIV60)$";2)$
                    ^!Set %sec%=^$StrCopyRight("0^$Calc( ^%secs% MOD 60)$";2)$
                    ^!Info Lines Formatted:^t^%NL%^%NL%^%Count%^%NL%^%NL%Start Time:^t^%
                    ST%^%NL%End Time:^t^%ET%^%NL%Run Time:^t^%hrs%:^%min%:^%sec%

                    --------------------

                    Regards,

                    tf
                  • Stephen Riddle
                    ... Seems like that happens a lot. Someone asks what they think is a simple question and a bunch of us get all excited and have fun. Would be nice to know if
                    Message 9 of 10 , Jul 1, 2001
                    • 0 Attachment
                      thefrank wrote:
                      >

                      > My notes say that Stephen, Wheeler, Dan, and myself were involved in
                      > that thread, but there may have been others. Seems I recall the
                      > person who started the thread was never heard from again...
                      >
                      >
                      Seems like that happens a lot. Someone asks what they think is a simple
                      question and a bunch of us get all excited and have fun.
                      Would be nice to know if we answer the question though.
                      <sigh>Guess manners can't be legislated. </sigh>
                      T'care
                      Stephen
                    • Don Passenger
                      I have benefitted several times from people writing clips which were better, more advanced, worked when mine didn t. I often write directly to the person to
                      Message 10 of 10 , Jul 1, 2001
                      • 0 Attachment
                        I have benefitted several times from people writing clips which were better,
                        more advanced, worked when mine didn't. I often write directly to the
                        person to thank them. Frankly, thank you type of messages are considered
                        bad form on several of the lists I belong to because they don't advance the
                        topic.

                        It all depends on how quickly the help gets there .... and sometimes the
                        clip is to achieve a one time data conversion or something so no matter how
                        good it gets ... I had one like that a while back where on day two of the
                        excitement I used the clip rendered by the "group" and on day three or so
                        someone did it in about one line instead of the 25 the committee used.

                        Sometimes the end product is awesome and used over and over. A good example
                        of excitement paying off was when we started the "snatch a web-safe" color
                        thread. We wrote a clip to get the color from an outside source (freeware
                        program) and the frank instead writes a great clip to put the colors in the
                        clip bar (which I need to go get again after a meltdown this weekend ....
                        sigh hard disk wiped). I used the ultimate output. I was also duly
                        impressed by the generate a page on the fly clip in the middle of the
                        thread.


                        thread:

                        http://groups.yahoo.com/group/ntb-clips/messages/5426?threaded=1

                        Anyway ... as it may get overlooked sometimes ... thanks to all for
                        contributing to my specific questions on occaision and to my knowledge base
                        every time I read one of your posts.

                        Don Passenger
                        mailto:dpasseng@...



                        ----- Original Message -----
                        From: "Stephen Riddle" <stephen@...>
                        To: <ntb-clips@yahoogroups.com>
                        Sent: Sunday, July 01, 2001 7:59 PM
                        Subject: Re: [Clip] Columnar data display


                        >
                        >
                        > thefrank wrote:
                        > >
                        >
                        > > My notes say that Stephen, Wheeler, Dan, and myself were involved in
                        > > that thread, but there may have been others. Seems I recall the
                        > > person who started the thread was never heard from again...
                        > >
                        > >
                        > Seems like that happens a lot. Someone asks what they think is a simple
                        > question and a bunch of us get all excited and have fun.
                        > Would be nice to know if we answer the question though.
                        > <sigh>Guess manners can't be legislated. </sigh>
                        > T'care
                        > Stephen
                        >
                        >
                        >
                        > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
                        >
                        >
                      Your message has been successfully submitted and would be delivered to recipients shortly.