Quote:>I am trying to use a variable in a query (saved with a tilde variable) by
>reading from a file and then setting the variable. Anyone know how to do
>this? I can hard code the query (by pasting the file into the method) and
>then setting the variable, but I'd like to do it the other way.
var
qVar query
r report
wret anytype
Name4QBE anytype
;*** the followind vars are added
s,s1 string
ts textstream
i longint
;***
endvar
<snip>
if CurrentNameKey > 0
then Name4QBE = CurrentNameKey
else Name4QBE = ">0"
endif
;**** the following code reads a query to a string and replaces tilde var by
the
actual value
ts.open(MasterQBEToRun+".qbe","r")
s="" while ts.readline(s1) s=s+s1+"\n" endwhile
i=s.search("~Name4QBE")
s=s.substr(1,i-1)+Name4QBE+s.substr(i+9,s.size()-(i+8))
;****
qVar.readfromstring(s)
if NOT qVar.executeQBE()
then msgStop("ERROR","Unable to execute query "+
MasterQbeToRun) ; ERROR HERE
errorshow()
return
endif
HIH
Russ Carmichael
'You can't be a Real Country unless you have a BEER and an airline. It helps if
you have some kind of a football team, or some nuclear weapons, but at the very
least you need a BEER' Frank Zappa
1. Tilde variable & Query ReadFromFile
Has anyone tried to dynamicly assign a variable value using a tilde
variable in a query that is read from file? I tried the following
(with ~aType in the query)
aType="Mechanical"
q.readFromFile(":ROYMAST:NewReleases.qbe")
q.executeQBE()
This generates an error that the variable is not defined. It only
works if I paste the query in (hard code it).
Any thoughts on whether this is correct Pdox behavior?
Noah
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
2. Confusion on using a Query instead of a Table as a datasource for controls
3. Query ReadFromFile and variables
5. Tilde variable query advice?
6. How to recover user database from rman
7. ~Tilde Variables in Queries
8. Help help
9. Tilde variable in query HELP
10. Using Tilde variable in query HELP
11. Date Tilde Variable in Query
12. Using Tilde (~) variable in query
13. Help with query strings and tilde variables in PDOXWIN