Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Grid content diont oprder correctly
Message
From
15/03/2024 09:16:19
Lutz Scheffler (Online)
Lutz Scheffler Software Ingenieurbüro
Dresden, Germany
 
 
To
15/03/2024 09:09:03
Luis Santos
Biglevel-Soluções Informáticas, Lda
Portugal
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01687690
Message ID:
01687732
Views:
20
>Luis

If you like it as a general proc: (I'm procrastinating)
?Set_Order(cTag, cAlias)

PROCEDURE Set_Order
*call like Set_Order(cTag[, cAlias])
	LPARAMETERS;
		tcTag,;
		tcAlias

	LOCAL;
		lnOldSelect,;
		llReturn

	lnOldSelect = SELECT()

	IF EMPTY(m.tcAlias)
		tcAlias = ALIAS()
	ELSE
		Select (m.tcAlias)
	ENDIF

	IF !EMPTY(TAGNO(m.tcTag,CDX(1,m.tcAlias)))
*only if tag exists
		If Sys(22,SELECT(m.tcAlias)) == UPPER(m.lcTag)  && current index tag
			If Descending(TAGNO(m.tcTag,CDX(1,m.tcAlias)),m.tcAlias)
				Set Order To (m.tcTag) In (m.tcAlias) Ascending
			Else
				Set Order To (m.tcTag) In (m.tcAlias) Descending
			Endif
		Else
			Set Order To (m.tcTag) In (m.tcAlias)
		Endif
		llReturn = .T.
	Endif

	SELECT (m.lnOldSelect)

	RETURN m.llReturn
endproc
Words are given to man to enable him to conceal his true feelings.
Charles Maurice de Talleyrand-Périgord

Weeks of programming can save you hours of planning.

Off

There is no place like [::1]
Previous
Reply
Map
View

Click here to load this message in the networking platform