Page 1 of 2
Multiple Grid Row Selections
Posted: Tue Dec 31, 2013 3:23 pm
by DaveLClarkI
I'm finding that I don't have a good way of knowing which grid rows are actually selected when the page gets submitted back to my RPG code. Currently, I'm using whatever rows are returned as "changed" as the rows that are selected. However, the user can select and deselect any number of grid rows before finally deciding to submit the page and I'm finding that Profound is returning all of those rows as "changed" even though they are not all selected at page submit time. Even with multi-select turned off, the user can select row 1, then row 2, then row 3, and submit the page and my RPG code thinks that all three rows (1, 2, and 3) are selected (changed).
So, how can I tell which rows are actually selected by the time processing gets back to my RPG code?
Re: Multiple Grid Row Selections
Posted: Tue Dec 31, 2013 3:43 pm
by Scott Klement
Bind a variable to the 'selection field' property, and use 'selection value' to indicate the value that gets placed in this field. This field will be an additional field in your subfile record. When you use READC to read the subfile, you can check the variable that's bound to 'selection field' to see if the user left it selected or unselected...
Re: Multiple Grid Row Selections
Posted: Tue Dec 31, 2013 5:51 pm
by DaveLClarkI
Thanks, I'll check it out when I get back to work on Thursday (after New Year's).
Re: Multiple Grid Row Selections
Posted: Thu Jan 02, 2014 1:44 pm
by DaveLClarkI
Scott Klement wrote:Bind a variable to the 'selection field' property, and use 'selection value' to indicate the value that gets placed in this field.
I've had a chance to test this, now, and I already had *IN30 bound to "selection field" and that is working when the subfile (grid) is built to preselect a row based on a lookup parameter being passed into my program. However, *IN30 is not being returned when the READC op code is being executed.
Now, since *IN30 is defined as an indicator, do I still have to specify something in the "selection value" in order to get the "selection field" to be returned to my RPG code? If that is the case, do I code '1' as that value?
Re: Multiple Grid Row Selections
Posted: Thu Jan 02, 2014 1:50 pm
by Scott Klement
Yes, I don't think it'll set the selection field at all if you don't also define a selection value. Yes, 1 is the correct value to turn an indicator on.
Re: Multiple Grid Row Selections
Posted: Thu Jan 02, 2014 1:56 pm
by DaveLClarkI
OK, I tried that and it is still only working as a conditioning indicator and not as a result indicator. I also tried both 1 and '1' and found that specifying '1' caused *IN30 to stop working as a conditioning indicator as well. So, I changed it back to 1 and it now continues to work as a conditioning indicator but still not as a result indicator.
So, might it be that indicators are not going to work for returning the current selected rows back to my RPG code?
Re: Multiple Grid Row Selections
Posted: Thu Jan 02, 2014 2:00 pm
by Scott Klement
You don't want quotes, it'll try to actually put those quotes into the indicator variable if you do that.
I don't know why the indicator wouldn't work, otherwise... I don't know if I've ever coded an *INxx indicator for this, but I would've thought it would work? I guess I could code up a sample program to try it out.
You mention that *IN30 is also being used as a conditioning indicator. What is it conditioning?
Re: Multiple Grid Row Selections
Posted: Thu Jan 02, 2014 2:25 pm
by DaveLClarkI
Scott Klement wrote:You mention that *IN30 is also being used as a conditioning indicator. What is it conditioning?
It conditions whether a row is preselected when the grid is built. As stated in the Profound documentation, the "selection field" property serves a dual purpose. It is used to both set (conditioning indicator) and return (result indicator) the selected state on each record.
Re: Multiple Grid Row Selections
Posted: Thu Jan 02, 2014 2:28 pm
by Scott Klement
Oh, I see.. thought you were using it to condition something else besides the row selection.
We did a quick test here, and *IN30 worked both with selection value set to 1, and with the selection value unset. Not sure why it's not working for you? Can you tell me how to reproduce the problem?
Re: Multiple Grid Row Selections
Posted: Thu Jan 02, 2014 2:51 pm
by DaveLClarkI
I have a context menu defined for the grid. I left-click on row 1, then on row 2, and then on row 3. Then, I right-click row 3 and select "Change" from the context menu. The page submits to my RPG program and READC returns all three rows with *IN30 set *off for all three rows.