Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Intellisense on arrays?
Message
De
27/02/2005 13:37:35
 
 
À
27/02/2005 13:31:08
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP1
Divers
Thread ID:
00990972
Message ID:
00991015
Vues:
16
Hi Tore --

Thanks for the lengthy reply. Frankly, I'm amazed when anybody has time to dig too much through anybody else's problem; I'm particularly pleased you've been as responsive as you have been.

My problem has a different flavor than yours -- you are able to keep re-defining your temp cursor as you "drill down" to greater detail. In my case, however, I must retain each temp cursor at each level until processing of all sub-levels is complete, so I can't keep using the same cursor name each time.

Jim

>Hi James,
>
>I'm sorry that I don't have the time to dig too much into your problem, but I note that you write about creating a recursive function. I use recursive SELECTS a lot, it's a really cool feature. I will illustrate by showing a part of a function I use to search for articles in my warehouse according to input like 'plug 3.5mm stereo' or 'fuse 6.3x32mm 6.3A slow'. I have two tables, stocklist.dbf with a list of all articles, and a second table, wordlist.dbf, which has two fields, partid and word. The wordlist table has one record for each word in the description field in stocklist.dbf, and also records for the part name itself and a few more things, the idea is that my customers can find matching parts by typing the name of the articles, or simply enter matching words from the description field. Here is a part of the function I use
>lcText = Getwordnum(lcIndata, 1)
>Select Dist Master.Id, slave.word From wordlist As Master, wordlist As slave Where slave.word = lcText And Master.Id = slave.Id Into Cursor curTemp Readwrite
>If Getwordcount(lcIndata) > 1
>  For lnCounter = 2 To Getwordcount(lcIndata)
>    lcText = Getwordnum(lcIndata, lnCounter)
>    Select Dist Master.Id, slave.word From curTemp As Master, wordlist As slave Where slave.word = lcText And Master.Id = slave.Id Into Cursor curTemp Readwrite
>  Endfor
>Endif
>Note that my second SELECT selects from a cursor into the same cursor. The key to make this work, is the readwrite clause.
>
>>First of all, thanks for answering my original question. (Somehow, I had some recollection of being able to do so ...)
>>
>>As for SELECTing into a cursor instead, I'm not sure how to do that within the recursive routine I need to create.
>>
>>I have a table with these fields: AssemblyPart / ComponentPart / Quantity. For any part that is assembled, there are one or more records in this table, one for each component. Component parts may themselves be assembled; in fact, a few top-level parts have four levels until they get to purchased (rather than assembled) materials.
>>
>>I also have another table with a list of all parts, whether assembled or purchased, with the amount of inventory on hand.
>>
>>So, I need to write a program which I can call with two arguments: an assembled part and a quantity that is desired to be assembled. It is to return the quantity that can be assembled, based on the inventory on hand of its components.
>>
>>My approach to this problem would be to write a routine which first selects appropriate records from the assembly table for the part to be assembled. For any items where there is not inventory on hand, and which are assembled themselves, I would have the routine call itself.
>>
>>So, how do I handle this recursive routine which is SELECTing into cursor along the way? (or is this just a problem of naming the cursors separately at each level?)
>>
>>Thanks,
>>
>>Jim
>>
>>
>>
>>
>>>When you SELECT into an array the field names are not carried over to the array. Why not SELECT into a cursor instead?
>>>
>>>>When I do the following:
>>>>
Select * FROM SomeTable INTO ARRAY laARRAY WHERE bla-bla-bla
>>>>Is there some way to refer to the columns in the array based on the names of the fields in the table? Or, must I simply know the order of the columns in the table, and use an appropriate index number?
>>>>
>>>>Thanks,
>>>>
>>>>Jim
Jim Nelson
Newbury Park, CA
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform