Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Sorting grid on Click header
Message
From
05/04/2020 13:12:58
Luis Santos
Biglevel-Soluções Informáticas, Lda
Portugal
 
 
To
05/04/2020 12:59:44
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01673953
Message ID:
01673965
Views:
44
>>>Hello community,
>>>
>>> [...]
>>>
>>>someone could give me the reason for that error.
>>
>>Is it possible that N is sometimes greater than the number of index tags on your cursor? I tried to
>>
set order to 5
>>on a table with 3 tags and got the same error.
>>
>>Hello Dragan
>>
>> [...]
>>my Cursor have fields type char,boolean,memo and numeric, i don´t know if some of theses fields type are supported ?
>>
>
>Luís, I would say that Dragan pointed you into the right direction.
>
>Assuming that your grid holds the fields of your cursor in their natural order, you must create indexes for all of the first 11 fields, regardless of their type, otherwise the code you're using will not work at all.
>
>Hello Antonio,
>
>Thanks for your reply.
>
>My cursor have 21 fields (see attachment).
>
>
>For i=1 To PDU_FCTEXM.Pageframe1.Udcpage3.Grid1.ColumnCount && the result of PDU_FCTEXM.Pageframe1.Udcpage3.Grid1.ColumnCount must be 21
>	If Inlist(i,1,2,3,4,5,6,7,8,9,10,11)  &&choice only the column to sort asc/descending-grid can have any columnCount
>		aa="PDU_FCTEXM.Pageframe1.Udcpage3.Grid1.column"+Trans(i)+".header1"
>		Bindevent(&aa,"click",oHandler,"mygridinit",1)
>	Endif
>Endfor
>
>
>I suppose the result of : For i=1 To PDU_FCTEXM.Pageframe1.Udcpage3.Grid1.ColumnCount must be equal to 21 fields
>when you mencioned : "you must create indexes for all of the first 11 fields, regardless of their type, otherwise the code you're using will not work at all."
>But i suppose the indexes have been create for all of the fields of my cursor.
>When i click on column8, the SYS(21) return 8.
>
>do you mean that before : set order to N in mybolistex, i must declare:
> INDEX ON N TO N
> set order to N in mybolistex
>
>Sorry but i not understand, could you help me.
>

Luís, the code from Yusfi assumes that for each of the sortable columns there is a corresponding index.

For instance, if the fields in your cursor are foo C(10), bar N(8), and if these goes as control sources (explicit or implicit) for columns 1 and 2 of your grid, and you want these columns to be sortable, then you must create previously indexes for each field.
INDEX ON foo TAG foo
INDEX ON bar TAG bar
Thanks António, now things are be clear.
I will go to try searching a procedure to create dinamically index for all my cursor fields and apply this procedure to my inicial code.

Best regards,
Luis
Previous
Reply
Map
View

Click here to load this message in the networking platform