I know that VFP will not perform substitutions within a string as
in
#define SUPERLATIVE better
sentence="Father knows SUPERLATIVE."
but is there a way to get a similar effect?

I use SQLSEL as in
#define SQLSEL select
...
SQLSEL clcode,clname from ccli order by clcode
to differentiate between xBASE select statements and SQL select
statements.

Occasionally, I need to build an SQL statement with a subquery in
it and would like to build the expression as in
wherecond=;
"&limitexpr and "+;
"trnnbr in (SQLSEL wonbr from cwko where woccode=currwocc)"
This does not work. I have to use "select" and make a note (so that
when I search for SQL select statements, I can find them all.

Any ideas?

Sincerely,

Gene Wirchenko

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

Re: VFP 9: #define constants by Sergey

Sergey
Sun Jul 20 20:25:54 CDT 2008

Gene,

VFP will perform substitution inside [] string delimiters

#define SUPERLATIVE better
sentence = [Father knows SUPERLATIVE.]
? sentence

--
--sb--

VFP MVP

Gene Wirchenko wrote:
> I know that VFP will not perform substitutions within a string as
> in
> #define SUPERLATIVE better
> sentence="Father knows SUPERLATIVE."
> but is there a way to get a similar effect?
>
> I use SQLSEL as in
> #define SQLSEL select
> ...
> SQLSEL clcode,clname from ccli order by clcode
> to differentiate between xBASE select statements and SQL select
> statements.
>
> Occasionally, I need to build an SQL statement with a subquery in
> it and would like to build the expression as in
> wherecond=;
> "&limitexpr and "+;
> "trnnbr in (SQLSEL wonbr from cwko where woccode=currwocc)"
> This does not work. I have to use "select" and make a note (so that
> when I search for SQL select statements, I can find them all.
>
> Any ideas?
>
> Sincerely,
>
> Gene Wirchenko
>
> Computerese Irregular Verb Conjugation:
> I have preferences.
> You have biases.
> He/She has prejudices.


Re: VFP 9: #define constants by Paul

Paul
Sun Jul 20 20:55:47 CDT 2008

How about that!

You learn something new every day.


"Sergey Berezniker" <spam@gmail.com> wrote in message
news:%238en3Ct6IHA.2220@TK2MSFTNGP06.phx.gbl...
> Gene,
>
> VFP will perform substitution inside [] string delimiters
>
> #define SUPERLATIVE better
> sentence = [Father knows SUPERLATIVE.]
> ? sentence
>
> --
> --sb--
>
> VFP MVP
>
> Gene Wirchenko wrote:
>> I know that VFP will not perform substitutions within a string as
>> in
>> #define SUPERLATIVE better
>> sentence="Father knows SUPERLATIVE."
>> but is there a way to get a similar effect?
>>
>> I use SQLSEL as in
>> #define SQLSEL select
>> ...
>> SQLSEL clcode,clname from ccli order by clcode
>> to differentiate between xBASE select statements and SQL select
>> statements.
>>
>> Occasionally, I need to build an SQL statement with a subquery in
>> it and would like to build the expression as in
>> wherecond=;
>> "&limitexpr and "+;
>> "trnnbr in (SQLSEL wonbr from cwko where woccode=currwocc)"
>> This does not work. I have to use "select" and make a note (so that
>> when I search for SQL select statements, I can find them all.
>>
>> Any ideas?
>>
>> Sincerely,
>>
>> Gene Wirchenko
>>
>> Computerese Irregular Verb Conjugation:
>> I have preferences.
>> You have biases.
>> He/She has prejudices.
>



Re: VFP 9: #define constants by Samir

Samir
Mon Jul 21 06:07:54 CDT 2008

You can use #DEFINE with Macro &

#DEFINE SUPERLATIVE '&lcMyVariable'
lcMyvariable = "Better"
? "Father Knows " + SUPERLATIVE


"Gene Wirchenko" <genew@ocis.net> wrote in message
news:too784pf2ib8kri9lqj0fgmosj8p74n86q@4ax.com...
> I know that VFP will not perform substitutions within a string as
> in
> #define SUPERLATIVE better
> sentence="Father knows SUPERLATIVE."
> but is there a way to get a similar effect?
>
> I use SQLSEL as in
> #define SQLSEL select
> ...
> SQLSEL clcode,clname from ccli order by clcode
> to differentiate between xBASE select statements and SQL select
> statements.
>
> Occasionally, I need to build an SQL statement with a subquery in
> it and would like to build the expression as in
> wherecond=;
> "&limitexpr and "+;
> "trnnbr in (SQLSEL wonbr from cwko where woccode=currwocc)"
> This does not work. I have to use "select" and make a note (so that
> when I search for SQL select statements, I can find them all.
>
> Any ideas?
>
> Sincerely,
>
> Gene Wirchenko
>
> Computerese Irregular Verb Conjugation:
> I have preferences.
> You have biases.
> He/She has prejudices.



Re: VFP 9: #define constants by Olaf

Olaf
Mon Jul 21 09:27:25 CDT 2008

Besides that you can also use constants
with TEXT..ENDTEXT, which is advisable anyway,
if you want to create a multiline SQL statement.

#Define SQLSEL Select
Text To lcSQL
SQLSEL * FRom Table
EndText

? lcSQL

Bye, Olaf.

Re: VFP 9: #define constants by Gene

Gene
Mon Jul 21 19:30:51 CDT 2008

Sergey Berezniker <spam@gmail.com> wrote:

>VFP will perform substitution inside [] string delimiters
>
>#define SUPERLATIVE better
>sentence = [Father knows SUPERLATIVE.]
>? sentence

Well, well. That is certainly poorly documented. The #define
documentation states that substitutions are not done inside of
quotation marks, but does not say anything about "[" and "]". I did
not even think of them as being different. After all, they delimit
strings, too.

Sincerely,

Gene Wirchenko

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

Re: VFP 9: #define constants by Sergey

Sergey
Mon Jul 21 19:56:53 CDT 2008

Gene Wirchenko wrote:

> Well, well. That is certainly poorly documented. The #define
> documentation states that substitutions are not done inside of
> quotation marks, but does not say anything about "[" and "]". I did
> not even think of them as being different. After all, they delimit
> strings, too.
>

I'm pretty sure that VFP wouldn't perform substitution if [] were used
to delimit string literals only. However they are "overloaded" in VFP
and could be used in arrays and UDFs

? myarray[i]
? myudf["Some String Parameter"]
* or
? myudf[[Some String Parameter]]

--
--sb--

VFP MVP

Re: VFP 9: #define constants by Gene

Gene
Mon Jul 21 20:36:30 CDT 2008

Sergey Berezniker <spam@gmail.com> wrote:

>Gene Wirchenko wrote:
>
>> Well, well. That is certainly poorly documented. The #define
>> documentation states that substitutions are not done inside of
>> quotation marks, but does not say anything about "[" and "]". I did
>> not even think of them as being different. After all, they delimit
>> strings, too.
>>
>
>I'm pretty sure that VFP wouldn't perform substitution if [] were used
>to delimit string literals only. However they are "overloaded" in VFP
>and could be used in arrays and UDFs

I am sure that it will. I tried the example given. I then made
the appropriate changes to my program, and the substitutions were
done.

[snip]

Sincerely,

Gene Wirchenko

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