"Get Next Selected Row" System Function - Odd behaviour (?)

Flurin

Member
\"Get Next Selected Row\" System Function - Odd behaviour (?)

Hi all

I spend this morning trying to find out why the following code failed:

<font class="small">Code:</font><hr /><pre>
evt_currentRow_INT01
evt_maxRows_INT01
0001 // Initialise variables
0002 Get Next Selected Row(FC Grid, <Before First Row>, VA evt_currentRow_INT01)
0003 Get Selected Grid Row Count(FC Grid, VA evt_maxRows_INT01)
0004 //
0005 // Iterate through selected rows
0006 While VA evt_maxRows_INT01 is greater than <Zero>
0007 // Process current row
0008 Set Grid Color(FC Grid, VA evt_currentRow_INT01, <All Columns>, <Red>)
0009 //
0010 // get next row
0011 Get Next Selected Row(FC Grid, VA evt_currentRow_INT01, VA evt_currentRow_INT01)
0012 VA evt_maxRows_INT01 = VA evt_maxRows_INT01-1
0013 End While
</pre><hr />

When multiple rows were selected, only the first call to the "Get next selected row" worked, while any subsequent would return -1 as the next row number.
I have since established that this only happens when there are hidden rows in the grid. When all are shown, the code highlights the selected rows as expected.
The pertinent grid is on a subform and I work with app release E812 and tool release 8.97.

I am curious to know why the function returns -1 on a grid with hidden rows. Is this expected behaviour or a bug?

PS: I have changed my approach to avoid using this function, so I am not looking for alternate solutions.

Regards,

Flurin
 
Re: \"Get Next Selected Row\" System Function - Odd behaviour (?)

Further experimentation revealed that the behaviour is a bit more complicated than outlined above; it seems that the "symptoms" appear only when there are 8 or more hidden rows. Did anyone else encounter this?
 
Re: \"Get Next Selected Row\" System Function - Odd behaviour (?)

Hi Flurin

The reason why your code is not working here is

Get Next Selected Row(FC Grid, <font color="red"> VA evt_currentRow_INT01 </font> , VA evt_currentRow_INT01)

please see the variable shown in red above.

you have to increment this varibale with 1 in order to get the next selected line.(please take some other variable of same data type and increment this with one ) before you call
the

Get Next Selected Row(FC Grid," the new varibale ", VA evt_currentRow_INT01)

than it will work.

Regards
Jitender
 
Re: \"Get Next Selected Row\" System Function - Odd behaviour (?)

Hi Flurin,

I am facing the same issue as jitender.
I applied your advice but I still have the same issue.

Here is my code, please could you tell me what's wrong, or post a correct sample code.

0001 Get Selected Grid Row Count(FC Grid, VA frm_maxRow)
0002 Get Selected Grid Row Number(FC Grid, VA evt_mnCurrentRow)
0003 While VA frm_maxRow is greater than <Zero>
0004 Get Grid Row(FC Grid, VA evt_mnCurrentRow)
0005 Set Grid Color(FC Grid, VA evt_mnCurrentRow, <All Columns>, <Aqua>)
0006 VA evt_mnNextRow = VA evt_mnCurrentRow+1
0007 Get Next Selected Row(FC Grid, VA evt_mnNextRow, VA evt_mnCurrentRow)
0008 VA frm_maxRow = VA frm_maxRow-1
0009 End While
 
Hi everyone.

I faced the same issue. It happens to me when I collapse lines in grid using tree control. Otherwise it works fine.
Does anyone have a solution to this ?

Here is my code sample:
-------------------------------------------
Get Selected Grid Row Count(FC Parent/Child, VA evt_iMaxSelectedRows)
If VA evt_iMaxSelectedRows is greater than <Zero>
Get Selected Grid Row Number(FC Parent/Child, VA evt_iRowNumber)
While VA evt_iRowNumber is greater than <Zero>
Get Grid Row(FC Parent/Child, VA evt_iRowNumber)
...
//Line processing
...
Get Next Selected Row(FC Parent/Child, VA evt_iRowNumber, VA evt_iRowNumber)
End While
End If
---------

"Get Next Selected Row" return '-1' if there are lines hidden between selected lines.
 
Back
Top