0

Is there a way to prevent invalid row range in powerbuilder.

IF  dw_lista_campanias.GetSelectedRow(0) > 0 AND    dw_lista_campanias.object.est_camp[dw_lista_campanias.GetRow()] = 'EO020' THEN

when dw_lista_campanias.object.est_camp index is 0 an exception is throw.

Invalid row range at line 193 in ue_opcion4 event of object w_os0210_mantenimiento_campanya.

mchl0208
  • 59
  • 2
  • 10

3 Answers3

1

You could put this statement in a TRY/CATCH block, but I'd think it'd be easier just to capture GetRow() into a variable and test it for 0 (which is a fairly normal state) before using it to access data.

Good luck.

Terry
  • 6,160
  • 17
  • 16
0

I will assume there is a retrieve. E.g. ll_rowsrtn = this.retrieve().

If ll_rowsrtn > 0 then 
    //the getselectedrow script
End if

So the command will not execute unless datawindow has greater than 0 rows

Seki
  • 11,135
  • 7
  • 46
  • 70
Chris
  • 11
  • 1
0

Change your codes as below:

IF dw_lista_campanias.ROWCOUNT() > 0 THEN
IF dw_lista_campanias.GetSelectedRow(0) > 0 AND dw_lista_campanias.object.est_camp[dw_lista_campanias.GetRow()] = 'EO020' THEN
//PUT YOUR CODE HERE

END IF

END IF

Happy coding ( from pb developer :) )

Masa sih
  • 86
  • 11