A few potential solutions...
Suppose I have a CRUD in clients and, while inputting an client, I need to call that same CRUD to get another client (for instance the partner).
Lets say your program is called client_crud. You could write your program in such a way that you can go recursively call that same program from your program and go straight to a particular part of the program e.g....
ON ACTION view_partner
LET cmd = "fglrun client_crud --mode=read --id=", l_partner_id
RUN cmd
... as it is a seperate instance of the program, you avoid the issue with window/form identifiers.
Has anybody already faced this issue?
Otherwise a technique I've used in the past is to have a maximum depth of recursion (say 5 or 10) and then in your code
CASE depth
WHEN 1 OPEN WINDOW w_1 WITH FORM form_name
WHEN 2 OPEN WINDOW w_2 WITH FORM form_name
WHEN 3 OPEN WINDOW w_3 WITH FORM form_name
...
... to avoid the horrible duplicate code I would tend to use the pre-processor to avoid typing the duplicate code, something similar to ...
CASE depth
&define open_window(p1) WHEN p1 OPEN WINDOW w_ ## p1 WITH FORM form_name
open_window(1)
open_window(2)
open_window(3)
...
PS: I think the same reasoning can be applied to cursors, which I think are also global identifiers.
Correct. However since 3.00 you can use base.SqlHandle for this.
http://4js.com/online_documentation/fjs-fgl-manual-html/#c_fgl_ClassSqlHandle.htmlDEFINE cursor_list DYNAMIC ARRAY OF base.SqlHandle
or similar
Hope that helps,
Reuben