Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Vfp50 - I want to SORT
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00025541
Message ID:
00025832
Vues:
32
>>>I am looking for a sample like step 1. in the FORM
>>>Wizard that shows you how you can select the fields
>>>you want. I would like this so my users can pick the
>>>fields they want to SORT on. After they pick the fields
>>>that want, they click OK and the program will build a INDEX from their choices using a string.
>>>example..
>>>
>>>INDEX ON string TAG yourindx
>>>
>>>Can you help?
>>I was modifying an app which had a combobox whose .RowSourceType property was 8 - structure. It didn't look like page1 of the wizard or anything, it was just a combo, but it did what you want - it gave a list of the fields. However, I promptly got rid of it. In the case of my table, there were several fields which the customer would never use for sorting. I asked the customer what fields would be used for sorting, and created a half-dozen index tags. The RowSourceType for my box is now an array. I have a function which reads TAG(i) into the array, looping from 1 to TAGCOUNT(), and excluding tags I didn't want to use. This approach worked for me because the number of index tags is not so large, so reindexing shouldn't take too long. I suppose that if I had many more fields that could be used for sorting, I could have tried using .RowSourceType = 8 - structure and then used the .RemoveItem method to remove fields (such as logical fields) which would make dumb sort fields. Then
>I
>>could have made index tags for the most commonly used ones and used INDEX ON for less commonly used ones.
>
>Hi Bret... thanks for your answer...
>I will create a MOVER LIST BOX and move users choices from one listbox
>to the other using an array as a source. But.. I am not sure
>(once the user is finished) how to make my STRING of choices.
>I will need to INDEX on a VIEW and maybe a TABLE..
>Can you help?
It'll be something like:
cTagString = ""
*loop through selections
DO CASE
CASE TYPE ("cSelection") = "C"
cTagString = cTagString + " + " + cSelection
CASE TYPE ("cSelection") = "N"
cTagString = cTagString + " + STR(" + cSelection + ")"
CASE TYPE ("cSelection") = "D"
cTagString = cTagString + " + DTOS(" + cSelection + ")"
OTHERWISE
ENDCASE
** and do something to get rid of the "+" at the beginning of cTagString
INDEX ON &cTagString

or if you just made a query instead of an index tag, you could just loop through, say cOrderString = cOrderString + "," + cSelection and then do a SELECT - SQL with an ORDER BY &cOrderString
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform