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: input array with hidden field  (Read 7915 times)
Luca B.
Posts: 5


« on: June 26, 2017, 02:17:18 pm »

Hi all,
i have a problem with my input array.

if try to create an input array for example:

define
    arr_val dynamic array of
Luca B.
Posts: 5


« Reply #1 on: June 26, 2017, 02:33:02 pm »

sorry the post was not finished


Hi all,
i have a problem with my input array.


i use GST 3.00.22 and GDC 3.00.21

if try to create an input array like this example:

define
    arr_val dynamic array of
          record
               rec1 string,
               rec2 string,
               rec3 string,
               rec4 string
          end record

dialog
       input array arr_val from record1.* attribute (UNBUFFERED, WITHOUT DEFAULTS)
          BEFORE ROW
      let arr_val[dialog.getcurrentRow('record1')].rec1 = 'example'

     after row
          ####### here i have the problem
       end input
       


end dialog



if the column relative to "rec1" is hidden in my 4fd form file, when i read the current value of rec1 in the after row the value is null (the expected value is "example ").

anyone have the same problem?


thank you
Rene S.
Four Js
Posts: 112


« Reply #2 on: June 26, 2017, 06:21:13 pm »

You're using BEFORE ROW to initialize the target variable? That's the wrong place. Use BEFORE INSERT. BEFORE ROW will be called for existing and new rows. BEFORE INSERT will be called for new rows only. The initialization of the new row happens when returning from BEFORE ROW and before entering BEFORE INSERT.

Some other remarks: you can simplify your code: The builtin function arr_curr() returns the index of the current row in the current context. Calling "dialog.getcurrentRow('<screen-record-name>')" is only required when accessing the current row of another dialog or another sub-dialog.
Code
  1.    -- old:
  2.    LET arr_val[dialog.getcurrentRow('record1')].rec1 = 'example'
  3.    -- new:
  4.    LET arr_val[arr_curr()].rec1 = 'example'
  5.  
Luca B.
Posts: 5


« Reply #3 on: June 27, 2017, 02:35:05 pm »

i tried with BEFORE INSERT and it work fine. thanks

i use dialog.getcurrentRow() because i have 5 input array and if i use arr_curr() sometimes it doesn't work fine and return the row of another array.

thank you
Pages: [1]
  Reply  |  Print  
 
Jump to:  

Powered by SMF 1.1.21 | SMF © 2015, Simple Machines