Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Collection object within a SQL - SELECT statement?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Divers
Thread ID:
01239238
Message ID:
01239394
Vues:
11
Much easier ... except that I can't do that in my situation.

Basically, we have a home-grown query generation program that allows our users to select output fields, selection criteria, etc from a list of the fields/tables in our data dictionary without having to worry about all the connections between those tables.

When the user chooses to run a query they've created a run_query function is called. At this point, the program has no idea how many fields in the output fields variable need to be manipulated. It calls a second function.

The second function decides if a field needs to be manipulated. If it does, it replaces the field name in the output fields variable with a call to a function to manipulate the field. Each field could have different parms to the manipulator so each field needs its own call to its own manipulator object.

Once the second function has updated the strings, it returns control back to the run_query function that executes the SQL statement and macros the output fields variable into the query string.

All that to say that run_query has no way of knowing how many manipulators to instantiate but anything instantiated in the second function goes out of scope. However, if the run_query function has a collection object and the second function just adds manipulators to the collection, then those manipulators can be used in the run_query function.

>>I'm trying to perform a select statement using a value from a collection and VFP doesn't seem to like what I'm doing. My code looks something like this:
>>
>>oCollection = createobject("Collection")
>>oCollection.Add(newobject("manipulator","manipulator.prg"),"1")
>>
>>...
>>
>>select table1.key, oCollection.Item(1).Convert(table2.value);
>>  from table1;
>>  join table2 on table1.key = table2.key;
>>  into cursor temp
>>
>>
>>I get an [Function argument value, type, or count is invalid.] error.
>>
>>Is there any way to do what I'm attempting?
>>
>>Thanks for your help!
>>
>>Rodd
>Isn't it easier to so this:
>
>oManipulator = newobject("manipulator","manipulator.prg")
>
>...
>
>select table1.key, oManipulator.Convert(table2.value);
>  from table1;
>  join table2 on table1.key = table2.key;
>  into cursor temp
>
>
>Don't make oManipulator variable LOCAL.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform