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: Is it possible to display the same field in multiple places on a form?  (Read 738 times)
Ernest D.
Posts: 19


« on: August 30, 2024, 12:22:44 am »

Is it possible to display the same field in multiple places on a form?
For example:
LAYOUT
GRID
{
[field1]
[field2]
}
END
ATTRIBUTES
field1 = formonly.field1,
field2 = formonly.field1;

This is returning to me the error: The column 'field1' appears more then once.See error number -2892.
Sebastien F.
Four Js
Posts: 545


« Reply #1 on: August 30, 2024, 12:23:50 pm »

Hello,

No this is not possible, but would be a nice feature.

You need to define distinct fields and program variables, and sync the program variables sharing the same value.

Consider using the UNBUFFERED mode to reduce the code by getting rid of DISPLAY BY NAME / DISPLAY TO when changing variable values bound to a dialog.

Array/table fields that do not need to be displayed in the TABLE can be defined as PHANTOM fields, and displayed in another field of the form.

I do also implement "dialog setup" functions, to sync action and field activation, according to the context / current values / number of rows in tables.

This technique centralizes all actions/fields setup, and can be called from different places in the dialog block. If you put DIALOG.setActionActive() / DIALOG.setFieldActive() calls all over the place in a complex dialog block, you end up with unmaintainable code.

This setup function can also be used to sync linked fields.

You can find nice examples on our github:

https://github.com/FourjsGenero/ex_books

In this example, we use BEFORE ROW to sync directly a TEXTEDIT field containing data from the current row:

Code
  1.        BEFORE ROW
  2.            LET f_plot = books[ arr_curr() ].b_plot
  3.  

For dialog setup functions, see for ex:

https://github.com/FourjsGenero/tool_fglsqldebug

https://github.com/FourjsGenero/ex_app_menu

https://github.com/FourjsGenero/fgl_query_dialog



Seb
Pages: [1]
  Reply  |  Print  
 
Jump to:  

Powered by SMF 1.1.21 | SMF © 2015, Simple Machines