Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Help needed with collections
Message
From
04/08/2016 14:38:18
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Help needed with collections
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 10
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01639133
Message ID:
01639133
Views:
117
Hello all,

I never used collection and I thought it would be really simple... but it doesn't look like that :-(

this should be simple but I can't get it to work the way I'd like it to work.

Here's what I want to do.

Create a collection that will contain address of forms. I want to be able to store the address of some forms in that collection so I can control which one is displayed at any given time.

Users can have many of the same form used. But they only can see one at a time. So a collection will help me control that.



here's what I did.


****************************************
****** Creation of the collection ****
****************************************
public loCollFact
loCollFact = CREATEOBJECT("collection")



************************************************
****** Add new data to the collection ******
************************************************

PARAMETERS oAddressForm, cName
lAbsent = EMPTY( loCollFact.GetKey( cName))
IF lAbsent
loCollFact.add( oAddressForm, cName)
ENDIF


********************************************************************
****** Hoping this would return the address of the form ******
********************************************************************
PARAMETERS cName
RETURN loCollFact.item( cName)


****************************************************************************
****** Here I want to build a cursor that will contain the strings ******
****** that I used in the collection. ******
****************************************************************************
CREATE CURSOR cNull (NomCli c(60))

FOR i = 1 TO loCollFact.Count
INSERT INTO cNull ;
(;
NomCli;
);
values;
(;
loCollFact.name;
)
ENDFOR

* Big problem here because I don't see the strings
* So from that point I can't show the names of the available forms


What am I doing wrong?
*******************************************************
Save a tree, eat a beaver.
Denis Chassé
Next
Reply
Map
View

Click here to load this message in the networking platform