How to clear Selected Row within Row Exit???

DBohner-(db)

Legendary Poster
I have the following process - where I am trying to write a record to a workfile for every row selected on a grid. I’ve noted internally – what I’m expecting and what I’m getting:

EVENT: Button Clicked
----------------------------------------------------------------------
0001 VA frm_CurrentlySelectedRow = "0"
0002 VA frm_SelectedRowCounter = "0"
0003 VA frm_UserId_USER = GC UserID
0004 Get Current Date and Time
VA frm_DateTime_VL01 <- szDateTime
0005 Get Selected Grid Row Count(FC Grid, VA frm_TotalSelectedRowsOnGrid)


I am getting the number of selected rows – in the variable, this is working correctly

0006 While VA frm_SelectedRowCounter is less than or equal to VA frm_TotalSelectedRowsOnGrid
0007 Get Selected Grid Row Number(FC Grid, VA frm_CurrentlySelectedRow)

The variable does contain the correct row number for the first ‘selected’ row, this is working correctly

0008 Get Grid Row(FC Grid, VA frm_CurrentlySelectedRow)

I do get the correct GC Values – for the first selected row, This is working correctly

0009 Fworkfile.Insert
GC Batch Number -> TK Batch Number
VA frm_UserId_USER -> TK User ID
VA frm_DateTime_VL01 -> TK Selection Values 01

During the first loop – the correct data is written to the table. On all other loops, the File IO is in error (as expected, see following comment at bottom)

0011 Clear Selection(FC Grid)

No error messages following statement. My understanding is that this statement is supposed to clear the ‘selection’ on the currently selected (‘Get Grid Row’) row? My goal is to find a way to UNSELECT a specific row, based on its row number (OK, how the heck do I do it?). How do I clear the selection of a row, from within a row-exit button? The side question is that this is clearing the 'selection statement (SQL) instead of the 'Selected' flag???'

0012 VA frm_SelectedRowCounter = [VA frm_SelectedRowCounter]+1
0013 End While

The first time through the logic – the first ‘user selected’ row is selected and the correct data is written to the work file. On the second loop – the same record is selected (the ‘Clear Selection’ does not seem to work) – since the insert is attempting to write the same record, it fails.

My issue – how do I clear the selection of a specific row in a grid – from inside a Row Exit button??

Suggestions are greatly welcomed!

XE - AS/400

(db)

------------------------------------------
Daniel Bohner
ExistingLight, LLC
http://www.existinglight.net
[email protected]
[email protected]
Home Office: 208.467.3316
mobile: 208.250.1917
fax: 208.246.3425
------------------------------------------
XBOX Gamer-Tag: drbohner
MSN IM: [email protected]
Yahoo IM: [email protected]
------------------------------------------
 
Hey Daniel,

Maybe I am missing something in your intended process, but since you are doing this in a Row-exit button press, can't you just turn on 'Repeat for Grid' and do away with the while loop?

Jeremy
 
OK - I must have been sleeping during that exercise...

What's 'Repeat for Grid' and how does it work? There's at least five of us that are looking for a better solution than the one's we are using...

Please - explain, so I can stop flattening my head against the door.

(db)
 
When in ER for your row-exit, there is a selection in the 'Options' menu for 'Repeat for Grid'. When checked, it will do the ER for the current event for each selected row in the grid. No need to loop.
 
JMR - that was the best coin of gold anyone has provided me in a very long time! It reduced a dozen lines of code to a single insert!

I can't tell you how appreciative I am for the new knowledge.

(db)
 
Back
Top