arr_curr()

During or immediately after the INPUT ARRAY or DISPLAY ARRAY statement arr_curr() returns the number of the program record within the program array that is displayed in the current line of a screen array, or the last active screen array if there is no current array.

 

The current line of a screen array is the line that displays the screen cursor at the beginning of a BEFORE ROW or AFTER ROW clause.

arr_curr() returns an integer value. The first row of the program array and the first line (that is, top-most) of the screen array are both numbered 1. The built-in functions arr_curr( ) and scr_line() can return different values if the program array is larger than the screen array.

 

You can pass arr_curr() as an argument when you call a function. In this way the function receives as its argument the current record of whatever array is referenced in the INPUT ARRAY or DISPLAY ARRAY statement.

 

arr_curr() can be used to force a FOR loop to begin beyond the first line of an array by setting a variable to arr_curr() and using that variable as the starting value for the FOR loop.

 

This program shows the differences between values returned by arr_curr( ) and scr_line().

The screen array defined in the form is 5 rows long. The program array defined in the 4gl is 20 rows long.

When a user moves to the 6th row by pressing "down arrow" key 5 times, the "Program array line" will be equal to 6 but the "Form array line" will remain equal to 5 because the screen array limit of 5 rows is reached.

Then, when a user moves up by pressing "up arrow" key, the "Program array line" will be equal to 5 and the "Form array line" will be equal to 4 because the user moved up one line on the screen array.

The ARR_CURR( ) function is frequently used with a DISPLAY ARRAY statement in popup windows to return the user’s selection.

 

 

Contact Us

Privacy Policy

Copyright © 2024 Querix, (UK) Ltd.