Windowindex Predefined Variable
Obsolete
This command is obsolete. This command is valid only in character-mode DataFlex or BasicReport objects.
Purpose
To provide indexed addressing of a series of windows in an image.
Syntax
pagename.#
&
The ampersand indicates that the window to be addressed is the window whose position in pagename is below that of pagename.# by the number of windows equal to the value of the predefined variable windowindex.
What It Does
A series of windows in an image may be addressed by a single command in a loop in which the value of windowindex is controlled. The window that is addressed in each execution of the loop is determined by the value of windowindex as an offset from the window identified as pagename.#&. The ampersand (&) is literal and required.
Until it is used, the value of windowindex is 0. Thus, until some other value is moved to windowindex, pagename.#& is the same as pagename.# with no ampersand after it. If windowindex is 1, then pagename.#& refers to the next window after pagename.#. References to pagename.# (with no ampersand) are never affected by windowindex, regardless of its value.
There are two primary ways of using windowindex:
-
To select randomly from a range of windows. For example, windows in
Imagemerchandisemight relate through print commands to four fields inDatabase Filemerchin this way:Window Field merchandise.1 merch.recnum merchandise.2 merch.retail_price merchandise.3 merch.dealer_price merchandise.4 merch.distrib_price
Records in the customer file might have a terms field containing 1, 2, or 3, which determines which price (retail, dealer, or distributor) applies to each customer. The following would move the correct price to variable cost:
move customer.terms to windowindex
move merchandise.1& to cost
- To access a range of windows sequentially.
for windowindex from 0 to 11
calc (merchandise.8& * 1.05) to merchandise.8&
loop
In this example, the contents of the eighth through 19th windows of Imagemerchandise are multiplied by 1.05.
Notes
-
windowindexmay be positive for a downward offset frompagename.#&, or negative for an upward offset. -
If
windowindexdrives the window being addressed into the next or the previous image, it will address windows in such images without triggering an error. This is a valid way of addressing windows in multiple images, so long as it is intended. If a value ofwindowindexis generated that addresses a nonexistent window (before the first window in the program or after the last one), DataFlex Error 12, "Window number out of range," will be generated. -
If you have renamed a window with the
namecommand, you may basewindowindexranges on such a window by itspagename.#or by its name, so long as you append the ampersand (&) to whatever you use. -
The ampersand character cannot be a window number by itself; it must be appended to the actual number of a window in the image.
-
A similar variable that works on fields instead of windows is
fieldindex. -
You cannot address subtotal accumulators (see
subtotalcommand) throughwindowindex.