Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Question on Ordering
Message
 
 
À
15/12/1997 14:30:50
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00065996
Message ID:
00066024
Vues:
34
>>>I have a reference table which is a list of names. I need to create a combo box which use this table as a reference. However, there is a special requirement in the order of the list showing in the combo box. 3 of the names should always be shown on the top of the list while the others should be shown according to the alphabetical order. Since the table will be updated once in a while, placing the record order permanently is not viable. Can anyone help me in this issue? Thanks.
>>>
>>>Chu
>>
>>Add another field to your reference table. Put something like '1', '2' or '3' in the new field for those records that have to be listed first. For all other records, put the actual data of the sort field in this new field. Create an index tag on the new field and use this order. Make sure in any "AddItem" routine you also populate this field.
>
>How about if I have new record? By doing so, I will need to recreate the order again, won't I?
>
>Chu

Not as long as you "Replace NewField with DataDescriptionField" in any record that is added. You will also need to do this for any record that is updated unless of course the NewField is equal to '1', '2' or '3'. Reference Table:
<bold>KeyID  Descript        SortField</bold>
  1    Allen, Terry    Allen, Terry
  2    Zeuss, Jack     1
  3    Smith, Joe      Smith, Joe
  4    Able, Ben       2
  5    Jackson, Steve  3
INDEX ON SORTFIELD TAG SORTFIELD
When you SET ORDER TO SORTFIELD, the records will be listed 2, 4, 5, 1, 3 (using the KeyID as a reference). Whenever you add a new record, REPLACE SORTFIELD WITH DESCRIPT. You would do the same thing if a DESCRIPT is changed unless SORTFIELD = '1', '2' or '3'. The index will automatically be updated.
Mark McCasland
Midlothian, TX USA
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform