I am getting a Syntax error on the following code... Anyone see whats wrong?

CLOSE ALL
SET SAFETY OFF

xFn = "REC03.XLS"
xTn = " REC03"
xTs = ""

xTs = " ("
xTs = xTs + "region c(2), hospcd c(2), filler0 c(2), acct c(11), actype
c(1), acctsubtp c(1), contind c(1),"
xTs = xTs + "filler1 c(1), rectp c(1), filler2 c(3), createdt c(6), filler3
c(4)"
xTs = xTs + ")"

CREATE TABLE + (m.xTn) + (m.xTs)

SET SAFETY ON

Thanks in advance.

Re: Query/Program Problem by Zeke

Zeke
Wed Jun 23 13:40:13 CDT 2004

This works:
CLOSE ALL
SET SAFETY OFF

xFn = "REC03.XLS"
xTn = " REC03"
xTs = ""

xTs = " ("
xTs = xTs + "region c(2), hospcd c(2), filler0 c(2), acct c(11), actype
c(1), acctsubtp c(1), contind c(1),"
xTs = xTs + "filler1 c(1), rectp c(1), filler2 c(3), createdt c(6), filler3
c(4)"
xTs = xTs + ")"

cTblDef = xTn + xTs

CREATE TABLE &cTblDef
SET SAFETY ON

/Zeke




"Keht" <NoVirus@IHateScriptKiddies.com> wrote in message
news:OoMVv6UWEHA.1488@TK2MSFTNGP09.phx.gbl...
> I am getting a Syntax error on the following code... Anyone see whats
wrong?
>
> CLOSE ALL
> SET SAFETY OFF
>
> xFn = "REC03.XLS"
> xTn = " REC03"
> xTs = ""
>
> xTs = " ("
> xTs = xTs + "region c(2), hospcd c(2), filler0 c(2), acct c(11), actype
> c(1), acctsubtp c(1), contind c(1),"
> xTs = xTs + "filler1 c(1), rectp c(1), filler2 c(3), createdt c(6),
filler3
> c(4)"
> xTs = xTs + ")"
>
> CREATE TABLE + (m.xTn) + (m.xTs)
>
> SET SAFETY ON
>
> Thanks in advance.
>
>



Re: Query/Program Problem by Keht

Keht
Wed Jun 23 13:44:17 CDT 2004

Thanks, worked great, you would think that the original way would work also
but who knows? I am prob not using somthing correctly..

"Zeke Galama" <remove_galama_remove@telia.com> wrote in message
news:OGruEGVWEHA.4024@TK2MSFTNGP09.phx.gbl...
> This works:
> CLOSE ALL
> SET SAFETY OFF
>
> xFn = "REC03.XLS"
> xTn = " REC03"
> xTs = ""
>
> xTs = " ("
> xTs = xTs + "region c(2), hospcd c(2), filler0 c(2), acct c(11), actype
> c(1), acctsubtp c(1), contind c(1),"
> xTs = xTs + "filler1 c(1), rectp c(1), filler2 c(3), createdt c(6),
filler3
> c(4)"
> xTs = xTs + ")"
>
> cTblDef = xTn + xTs
>
> CREATE TABLE &cTblDef
> SET SAFETY ON
>
> /Zeke
>
>
>
>
> "Keht" <NoVirus@IHateScriptKiddies.com> wrote in message
> news:OoMVv6UWEHA.1488@TK2MSFTNGP09.phx.gbl...
> > I am getting a Syntax error on the following code... Anyone see whats
> wrong?
> >
> > CLOSE ALL
> > SET SAFETY OFF
> >
> > xFn = "REC03.XLS"
> > xTn = " REC03"
> > xTs = ""
> >
> > xTs = " ("
> > xTs = xTs + "region c(2), hospcd c(2), filler0 c(2), acct c(11), actype
> > c(1), acctsubtp c(1), contind c(1),"
> > xTs = xTs + "filler1 c(1), rectp c(1), filler2 c(3), createdt c(6),
> filler3
> > c(4)"
> > xTs = xTs + ")"
> >
> > CREATE TABLE + (m.xTn) + (m.xTs)
> >
> > SET SAFETY ON
> >
> > Thanks in advance.
> >
> >
>
>



Re: Query/Program Problem by Zeke

Zeke
Wed Jun 23 13:50:58 CDT 2004

Hi again.
The problem was that you should use macro substitution instead of ( ) when
using create table. Check this:

cDef = 'MyTable (row c(80))'
create table &cDef
*** Works

cDef = 'MyTable (row c(80))'
create table (cDef)
*** syntax error

It's clear where the problem is, but maybe someone else can tell why?

/Zeke



