Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Treating a table
Message
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01045654
Message ID:
01045664
Views:
31
This message has been marked as the solution to the initial question of the thread.
>I imported a table from CSV to DBF and the result was:
>
>4499 - Mark - Austria - 04/05/2005 - Color TV
>5500 - Jhon - Brazil - 05/05/2005 - Monitor
>5500 - Jhon - Brazil - 05/05/2005 - Color TV
>5500 - Jhon - Brazil - 05/05/2005 - VCR
>5501 - Tom - USA - 06/05/2005 - Sound device
>
>I would like:
>
>4499 - Mark - Austria - 04/05/2005 - Color TV
>5500 - Jhon - Brazil - 05/05/2005 - Monitor, color TV, VCR
>5501 - Tom - USA - 06/05/2005 - Sound device
>
>Could anybody help me treating this table ?
>
>Regards
>
>Moses
select MyTempData
local lcDevices, lcName, lcCountry, lcID
store "" to lcDevices, lcName, lcCountry, lcID 

set order to FirstName
scan while !eof()
   if lcName <> FirstName
      if not empty(m.lcName) && Not the first time
         insert into RealTable values (lcID, lcName, lcCountry, ldDate, lcDevices)
      endif
      lcID = cID
      lcCountry = cCountry
      lcName = FirstName
      lcCountry = cCountry
      lcDevices = cDevices
   else  
      lcDevices = lcDevices + ", " + cDevices
   endif
endscan
That's off the top of my head, but should give you idea...
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform