input array, difference to Informix 4gl
Gjerstad, Øyvind <[email protected]> Tue, 8 Dec 2020 13:55:25 +0000
| Newsgroups | gmane.comp.lang.4gl.aubit.general |
|---|---|
| Message-ID | <[email protected]> |
It looks like there is a small nuance in the way arr_count() works, even in the simplest cases. In aubit, the arr_count() is updated whenever you reach a specific row with <enter> or <tab>, while in informix 4gl arr_count() is not increased until you actually type something on the row. In both versions one can still remove the current row with F2, and arr_count() will be decreased.
In this program, whether you type something on the first row or not, if you go to the next line by <tab> or <enter>, arr_count is 2 in aubit, but is 1 in informix 4gl. If you go down with arrow key, arr_count() is the same (1) in both cases.
Minimal test case:
main
define i integer,
la_foo array[5] of record
fld1 char(20)
end record
whenever any error stop
for i = 1 to 5
let la_foo[i].fld1 = null
end for
call set_count(0)
open window f_foo at 1,1 with form "input_array_test"
current window is f_foo
input array la_foo without defaults from sa_dummy.*
close window f_foo
let i = arr_count()
display "arr_count: ", i
for i = 1 to 5
if la_foo[i].fld1 is not null then
display "Row ", i using "<", ", value='", la_foo[i].fld1,"'"
end if
end for
end main
with form:
database formonly
screen
{
----------------------------- test of input array --------------------
[f000 ]
[f000 ]
[f000 ]
[f000 ]
[f000 ]
}
END
ATTRIBUTES
f000=formonly.fld1 type char;
INSTRUCTIONS
DELIMITERS "[]"
screen record sa_dummy[5]
(formonly.fld1)
END