Repeat For Grid option issues

Bob B

Guest
Questions similiar to this have been asked before, but as I browse them I can't really find out what I need to:

I want to use a row exit to process multiple selected rows from the grid. Multiple Select property is checked for the grid. I need to edit all sorts of things for the selected row(s) and ONLY WHEN ALL HAVE PASSED, process them as a set.

I would like to perform the editing in the Button Clicked event of the exit (Repeat For Grid option is ON), and then perform the actual processing in the Post Button Clicked event (Repeat For Grid also ON).

I find that the 'repeat' feature works fine in the first event, but by the time the second event begins to process, all row selections except for the very last selection have been de-selected. This results in only the last-selected row of the grid being processed by the Post Button Clicked logic.

It seems like the Button Clicked event removes the row selection as it 'repeats' thru the initially-selected rows. Is this how it's supposed to work? Can I prevent this?

If this is an inherent 'feature' of the FDA, are there any suggestions how I could accomplish this is a straightforward, simple manner?
 
Not sure why you want to perform actual processing in Post event as both are discreate events. it been long since i have worked on grid but there are many apps which does processing on grid to get some idea. Are you working on grid buffer?. You will have to work on buffer and then refresh grid once you are done.

Chan
 
Hi Bob,

The events are working as designed. The intended process is to do button clicked for each selected row and then the post button clicked after all have been processed. This is one of those "natural" do loops in the design aid. So you should use the button is clicked for all the validation using GC variables (probably as you are already doing it), and perhaps using a form variable to store whether EVERYTHING has validated so far, and then if everything validates, then process the grids in the Post Button is Clicked. Hold on, I know you thinking already "but that's my problem, I don't know which grid records to process after they've been deselected!". Thus one of the reasons that variables can have a grid scope on them!

While you are in the Button is Clicked event, set a grid variable flag to a 'selected' value and then in the Post Button Is Clicked event (and if all records have validated) then you will need to process through the grid (looking for only those records with the 'selected' value and processing those. You will need to bring the grid records from GB to GCs so you can process them. I will look for my code to do this and repost if I find it.

Caveat Emptor - since you are setting grid variables, you might have to consider if you set them and one or more records doesn't validate that you unselect the grid records if you process a second time. You don't want to process multiple times or process records in the second go-around that you selected in the first go-around and not the second.

Ben again,
 
Yeah in essence, OK post button clicked is only fired when there are NO errors on a form.

Plus it will only fire once. Button clicked event will loop yes
 
Back
Top