"Keht" <NoVirus@IHateScriptKiddies.com> wrote in message
news:%23d%23tzIVWEHA.1144@TK2MSFTNGP10.phx.gbl...
> Thanks, worked great, you would think that the original way would work
also
> but who knows? I am prob not using somthing correctly..
>
> "Zeke Galama" <remove_galama_remove@telia.com> wrote in message
> news:OGruEGVWEHA.4024@TK2MSFTNGP09.phx.gbl...
> > This works:
> > CLOSE ALL
> > SET SAFETY OFF
> >
> > xFn = "REC03.XLS"
> > xTn = " REC03"
> > xTs = ""
> >
> > xTs = " ("
> > xTs = xTs + "region c(2), hospcd c(2), filler0 c(2), acct c(11), actype
> > c(1), acctsubtp c(1), contind c(1),"
> > xTs = xTs + "filler1 c(1), rectp c(1), filler2 c(3), createdt c(6),
> filler3
> > c(4)"
> > xTs = xTs + ")"
> >
> > cTblDef = xTn + xTs
> >
> > CREATE TABLE &cTblDef
> > SET SAFETY ON
> >
> > /Zeke
> >
> >
> >
> >
> > "Keht" <NoVirus@IHateScriptKiddies.com> wrote in message
> > news:OoMVv6UWEHA.1488@TK2MSFTNGP09.phx.gbl...
> > > I am getting a Syntax error on the following code... Anyone see whats
> > wrong?
> > >
> > > CLOSE ALL
> > > SET SAFETY OFF
> > >
> > > xFn = "REC03.XLS"
> > > xTn = " REC03"
> > > xTs = ""
> > >
> > > xTs = " ("
> > > xTs = xTs + "region c(2), hospcd c(2), filler0 c(2), acct c(11),
actype
> > > c(1), acctsubtp c(1), contind c(1),"
> > > xTs = xTs + "filler1 c(1), rectp c(1), filler2 c(3), createdt c(6),
> > filler3
> > > c(4)"
> > > xTs = xTs + ")"
> > >
> > > CREATE TABLE + (m.xTn) + (m.xTs)
> > >
> > > SET SAFETY ON
> > >
> > > Thanks in advance.
> > >
> > >
> >
> >
>
>



Re: Query/Program Problem by Keht

Keht
Wed Jun 23 14:28:55 CDT 2004

do you know if i can pull the string out of a table? the string was too long
so i had to put it in a memo field, somthing like

create table rec03 + table.field

or is there someway to make the string bigger? put in mem or somthing like
that?

"Zeke Galama" <remove_galama_remove@telia.com> wrote in message
news:eDzNFMVWEHA.1380@TK2MSFTNGP12.phx.gbl...
> Hi again.
> The problem was that you should use macro substitution instead of ( ) when
> using create table. Check this:
>
> cDef = 'MyTable (row c(80))'
> create table &cDef
> *** Works
>
> cDef = 'MyTable (row c(80))'
> create table (cDef)
> *** syntax error
>
> It's clear where the problem is, but maybe someone else can tell why?
>
> /Zeke
>
>
>
> "Keht" <NoVirus@IHateScriptKiddies.com> wrote in message
> news:%23d%23tzIVWEHA.1144@TK2MSFTNGP10.phx.gbl...
> > Thanks, worked great, you would think that the original way would work
> also
> > but who knows? I am prob not using somthing correctly..
> >
> > "Zeke Galama" <remove_galama_remove@telia.com> wrote in message
> > news:OGruEGVWEHA.4024@TK2MSFTNGP09.phx.gbl...
> > > This works:
> > > CLOSE ALL
> > > SET SAFETY OFF
> > >
> > > xFn = "REC03.XLS"
> > > xTn = " REC03"
> > > xTs = ""
> > >
> > > xTs = " ("
> > > xTs = xTs + "region c(2), hospcd c(2), filler0 c(2), acct c(11),
actype
> > > c(1), acctsubtp c(1), contind c(1),"
> > > xTs = xTs + "filler1 c(1), rectp c(1), filler2 c(3), createdt c(6),
> > filler3
> > > c(4)"
> > > xTs = xTs + ")"
> > >
> > > cTblDef = xTn + xTs
> > >
> > > CREATE TABLE &cTblDef
> > > SET SAFETY ON
> > >
> > > /Zeke
> > >
> > >
> > >
> > >
> > > "Keht" <NoVirus@IHateScriptKiddies.com> wrote in message
> > > news:OoMVv6UWEHA.1488@TK2MSFTNGP09.phx.gbl...
> > > > I am getting a Syntax error on the following code... Anyone see
whats
> > > wrong?
> > > >
> > > > CLOSE ALL
> > > > SET SAFETY OFF
> > > >
> > > > xFn = "REC03.XLS"
> > > > xTn = " REC03"
> > > > xTs = ""
> > > >
> > > > xTs = " ("
> > > > xTs = xTs + "region c(2), hospcd c(2), filler0 c(2), acct c(11),
> actype
> > > > c(1), acctsubtp c(1), contind c(1),"
> > > > xTs = xTs + "filler1 c(1), rectp c(1), filler2 c(3), createdt c(6),
> > > filler3
> > > > c(4)"
> > > > xTs = xTs + ")"
> > > >
> > > > CREATE TABLE + (m.xTn) + (m.xTs)
> > > >
> > > > SET SAFETY ON
> > > >
> > > > Thanks in advance.
> > > >
> > > >
> > >
> > >
> >
> >
>
>



