Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Vfp50 - I want to SORT
Message
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00025541
Message ID:
00025839
Views:
25
>>>>>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...
>>>I loaded a COMBO BOX with the RowSource as an array, but, at load time, it
>>>can not find the array source. Where do you put your code for the array?
>>>
>>>Rob
>>I made the array a property of the form, then filled the array in the FORM.Init, then did a THISFORM.Combo.Requery. That may not be the best way, but it worked.
>
>I tried that and it did not work.
>I did a:
>a) new property called TESTARRAY
>b) code in INIT EVENT of the FORM
> declare TESTARRAY[3]
> STORE "ONE" TO testarray[1]
> STORE "TWO" TO testarray[2]
> STORE "THREE" TO testarray[3]
>C) THISFORM.combo1.REQUERY
>
>HELP..
If your new property specifically said TESTARRAY(3) or TESTARRAY(3,0), I think you would not need to DECLARE it in the INIT. I'm not sure what went wrong with your code, however, to be more specific, here is my code:
iTgCount = TAGCOUNT()
IF iTgCount > 0
DIMENSION aHoldList (iTgCount)
iFinalSize=GetTags(@aHoldList,iTgCount,THISFORM.cTagExclude)
DIMENSION aHoldList(iFinalSize)
DIMENSION THISFORM.aTagsToUse(iFinalSize)
=ACOPY(aHoldList,THISFORM.aTagsToUse)
ENDIF
THISFORM.ComboSort.Requery
THISFORM.ComboSort.Value = THISFORM.aTagsToUse(2)
GetTags is a UDF which loops through TAG(i) FOR i = 1 TO iTgCount, checks each tag to see if it is in cTagExclude (a string of fieldnames that would make dumb tags) and fills aHoldList with the useful ones. I use it in a few places. The last line picks a default tag.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform