Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Ordering columns on form with pages with one grid for each
Message
From
22/11/2017 17:56:05
Luis Santos
Biglevel-Soluções Informáticas, Lda
Portugal
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Ordering columns on form with pages with one grid for each
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 10
Network:
Windows Server 2012
Database:
MS SQL Server
Application:
Desktop
Miscellaneous
Thread ID:
01655772
Message ID:
01655772
Views:
76
Hello Comunity

I build a Form with 3 pages, each page has a grid that runs a sql query to provide data in the grid.
I have at the moment a problem with a routine that allows to order the columns of ascending and descending form, however it only works in the first page and grid of the Form.

this is the code
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


	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)
I would like to know how I can make sorting work on each page and grids, because I think that using the index number causes it to stop working on other pages and grids.
is it possible instead of the index number to use another technique so that the ordering works on each page and grid.

Many thanks,
Luis Santos
Next
Reply
Map
View

Click here to load this message in the networking platform