Re: retrieve text field content by John
John
Thu Sep 23 07:50:11 CDT 2004
Hey Eddy,
You can also use ALINES to break each into its own array element. VFP6
doesn't allow you to specify what character to use to break a string, so I'm
using CHRTRAN to convert it to a CR...
cTest = "A=CUSTOMER,P=P,O=RETAIL,C=USD,N=1"
=ALINES( aVars, CHRTRAN( cTest, ",", CHR(13) ) )
FOR VarCntr = 1 TO ALEN( aVars )
IF !ISDIGIT( substr( aVars[ VarCntr ], AT("=", aVars[ VarCntr ] ) +
1 ) )
aVars[VarCntr] = STRTRAN( aVars[VarCntr], "=", "='" ) + "'"
ENDIF
&aVars[VarCntr]
ENDFOR
The above also populates a memory variable for each "parameter". Note that
it assumes all parameter values are numeric or character, but hopefully gets
the idea across.
HTH,
John
"Eddy" <Eddy@discussions.microsoft.com> wrote in message
news:43FE55E9-BD60-42BE-AF0A-7D45458FDA05@microsoft.com...
> thanks very much, Jack
> It seem doesn't help on my problem. let me explain briefly.
> In that table(sertype c(10), codeparam c(40)),
> sertype codeparam
> A A=CUSTOMER,P=P,O=RETAIL,C=USD,N=1
> B A=SUPPLIER,P=W,O=WPRICE,C=EU,N=1
> C A=*,O=RETAIL,C=*"
> and so on ....
> User would select one of the service, then
> I have to get the content of field codeparam to find
> what 'A=' is, what 'P=' is, what 'C=' is ;A,P,C,O,N could be nothing.
> for example;
> in service 'A', C=USD,USD is defined as U. S. Dollars in currency
> table.(default currency in service 'A')
> in service 'C', C=*, means no currency defined, allow user to enter
currency
> type.
>
> My problem is how to exactly get the content of each parameter
>
> I am using VFP6, SP4
> Could you give me more advice ?
>
>
> "Jack Jackson" wrote:
>
> > On Wed, 22 Sep 2004 20:09:02 -0700, "Eddy"
> > <Eddy@discussions.microsoft.com> wrote:
> >
> > >Hi,
> > >The content of a text field record some parameters of particular
service,
> > >the content could be
> > >"A=CUSTOMER,P=P,O=RETAIL,C=USD,N=1" or
> > >"A=SUPPLIER,P=W,O=WPRICE,C=EU,N=1" or
> > >"A=*,O=RETAIL,C=*"
> > >What is the simplest way to get each parameter word ?
> > >like : what is A;what is P ......
> >
> > I haven't tried this, but this should get you started:
> >
> > LOCAL nRows, nI, cParm, cValue
> > LOCAL ARRAY aRows[1]
> >
> > nRows = ALINES(aRows, somefield, .T., ',')
> > FOR nI = 1 TO nRows
> > cParm = GETWORDNUM(aRows[nI], 1, '=')
> > cValue = GETWORDNUM(aRows[nI], 2, '=')
> > ...
> > ENDFOR
> >
> >
> >