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

2973[NTB] Re: Arrays?

Expand Messages
  • Wayne M. VanWeerthuizen
    Nov 1, 1998
    • 0 Attachment
      djust@... wrote:
      >There was a guide somewhere to different methods for setting
      >up arrays in NTP. Anyone remember where?

      Clip programming is considered an advanced topic. To keep
      beginners from getting too overwhelmed on this list, most
      advanced topics are discussed on the NoteTab ADVANCED list.

      Followups to this message should be sent to the advanced
      list, rather than to here.

      --------

      The basic method for creating arrays is the create simple
      variables with similar names, such as

      ^!Set %Item1%="First Item"
      ^!Set %Item2%="Second Item"
      ^!Set %Item3%="Third Item"


      It is convenient that part of NoteTab variable name, can
      be the contents of another variable. Below %ItemNumber%
      is assigned the value 4, then the %ItemNumber% variable is
      used in forming the name of another variable: %Item4%

      ^!Set %ItemNumber%=4
      ^!Set %Item^%ItemNumber%%="Another Item"

      NoteTab parses this command in stages. In the first stage
      the ^%ItemNumber$ is replaced with a 4. Then the command
      effectively becomes: ^!Set %Item4%="Another Item". Pay
      careful attention to the placement of the % (percent) and
      ^ (circumflex) symbols.






      It is easy to use a loop to access each item in the array.


      ^!Set %ItemNumber%=1
      :OurLoop
      ^!Info Item Number ^%ItemNumber% is: ^%Item^%ItemNumber%%
      ^!Inc %ItemNumber%
      ^!If ^%ItemNumber% <= 4 OurLoop



      Several of my clips take advantage of array techniques.
      If you ask, I can send you some other examples.


      I'll note that above, where I have ^%ItemNumber%, you can
      have text strings (without spaces or special characters)
      instead of just numbers. For example:

      ^!Set %ItemMONDAY%="Something"
      ^!Set %ItemTUESDAY%="Something else"

      ^!Set %Day%="SATURDAY"
      ^!Info ^%Item^%Day%%


      Here is my demonstration clip.
      =========================================

      H="Wayne's Array Demo Clip version 5"
      ^!ClearVariables
      ^!Set %NumItems%=5
      :SetupQuery
      ^!ClearVariable %Query%
      ^!Append %Query%=%NewNum%=^?{Change the number of items=_No Change^=NC|1|2|3|4|5|6|7|8|9|10|100|200|400|800|1600|3200}

      ^!Set %Count%=0
      :LoopForInput
      ^!Inc %Count%
      ^!Set %Default1%=^$[^%Count%*2;0]
      ^!Append %QUERY%=; %Array^%Count%%=^?{Item#^%Count%=_^%Default1%|Notetab|Is|Awesome}
      ^!If ^%Count% < ^%Numitems% LoopForInput

      ^!SetWizardTitle Array Test 5
      ^!SetWizardLabel Set The Following ^%Numitems% Items.
      ^!Set ^%Query%

      ^!IfSame ^%Newnum% NC LoopForOutput
      ^!Set %Numitems%=^%Newnum%
      ^!Goto Setupquery

      :LoopForOutput
      ^!Set %Count%=0
      :LoopForOutput2
      ^!Inc %Count%
      ^!Set %Output%="^%Output% Item #^%Count% = ^%Array^%Count%%^P"
      ^!Iftrue ^%Count%<^%Numitems% LoopForOutput2

      ; Display Output All At Once
      ^!Info=[L]^%Output%



      --
      Wayne M. VanWeerthuizen
      ICQ: 15117288
      Homepage: http://www2.localaccess.com/waynemv
      ------------------------------------------------------------------------
      Subscribe, unsubscribe, opt for a daily digest, or start a new e-group
      at http://www.eGroups.com -- Free Web-based e-mail groups.
    • Show all 10 messages in this topic