VFP 9: #define constants - xbase
This is a discussion on VFP 9: #define constants - xbase ; 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 ...
![]() |
| | LinkBack | Thread Tools | Display Modes |
|
#1
| |||
| |||
| 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. |
|
#2
| |||
| |||
|
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. |
|
#3
| |||
| |||
|
How about that! You learn something new every day. "Sergey Berezniker" 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. > |
|
#4
| |||
| |||
|
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. |
|
#5
| |||
| |||
|
Sergey Berezniker >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. |
|
#6
| |||
| |||
|
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 |
|
#7
| |||
| |||
|
Sergey Berezniker >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. |
![]() |
« Previous Thread
|
Next Thread »
| Thread Tools | |
| Display Modes | |
| |
All times are GMT -4. The time now is 04:30 PM.




Linear Mode