Four Js Development Tools Forum

Discussions by product => Genero BDL => Topic started by: Candy McCall on January 18, 2018, 06:18:51 AM

Title: arr_curr() returns a value of one on form with SCROLLGRID
Post by: Candy McCall on January 18, 2018, 06:18:51 AM
We encountered an issue today with our ERP application running BDL 3.10.09, GDC 3.10.11.  Server Centos 7.3, GDC Windows.

I have stripped down the forms and code to duplicate the issue.

Program:   cjminvinq.4gl
Forms:  cjminv.per, invqty-i.per

Run the program,   Click on Quantities Button.   Second form will display which is a SCROLLGRID.
Now, traverse the array.   Click Detail button on any line and the value of arr_curr() always returns a 1 instead
of the true row # in the program array.   Look in terminal window to see the value or see message displayed at bottom of form.

Now, when we were running our full application under the GBC through the GAS, the arr_curr() returned the proper value.
I tested this sample under 3.00 and it works.   This part of the ERP application has worked on all versions of BDL back to 2.32 as well.
When I changed the SCROLLGRID to TABLE in the form it works correctly.

Program:  cjminvinq.4gl
Code (genero) Select
#
DEFINE ninvloc         SMALLINT
        CONSTANT        max_invloca = 250       # Max no elements in p_invloca,
                                                #       p_invlocr
        DEFINE
        p_invloca       ARRAY[max_invloca] OF RECORD
                        loccd    CHAR(8),     # Location
                        locname  CHAR(30)      # Location Name
                        END RECORD
#
MAIN

        IF ui.Interface.getFrontEndName() != "Console" THEN
                CLOSE WINDOW SCREEN
        END IF
        DEFER INTERRUPT
        OPEN WINDOW inv1_form WITH FORM "cjminv"
                ATTRIBUTE (TEXT="Facilities")
#
#-------Display data found to user
#
        CALL cjmloadinvloc() RETURNING ninvloc
        CALL cjmshoinvloc()

END MAIN
FUNCTION cjmloadinvloc()
#
        DEFINE
        i               SMALLINT                # Counter

        FOR i = 1 TO max_invloca
                INITIALIZE p_invloca[i].* TO NULL
        END FOR
        LET p_invloca[1].loccd = "CANDY"
        LET p_invloca[1].locname = "Candy Location"
        LET p_invloca[2].loccd = "ATLA"
        LET p_invloca[2].locname = "Atlanta Location"

        LET i = 2
        RETURN i
END FUNCTION
#
FUNCTION cjmshoinvloc()
#
#-------Local Variables
#
        DEFINE
        i               SMALLINT        # Counter

        LET int_flag = FALSE
        DISPLAY ARRAY p_invloca TO s_invloc.*
                ATTRIBUTE (COUNT=ninvloc,UNBUFFERED)
        BEFORE DISPLAY
                CALL dialog.setActionActive("accept",0)
#
#
#-------Quantities
#
        ON ACTION function4
                LET i = arr_curr()
                IF i != 0 THEN
                        CALL invqty(i)
                END IF
#
#-------Exit
#
        ON ACTION cancel
                LET int_flag = FALSE
                EXIT DISPLAY
#
#-------Close Application
#
        ON ACTION close
                LET int_flag = FALSE
                EXIT DISPLAY
        END DISPLAY

        IF int_flag THEN
                LET int_flag = FALSE
        END IF

END FUNCTION
#
FUNCTION invqty(detline)

        DEFINE
#
#-------Miscellaneous Variables
#
        i               SMALLINT,               # Counter
        detline         INTEGER,                # Detail Line
        p_invqty        ARRAY[11] OF RECORD
                        fldlab  CHAR(30),       # Field Label
                        qty     DECIMAL(16,4)   # Quantity
                        END RECORD

        OPEN WINDOW invqty_form WITH FORM "invqty-i"
                ATTRIBUTE (TEXT="Quantities")
#
#-------Assign field labels
#
        LET p_invqty[1].fldlab = "Quantity on Hand"
        LET p_invqty[2].fldlab = "Quantity on Sales Order"
        LET p_invqty[3].fldlab = "Quantity on Sales Order Hold"
        LET p_invqty[4].fldlab = "Quantity to be Picked"
        LET p_invqty[5].fldlab = "Quantity to be Transferred Out"
        LET p_invqty[6].fldlab = "Quantity Allocated"
        LET p_invqty[7].fldlab = "Quantity on Purchase Order"
        LET p_invqty[8].fldlab = "Quantity on Work Order"
        LET p_invqty[9].fldlab = "Quantity In Transit"
        LET p_invqty[10].fldlab = "Quantity Rejected             "
        LET p_invqty[11].fldlab = "Quantity Available"
