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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Copy count from a field value

Status
Not open for further replies.

foxup

Programmer
Dec 14, 2010
328
CA
Hi,

I have a table (dbf file) that contains 15 fields. One field is a unique field called "ID", another field is the one called 'callpath' which is a numeric value of 1-500. What I would need is fairly simple but can't seem to be able to wrap my head around is basically a copy of that exact record (all fields in that record) for the value in callpath for each ID. So kinda of scatter/gathers of the exact record but for the value in callpath.

Let m know if I made any sense. LOL


Any ideas or help would be great please.


Thanks,
FOXUP
 
I don't understand exactly what you want. Are you saying you want callpath copies of each record? In the same table or into another table? Assuming it's into another table, something like this:

Code:
LOCAL oRec, nCount, nRec

* Assumes the destination table already exists as DestTable
SELECT YourTable
SCAN
   nCount = YourTable.callpath
   SCATTER MEMO NAME oRec
   FOR nRec = 1 to m.nCount
      INSERT INTO DestValue FROM NAME m.oRec
   ENDFOR
ENDSCAN

Now that I did that, what's the underlying goal here? What are you trying to accomplish?

Tamar
 
What do you mean with "for the value in callpath"

Tamar guessed it would be a count of how many copies of a record you want to generate. But "callpath" doesn't sound like such a count at all, even thouugh you talk of copies. What is the meaning of that field?

Bye, Olaf.
 
If you want to copy out all records with somre callpath nnumber, it's simply

[pre]Select * From thetable where callpath = x[/pre]

Bye, Olaf.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top