Re: Query/Program Problem by Gene

Gene
Wed Jun 23 18:20:57 CDT 2004

"Zeke Galama" <remove_galama_remove@telia.com> wrote:

>Hi again.
>The problem was that you should use macro substitution instead of ( ) when
>using create table. Check this:

Not quite.

>cDef = 'MyTable (row c(80))'
>create table &cDef
>*** Works
>
>cDef = 'MyTable (row c(80))'
>create table (cDef)
>*** syntax error
>
>It's clear where the problem is, but maybe someone else can tell why?

Yes. The text below is from the VFP 6 on-line help under &:

"Tip Whenever possible, use a name expression instead of macro
substitution. A name expression operates like macro substitution.
However, a name expression is limited to passing character strings as
names. Use a name expression for significantly faster processing if a
command or function accepts a name (a file name, window name, menu
name, and so on)."

Note the sentence starting with "However". Watch:

set step on
one="tmp"
two="(key c(10), data c(40))"
create table &one &two && works
create table (one) (two) && does not work
create table &one (two) && does not work
create table (one) &two && works
return

After "table", a name (of the table) is expected. That is why
"(one)" works. What follows that is not a name though. That is why
"(two)" does not work and "&two" has to be used.

[snipped previous]

Sincerely,

Gene Wirchenko

Computerese Irregular Verb Conjugation:
I have preferences.
You have biases.
He/She has prejudices.

Re: Query/Program Problem by Jack

Jack
Wed Jun 23 18:48:59 CDT 2004

On Wed, 23 Jun 2004 15:28:55 -0400, "Keht"
<NoVirus@IHateScriptKiddies.com> wrote:

>do you know if i can pull the string out of a table? the string was too long
>so i had to put it in a memo field, somthing like
>
>create table rec03 + table.field

You seem to have a fundamental misunderstanding of VFP syntax.

In an expression, '+' is an operator one of whose functions is to
concatenate strings. In the line above, + will not concatenate
because at the place the + occurs VFP is not expecting an expression.

You probably could do something like:

cStr = "create table rec03 " + table.field
&cStr.

or

cStr = table.field
create table reco3 &cStr.


Re: Query/Program Problem by Anders

Anders
Wed Jun 23 19:34:00 CDT 2004

Quoted strings longer than 254 characters have to be split and concatenated.
"long string"+"another long string"
-Anders

