Home > Archive > FoxPro database connector > June 2005 > Convert a data Table









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Convert a data Table
Dorian Chalom

2005-06-21, 8:25 pm

What is the best way to convert this data table:
Document Recip Name
Doc1 Sue Adams
Doc1 Sue Adelt
Doc1 Sue, Nancy Brigs
Doc1 Sue, Nancy Carlton
Doc2 Sue Bolts

To this Data Table:
Document Recip Name
Doc1 Sue Adams
Doc1 Sue Adelt
Doc1 Sue Brigs
Doc1 Nancy Brigs
Doc1 Sue Carlton
Doc1 Nancy Carlton
Doc2 Sue Bolts


Mark McCasland

2005-06-21, 8:25 pm

You do not say what version of VFP you use, but here is how I would do it in
VFP7 or later. I do not recall if it can be done this way in prior versions.

USE Table_Name
locate for at(',', recip) > 0
do while not eof()
scatter name loRecord
loRecord.Recip = alltrim(getwordnum(r
ecip, 2, ','))
replace recip with alltrim(getwordnum(r
ecip, 1, ','))
append blank
gather name loRecord
locate for at(',', recip) > 0
enddo

"Dorian Chalom" <DChalom@Comcast.net> wrote in message
news:ef%23cxOqdFHA.1288@tk2msftngp13.phx.gbl...
> What is the best way to convert this data table:
> Document Recip Name
> Doc1 Sue Adams
> Doc1 Sue Adelt
> Doc1 Sue, Nancy Brigs
> Doc1 Sue, Nancy Carlton
> Doc2 Sue Bolts
>
> To this Data Table:
> Document Recip Name
> Doc1 Sue Adams
> Doc1 Sue Adelt
> Doc1 Sue Brigs
> Doc1 Nancy Brigs
> Doc1 Sue Carlton
> Doc1 Nancy Carlton
> Doc2 Sue Bolts
>
>



Dorian Chalom

2005-06-21, 8:25 pm

The number of names coming from recip could be any number of names. And I
am using VFP 6.0

Thanks for your help.


"Mark McCasland" < mmccaslaATairmailDOT
net> wrote in message
news:%237V$bMsdFHA.3712@TK2MSFTNGP12.phx.gbl...
> You do not say what version of VFP you use, but here is how I would do it
> in
> VFP7 or later. I do not recall if it can be done this way in prior
> versions.
>
> USE Table_Name
> locate for at(',', recip) > 0
> do while not eof()
> scatter name loRecord
> loRecord.Recip = alltrim(getwordnum(r
ecip, 2, ','))
> replace recip with alltrim(getwordnum(r
ecip, 1, ','))
> append blank
> gather name loRecord
> locate for at(',', recip) > 0
> enddo
>
> "Dorian Chalom" <DChalom@Comcast.net> wrote in message
> news:ef%23cxOqdFHA.1288@tk2msftngp13.phx.gbl...
>
>



Olaf Doschke

2005-06-22, 1:25 pm

> The number of names coming from recip could be any number of names. And I
> am using VFP 6.0

With vfp6 you can
SET LIBRARY TO foxtools.fll

and then also have Getwordnum().

It's not hard to make that code Mark
gave you work with more than 2 Names.

Bye, Olaf.


Mark McCasland

2005-06-23, 3:24 am

Use the foxtools library like Olaf said, then use try this (test it out
first and modify as needed) --

USE Table_Name
locate for at(',', recip) > 0
do while not eof()
lnKount = GETWORDCOUNT(recip, ',')
scatter name loRecord
lcString = loRecord.Recip
replace recip with alltrim(getwordnum(l
cString, 1, ','))
FOR lnI = 2 to lnKount
loRecord.Recip = alltrim(getwordnum(l
cString, lnI, ','))
append blank
gather name loRecord
ENDFOR
locate for at(',', recip) > 0
enddo

"Dorian Chalom" <DChalom@Comcast.net> wrote in message
news:uB7hTisdFHA.2984@TK2MSFTNGP15.phx.gbl...
> The number of names coming from recip could be any number of names. And I
> am using VFP 6.0
>
> Thanks for your help.
>
>
> "Mark McCasland" < mmccaslaATairmailDOT
net> wrote in message
> news:%237V$bMsdFHA.3712@TK2MSFTNGP12.phx.gbl...
it[color=darkred]
>
>



Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com