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: Two dimensions array MULTIPLE DIALOG PROBLEM  (Read 9731 times)
.
Posts: 11


« on: November 23, 2009, 06:21:41 pm »

We're trying to do a INPUT BY NAME of the second dimension of a double-dimension array and when we move up/down in the first array (multimaster) the INPUT BY NAME (detail)  is not updated. If we comment the INPUT BY NAME code the display instruction works properly displaying the correct data. If we put the data of the second dimension in a module variable the INPUT BY NAME instruction works properly... but not with the two dimensions array.

Thanks in advance,
Rodrigo.

* dialog2.4gl (1.61 KB - downloaded 890 times.)
* dialog2fr.per (0.46 KB - downloaded 893 times.)
Sebastien F.
Four Js
Posts: 545


« Reply #1 on: November 24, 2009, 10:03:31 am »

Can I suggest to prepare a little program and send that code example to the support channel please?
Thanks
Seb
Reuben B.
Four Js
Posts: 1116


« Reply #2 on: November 24, 2009, 10:41:04 pm »

Hi Seb,

Rodrigo actually attached some example code, the email notification  still doesn't tell us if there is an attachment :-(.

In summary he has ...

Code
  1. DIALOG ATTRIBUTES(UNBUFFERED)
  2.   DISPLAY ARRAY arr TO sa.*...
  3.   INPUT BY NAME arr2[DIALOG.getCurrentRow("sa")].*
  4. END DIALOG

... I'm guessing as he moves up/down the array, the variable used in the INPUT is actually changing, as opposed to the value of the variable in the INPUT.  The INPUT stays as INPUT BY NAME arr2[1].* and correctly responds to any changes in arr2[1].*

I suspect something like...

Code
  1. TYPE arr2Type RECORD
  2.   r RECORD
  3.      reg1 INTEGER,
  4.      reg2 CHAR(20)
  5.   END RECORD
  6. END RECORD
  7.  
  8. DEFINE arr2 DYNAMIC ARRAY OF arr2Type
  9. DEFINE rec2 arr2Type
  10.  
  11. DIALOG ATTRIBUTES (UNBUFFERED)
  12.     DISPLAY ARRAY arr TO sa.*
  13.       BEFORE ROW
  14.          LET fnc_arr = DIALOG.getCurrentRow("sa")
  15.          LET rec2.r.* = arr2[fnc_arr].r.*
  16. ....
  17.    INPUT BY NAME rec2.r.* ATTRIBUTES(WITHOUT DEFAULTS)
  18.       ON CHANGE reg1
  19.          LET arr2[fnc_arr].r.reg1 = rec2.r.reg1
  20.       ON CHANGE reg2
  21.          LET arr2[fnc_arr].r.reg2 = rec2.r.reg2
  22.  

... will do the job in the interim so that the variable (but not necessarily the value) used in the INPUT is constant.  Wether the unbuffered DIALOG should respond to a change in variable, as opposed to a change in variable value, I'll leave upto you and the team.

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 #3 on: November 25, 2009, 11:01:57 am »

Ok thanks Reuben for pointing me to the attachment.

Yes the current behavior is expected.

Actually when doing:

   INPUT BY NAME arr2[DIALOG.getCurrentRow("sa")].r.*

The runtime system evaluates the DIALOG.getCurrentRow("sa") expression only once when the dialog starts, to bind the array fields to the dialog, as Reuben described.

The workaround suggested by Reuben is what I would also do.

Seb
.
Four Js
Posts: 4


« Reply #4 on: November 25, 2009, 05:54:36 pm »

The email notification now tells if there is an attachment (in the first sentence at the top).
Thank you for reporting, Reuben.
Helene / Webmaster.


* thanksgiving.jpg (61.28 KB, 150x213 - viewed 1723 times.)
Pages: [1]
  Reply  |  Print  
 
Jump to:  

Powered by SMF 1.1.21 | SMF © 2015, Simple Machines