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

TAG / TAGNO

I dislike the mixture of TAG / TAGNO, and for me the TAGNO, is outdated XBASE from the days of yore. Just do all from a TAG perspective, this is well defined.

DESCENDING

Something is wrong here, the help states
DESCENDING([CDXFileName[, nIndexNumber [, nWorkArea | cTableAlias]]])

If I try on a table like
CREATE CURSOR curTest (i1 I)
INDEX ON i1 TAG _i1
?DESCENDING(_i1,'curTest')
SET ORDER TO _I1 descending
?DESCENDING(_i1,'curTest')
it fails on the first DESCENDING

So, if it runs for your code, i_nm must be a var or a field with a number.

I would rather do ("if .. else" swapped for faster expression and TAG generalized)
Select crMonitorFacturas
lcTag = "I_NM"
If Sys(22,SELECT("crMonitorFacturas")) == m.lcTag  && current index tag
	If Descending(TAGNO(m.lcTag),"crMonitorFacturas")
		Set Order To (m.lcTag) In crMonitorFacturas Ascending
	Else
		Set Order To (m.lcTag) In crMonitorFacturas Descending
	Endif
Else
	Set Order To (m.lcTag) In crMonitorFacturas
Endif
At least this switches for me.

Now you need this as a proc with the TAG as parameter and you are done for any TAG.

Lutz

Aunt Edit says:
Added SELECT() to SYS(22), so you have all commands with the alias/workarea fitting.
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
Next
Reply
Map
View

Click here to load this message in the networking platform