#
#-------Assign quantities
#
        LET p_invqty[1].qty = 0
        LET p_invqty[2].qty = 0
        LET p_invqty[3].qty = 0
        LET p_invqty[4].qty = 0
        LET p_invqty[5].qty = 0
        LET p_invqty[6].qty = 0
        LET p_invqty[7].qty = 0
        LET p_invqty[8].qty = 0
        LET p_invqty[9].qty = 0
        LET p_invqty[10].qty = 0
        LET p_invqty[11].qty = 0
#
#-------Display array
#
        LET int_flag = FALSE
        DISPLAY ARRAY p_invqty TO s_invqty.*
                ATTRIBUTE (COUNT=11,UNBUFFERED)
#
#-------Quantity Inquiry information
#
        ON ACTION subfunction1
                LET i = arr_curr()
                display "i ",i
                display "arr_count ",arr_count()
                message "i is ",i
        END DISPLAY

        IF int_flag THEN
                LET int_flag = FALSE
        END IF

        CLOSE WINDOW invqty_form

END FUNCTION
 

Form:  cjminvinq.per
Code (per) Select
SCHEMA formonly
LAYOUT (TEXT="Item")
VBOX
FOLDER
PAGE page2 (TEXT="Facilities",ACTION=page2)
VBOX
TABLE
{
Facility  Facility Name
[a2      -|b2                                                ]
[a2      -|b2                                                ]
[a2      -|b2                                                ]
[a2      -|b2                                                ]
[a2      -|b2                                                ]
[a2      -|b2                                                ]
}
END
GROUP group7
GRID
{
[button21   ]
}
END
END
END -- end vbox
END -- end page
END -- end folder
GROUP group14
GRID
{
[button38] [button39]
}
END
END
END
ATTRIBUTES

EDIT a2 = formonly.loccd TYPE CHAR,
        COMMENTS = "Enter item facility.";
EDIT b2 = formonly.locname TYPE CHAR,
        NOENTRY;

BUTTON button21:function4, TEXT="Quantities", IMAGE="";
BUTTON button38:accept, TEXT="OK", IMAGE="";
BUTTON button39:cancel, TEXT="Cancel", IMAGE="";
END
INSTRUCTIONS
        SCREEN RECORD s_invloc[6] (formonly.loccd,formonly.locname);
END


Form:  invqty-i.per
Code (per) Select

SCHEMA formonly
LAYOUT
VBOX
SCROLLGRID
{
[f002                          ][f003          ]
[f002                          ][f003          ]
[f002                          ][f003          ]
[f002                          ][f003          ]
[f002                          ][f003          ]
[f002                          ][f003          ]
[f002                          ][f003          ]
[f002                          ][f003          ]
[f002                          ][f003          ]
[f002                          ][f003          ]
[f002                          ][f003          ]
}
END
GROUP group1
GRID
{
[button1 ][button2       ]
}
END
END
END
END
ATTRIBUTES
LABEL f002 = formonly.fldlab;
EDIT f003 = formonly.qty TYPE DECIMAL,
        FORMAT="-------------&",
        NOENTRY;
BUTTON button1:cancel, TEXT="Cancel", IMAGE="";
BUTTON button2:subfunction1, TEXT="Detail", IMAGE="";
END
INSTRUCTIONS
        SCREEN RECORD s_invqty[11] (formonly.fldlab,formonly.qty)
END


I also submitted the issue to 4js USA support.

Thanks,
Candy
Title: Re: arr_curr() returns a value of one on form with SCROLLGRID
Post by: Bernard MULLER on January 18, 2018, 11:57:33 AM
Hi Candy,

We registered GDC-3853 (Click on form button changes current row in SCROLLGRID) for this problem.
A workaround is to use a TABLE instead of a SCROLLGRID in invqty-i.per.
Sorry for the inconvenience and thanks for reporting.

Regards,
Bernard
Title: Re: arr_curr() returns a value of one on form with SCROLLGRID
Post by: Bernard MULLER on January 18, 2018, 01:16:35 PM
Candy,

The bug will be fixed for next MR due for the end of the month.

Regards,
Bernard
Title: Re: arr_curr() returns a value of one on form with SCROLLGRID
Post by: Candy McCall on January 18, 2018, 03:01:56 PM
Bernard,
     That's great!  Thanks so much!
Candy
Title: Re: arr_curr() returns a value of one on form with SCROLLGRID
Post by: Candy McCall on January 19, 2018, 08:11:23 PM
FYI.   This appears to fail in GDC over http as well (I had tested over GDC over ssh).
Candy