>If U_SQLEXEC( TXTSQL, "myBoList" ) Then > Select myBoList > > Index On myBoList.exame Tag i_ex > Index On myBoList.utente Tag i_ut > Index On myBoList.entidade Tag i_ent > Index On myBoList.convencao Tag i_conv > Index On myBoList.tipoexame Tag i_tex You should avoid putting aliases in index tag expressions. You can experience problems if you open the table with a different alias. Why not make an array property on the grid and fill it with the tag names? Each array element corresponds to the column number. Then you can reduce all of these to a single procedure. > > > Go Top In myBoList > >Endif > >*!* After that i define each procedure for theses columns > Procedure OrdenarExame > > Select myBoList > If Val(Sys(21))<>1 && current index number > Set Order To 1 In myBoList > Else > If Descending(1,"myBoList") > > Set Order To 1 In myBoList Ascending > Else > Set Order To 1 In myBoList Descending > > Endif > Endif > > Go Top In myBoList > PDU_FCTEXM.pageframe1.page1.Obj1.Refresh() > Endproc > > Procedure OrdenarUtente > > Select myBoList > If Val(Sys(21))<>2 && current index number > Set Order To 2 In myBoList > Else > If Descending(2,"myBoList") > > Set Order To 2 In myBoList Ascending > Else > Set Order To 2 In myBoList Descending > > Endif > Endif > > Go Top In myBoList > PDU_FCTEXM.pageframe1.page1.Obj1.Refresh() > Endproc > > Procedure OrdenarEntidade > > Select myBoList > If Val(Sys(21))<>3 && current index number > Set Order To 3 In myBoList > Else > If Descending(3,"myBoList") > > Set Order To 3 In myBoList Ascending > Else > Set Order To 3 In myBoList Descending > > Endif > Endif > > Go Top In myBoList > PDU_FCTEXM.pageframe1.page1.Obj1.Refresh() > Endproc > > Procedure OrdenarConvencao > > Select myBoList > If Val(Sys(21))<>4 && current index number > Set Order To 4 In myBoList > Else > If Descending(4,"myBoList") > > Set Order To 4 In myBoList Ascending > Else > Set Order To 4 In myBoList Descending > > Endif > Endif > > Go Top In myBoList > PDU_FCTEXM.pageframe1.page1.Obj1.Refresh() > > Endproc > > Procedure OrdenarTipoExame > > Select myBoList > If Val(Sys(21))<>5 && current index number > Set Order To 5 In myBoList > Else > If Descending(5,"myBoList") > > Set Order To 5 In myBoList Ascending > Else > Set Order To 5 In myBoList Descending > > Endif > Endif > > Go Top In myBoList > PDU_FCTEXM.pageframe1.page1.Obj1.Refresh() > > Endproc > >*!* Finally i build my bindevents > >*!* Run procedure to make bindevents >Do sp_eventOBJ > > >Procedure sp_eventOBJ > > > Bindevent(PDU_FCTEXM.pageframe1.page1.Obj1.column3.header1,"click",m_monitor_MAPAUTENTE,"OrdenarExame",1) > Bindevent(PDU_FCTEXM.pageframe1.page1.Obj1.column4.header1,"click",m_monitor_MAPAUTENTE,"OrdenarUtente",1) > Bindevent(PDU_FCTEXM.pageframe1.page1.Obj1.column6.header1,"click",m_monitor_MAPAUTENTE,"OrdenarEntidade",1) > Bindevent(PDU_FCTEXM.pageframe1.page1.Obj1.column7.header1,"click",m_monitor_MAPAUTENTE,"OrdenarConvencao",1) > Bindevent(PDU_FCTEXM.pageframe1.page1.Obj1.column8.header1,"click",m_monitor_MAPAUTENTE,"OrdenarTipoExame",1) > >Endproc > >On the secund page and grid, the object name change, ex: >Bindevent(PDU_FCTEXM.Pageframe1.Udcpage1.Obj1.column3.header1,"click",m_monitor_MAPAUTENTE,"OrdenarExame",1) >>