Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
List Box - Not showing old values no longer in the list
Message
From
14/04/2000 17:42:58
 
 
To
14/04/2000 17:15:11
Jill Derickson
Software Specialties
Saipan, CNMI
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00359714
Message ID:
00359905
Views:
8
Jill,

Where is CNMI? :-)

...anyway


>I usually see on the UT that most people use ADDITEM to add values to lists...I've found using a cursor/view to be simpler, but maybe I'm missing some subtlety? (I use row source type ALIAS)
>

You right it sometimes may be easy using the value porperties...


>Then I can just fill my view/cusor w/the values I want the user to see.
>
>So I create my cursor/view appropriately....

>
when adding a record, the user just sees new values, they are all that are in the list. When modifying an old record, the user sees all active judges plus the single inactive for that record....
>

That's what I try to accomplish building these cursors, just that I don't have the "flag" field available that's why I have to write some extra lines.

You see, I end up also with a cursor to populate the combo. And, I agreed having a flag of some sort to define "active" and "inactive" items it's a very good idea



>>Tim,
>>
>>I have the same problem with combo lists here is my solution...
>>(Is from one of my forms, so forgive me because I didn't change the alias names and also because I over comented, just to make it either clear or not so clear...). The list of available items is controled by another table called "schduler"
>>
>>
>>*!* Set the control source for this combo
>>THISFORM.pageframe1.page2.combo5.CONTROLSOURCE = 'dtable.attn'
>>
>>*!* Clear the content of the combo
>>THIS.combo5.clear()
>>
>>*!* The currently available items are in this table
>>SELECT SCHDULER
>>
>>AFIELDS(aSchedulers)
>>
>>*!* Create a cursor to hold items for the combo list
>>CREATE CURSOR _TEMP FROM ARRAY aSchedulers
>>
>>*!* Select the available items
>>SELECT sname;
>>FROM SCHDULER;
>>GROUP BY sname;
>>INTO CURSOR _TEMP1
>>
>>*!* Select from the source table the items that may not be available anymore
>>SELECT dtable.attn;
>>FROM dtable;
>>WHERE ALLTRIM(dtable.attn) NOT IN(SELECT _TEMP1.sname FROM _TEMP1);
>>GROUP BY dtable.attn;
>>INTO CURSOR _TEMP2
>>
>>*!* Filling the main cursor, first, with the available items
>>SELECT _TEMP1
>>
>>SCAN
>> INSERT INTO _TEMP (sname);
>> VALUES (_TEMP1.sname)
>>ENDSCAN
>>
>>*!* Select the other items that may not be available anymore
>>*!* and add only if it is the actual value for the current record
>>
>>SELECT _TEMP2
>>
>>IF RECCOUNT() > 0
>>
>> SCAN
>>
>> IF ALLTRIM(dTable.attn) = ALLTRIM(_TEMP2.attn)
>> INSERT INTO _TEMP(sname) ;
>> VALUES (_TEMP2.attn)
>> ENDIF
>> ENDSCAN
>>ENDIF
>>
>>*!* Add the items to the combo list
>>SELECT _TEMP
>>SCAN
>> THIS.combo5.ADDITEM(ALLTRIM(_TEMP.sname))
>>ENDSCAN
>>
>>
>>*!* Get rid of the temp cursors
>>
>>SELECT _TEMP
>>USE
>>
>>SELECT _TEMP1
>>USE
>>
>>SELECT _TEMP2
>>USE
>>
>>This combo is part of a pageframe, so I put it on the Activate method of the page where there in. To navigate they have to switch pages so this method is
>>fired every time the user chages from record to record
>>
>>If you have a better solution, please let me know because, is also a problem that I have now.
>>
>>Cheers!
An Intelligent fool can make things bigger and more complex... It takes a touch of a genius -and a lot of courage- to move in the opposite direction".
-Albert Einstein
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform