Question

I want to get the selected item text of the browse. (I also want to use multiple selection attribute) I've tried

ASSIGN c-value = BROWSE1:SCREEN-VALUE . 

But it didn't work out. I get en error like

Screen value is not a queryable attribute for BROWSE1

I find FETCH-SELECTED-ROW(n) but I couldn't find an example about it.

Thanks for your help.

Was it helpful?

Solution

Easiest would be to access the buffer(s) in the browse, not the browse itself.

If you have a browse showing the table "Customer" you can put something like this in the "VALUE-CHANGED" trigger:

DEFINE VARIABLE c-value AS CHARACTER   NO-UNDO.

IF AVAILABLE customer THEN DO:

    c-value = customer.custName.
    MESSAGE c-value
        VIEW-AS ALERT-BOX INFORMATION.

END.

For a browse with MULTIPLE-SELECTION enabled you would have to do something like this (works for a single selection browse as well - NUM-SELECTED-ROWS will never be more than one in that case):

DEFINE VARIABLE i        AS INTEGER     NO-UNDO.
DEFINE VARIABLE c-value  AS CHARACTER   NO-UNDO.

/* The browse is named brTest */
DO i = 1 TO brTest:NUM-SELECTED-ROWS:

    brTest:FETCH-SELECTED-ROW(i).
    IF AVAILABLE customer THEN
        c-value = c-value + customer.custName + "~n".
END.

MESSAGE c-value VIEW-AS ALERT-BOX.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top