"Keht" <NoVirus@IHateScriptKiddies.com> wrote in message
news:uEsNwhVWEHA.3492@TK2MSFTNGP10.phx.gbl...
> do you know if i can pull the string out of a table? the string was too
long
> so i had to put it in a memo field, somthing like
>
> create table rec03 + table.field
>
> or is there someway to make the string bigger? put in mem or somthing like
> that?
>
> "Zeke Galama" <remove_galama_remove@telia.com> wrote in message
> news:eDzNFMVWEHA.1380@TK2MSFTNGP12.phx.gbl...
> > Hi again.
> > The problem was that you should use macro substitution instead of ( )
when
> > using create table. Check this:
> >
> > cDef = 'MyTable (row c(80))'
> > create table &cDef
> > *** Works
> >
> > cDef = 'MyTable (row c(80))'
> > create table (cDef)
> > *** syntax error
> >
> > It's clear where the problem is, but maybe someone else can tell why?
> >
> > /Zeke
> >
> >
> >
> > "Keht" <NoVirus@IHateScriptKiddies.com> wrote in message
> > news:%23d%23tzIVWEHA.1144@TK2MSFTNGP10.phx.gbl...
> > > Thanks, worked great, you would think that the original way would work
> > also
> > > but who knows? I am prob not using somthing correctly..
> > >
> > > "Zeke Galama" <remove_galama_remove@telia.com> wrote in message
> > > news:OGruEGVWEHA.4024@TK2MSFTNGP09.phx.gbl...
> > > > This works:
> > > > CLOSE ALL
> > > > SET SAFETY OFF
> > > >
> > > > xFn = "REC03.XLS"
> > > > xTn = " REC03"
> > > > xTs = ""
> > > >
> > > > xTs = " ("
> > > > xTs = xTs + "region c(2), hospcd c(2), filler0 c(2), acct c(11),
> actype
> > > > c(1), acctsubtp c(1), contind c(1),"
> > > > xTs = xTs + "filler1 c(1), rectp c(1), filler2 c(3), createdt c(6),
> > > filler3
> > > > c(4)"
> > > > xTs = xTs + ")"
> > > >
> > > > cTblDef = xTn + xTs
> > > >
> > > > CREATE TABLE &cTblDef
> > > > SET SAFETY ON
> > > >
> > > > /Zeke
> > > >
> > > >
> > > >
> > > >
> > > > "Keht" <NoVirus@IHateScriptKiddies.com> wrote in message
> > > > news:OoMVv6UWEHA.1488@TK2MSFTNGP09.phx.gbl...
> > > > > I am getting a Syntax error on the following code... Anyone see
> whats
> > > > wrong?
> > > > >
> > > > > CLOSE ALL
> > > > > SET SAFETY OFF
> > > > >
> > > > > xFn = "REC03.XLS"
> > > > > xTn = " REC03"
> > > > > xTs = ""
> > > > >
> > > > > xTs = " ("
> > > > > xTs = xTs + "region c(2), hospcd c(2), filler0 c(2), acct c(11),
> > actype
> > > > > c(1), acctsubtp c(1), contind c(1),"
> > > > > xTs = xTs + "filler1 c(1), rectp c(1), filler2 c(3), createdt
c(6),
> > > > filler3
> > > > > c(4)"
> > > > > xTs = xTs + ")"
> > > > >
> > > > > CREATE TABLE + (m.xTn) + (m.xTs)
> > > > >
> > > > > SET SAFETY ON
> > > > >
> > > > > Thanks in advance.
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>


Re: Query/Program Problem by Fred

Fred
Thu Jun 24 01:24:31 CDT 2004

You need to use macro substitution in this case, as it has been suggested.
The reason it doesn't work with simple string concatenation is that's not
the way that VFP commands work. You could build the entire command string
up using concatenation and then macro execute the entire command:

cCreateCmd = "CREATE TABLE "+ xTn + xTs
&cCreateCmd

Fred
Microsoft Visual FoxPro MVP


"Keht" <NoVirus@IHateScriptKiddies.com> wrote in message
news:%23d%23tzIVWEHA.1144@TK2MSFTNGP10.phx.gbl...
> Thanks, worked great, you would think that the original way would work
also
> but who knows? I am prob not using somthing correctly..
>
> "Zeke Galama" <remove_galama_remove@telia.com> wrote in message
> news:OGruEGVWEHA.4024@TK2MSFTNGP09.phx.gbl...
> > This works:
> > CLOSE ALL
> > SET SAFETY OFF
> >
> > xFn = "REC03.XLS"
> > xTn = " REC03"
> > xTs = ""
> >
> > xTs = " ("
> > xTs = xTs + "region c(2), hospcd c(2), filler0 c(2), acct c(11), actype
> > c(1), acctsubtp c(1), contind c(1),"
> > xTs = xTs + "filler1 c(1), rectp c(1), filler2 c(3), createdt c(6),
> filler3
> > c(4)"
> > xTs = xTs + ")"
> >
> > cTblDef = xTn + xTs
> >
> > CREATE TABLE &cTblDef
> > SET SAFETY ON
> >
> > /Zeke
> >
> >
> >
> >
> > "Keht" <NoVirus@IHateScriptKiddies.com> wrote in message
> > news:OoMVv6UWEHA.1488@TK2MSFTNGP09.phx.gbl...
> > > I am getting a Syntax error on the following code... Anyone see whats
> > wrong?
> > >
> > > CLOSE ALL
> > > SET SAFETY OFF
> > >
> > > xFn = "REC03.XLS"
> > > xTn = " REC03"
> > > xTs = ""
> > >
> > > xTs = " ("
> > > xTs = xTs + "region c(2), hospcd c(2), filler0 c(2), acct c(11),
actype
> > > c(1), acctsubtp c(1), contind c(1),"
> > > xTs = xTs + "filler1 c(1), rectp c(1), filler2 c(3), createdt c(6),
> > filler3
> > > c(4)"
> > > xTs = xTs + ")"
> > >
> > > CREATE TABLE + (m.xTn) + (m.xTs)
> > >
> > > SET SAFETY ON
> > >
> > > Thanks in advance.
> > >
> > >
> >
> >
>
>