Subscribe for automatic updates: RSS icon RSS

Login icon Sign in for full access | Help icon Help
Advanced search

Pages: [1]
  Reply  |  Print  
Author Topic: Form and Windows names/identifiers  (Read 9456 times)
Lu?s T.
Posts: 39


« on: October 25, 2017, 01:04:19 pm »

As far I understand windows and form identifiers must be unique in the scope of the program:
"The form identifier does not need to match the name of the form specification files, but it must be unique
among form names in the program. Its scope of reference is the entire program."


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).

This will be solvable if the window/form identifier is local to the function.

Has anybody already faced this issue? What will be the solution for that?

PS: I think the same reasoning can be applied to cursors, which I think are also global identifiers.
Reuben B.
Four Js
Posts: 1114


« Reply #1 on: October 26, 2017, 11:07:19 pm »

A few potential solutions...

Quote
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....

Code
  1. ON ACTION view_partner
  2.    LET cmd = "fglrun client_crud --mode=read --id=", l_partner_id
  3.    RUN cmd

... as it is a seperate instance of the program, you avoid the issue with window/form identifiers.


Code
  1. Has anybody already faced this issue?
  2.  

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

Code
  1. CASE depth
  2.   WHEN 1 OPEN WINDOW w_1 WITH FORM form_name
  3.   WHEN 2 OPEN WINDOW w_2 WITH FORM form_name
  4.   WHEN 3 OPEN WINDOW w_3 WITH FORM form_name
  5. ...

... to avoid the horrible duplicate code I would tend to use the pre-processor to avoid typing the duplicate code, something similar to ...

Code
  1. CASE depth
  2.   &define open_window(p1) WHEN p1 OPEN WINDOW w_ ## p1 WITH FORM form_name
  3.   open_window(1)
  4.   open_window(2)
  5.   open_window(3)
  6. ...

Code
  1. PS: I think the same reasoning can be applied to cursors, which I think are also global identifiers.
  2.  

Correct.  However since 3.00 you can use base.SqlHandle for this.  http://4js.com/online_documentation/fjs-fgl-manual-html/#c_fgl_ClassSqlHandle.html

Code
  1. DEFINE cursor_list DYNAMIC ARRAY OF base.SqlHandle

or similar

Hope that helps,

Reuben











Product Consultant (Asia Pacific)
Developer Relations Manager (Worldwide)
Author of https://4js.com/ask-reuben
Contributor to https://github.com/FourjsGenero
Sebastien F.
Four Js
Posts: 545


« Reply #2 on: October 27, 2017, 09:14:55 am »

We have often discussed this internally, the feature is identified as FGL-2297

Seb
Lu?s T.
Posts: 39


« Reply #3 on: November 06, 2017, 09:36:54 am »

Thanks for the hints Reuben.

What is "FGL-2297" Sebastien?
Sebastien F.
Four Js
Posts: 545


« Reply #4 on: November 06, 2017, 10:36:56 am »

FGL-2297 is the identifier of the ticket in our bugs/features database.
See https://4js.com/support/issue/?id=FGL-02297#startissue
Seb
Pages: [1]
  Reply  |  Print  
 
Jump to:  

Powered by SMF 1.1.21 | SMF © 2015, Simple Machines