Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Unusual order behavior 3

Status
Not open for further replies.

Scott24x7

Programmer
Jul 12, 2001
2,819
JP
Hi All,
I have a combobox control on a form that I use to control filter conditions by listing the contents of a code table. But before I add those into the combo's source control array, I add a few other options at the start (Like reset all, and two other options based on the setting of a toggle).

The problem is, I have the code table as part of the data environment, with an order set on (so they appear in alpha order). But the requery() of the control seems to take place before that is set up.
So I tried to force the order with the following code:

Code:
DIMENSION This.SourceArray(RECCOUNT('CTSTATUS'),1)
*
This.SourceArray (1,1) = "Show All"
This.SourceArray (2,1) = "DC Related"
This.SourceArray (3,1) = "Non-DC Related"
*
SELECT CTSTATUS
SET ORDER TO COMPSTATUS   && UPPER(COMPANYSTATUS)
GO TOP
DO WHILE NOT EOF()
	This.SourceArray(RECNO(),1) = CTSTATUS.COMPANYSTATUS
	SELECT CTSTATUS
	SKIP
ENDDO

Yet much to my surprise, it still doesn't respect the order of the CTSTATUS table. The entries in the array are listed in the order of the native table without an index set on.
I'm baffled... any idea how I can get this in the order I am expecting (based on the index)?

Very oddly, another control on the same form which is used as the listbox options for setting the value at the client level works fine:

SELECT DISTINCT COMPANYACCOUNTMANAGER FROM COMPANY INTO ARRAY This.SourceArray

That control has the entries in the order of the Index.



Best Regards,
Scott
MIET, MASHRAE, CDCP, CDCS, CDCE, CTDC, CTIA, ATS

"Everything should be made as simple as possible, and no simpler."[hammer]
 
Sorry, I could have been more specific in who I address and what I said might have been too harsh no matter who's addressed, but I don't let something like that stand as making me look as if I'd not know about the most important topic of VFPs data performance. I'll not hijack this thread to prove a point, but I'll post some benchmarking I've done on while vs scan loop with different scopes and SQL.

Bye, Olaf.





Olaf Doschke Software Engineering
 
As the OP on this thread, I would say it's all been very helpful. It's always good to see the different approaches and points of view. And there is merit in all the solutions offered on this issue.
My thanks to everyone.

Best Regards,
Scott
MIET, MASHRAE, CDCP, CDCS, CDCE, CTDC, CTIA, ATS

"Everything should be made as simple as possible, and no simpler."[hammer]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top