Imagine my unpleasant surprise when I tried Bill's MB code and it didn't
work.  After reading  Lar's message, I was finally able to do what I
wanted:

run command "dim iSAMPLE as integer"
run command "dim X as integer"
dim sExpression as string
run command "dim bTruth as logical"
dim sCONDITION as string
sCONDITION = "(iSAMPLE = X^2)"
sExpression = "bTruth = "+sCONDITION
run command "iSAMPLE = 5"
run command "X = 2"
run command sExpression
run command "print bTruth"

I should explain that what I'm doing is bringing in some heuristics to an
application (e.g. if this then that) and need to be able implement a
backchaining algorithm using a table of rules.  This works very nicely.

Actually, there is one final problem: in the assignment statement "iSAMPLE
= 5" I will need to somehow place a variable name (in this case iSAMPLE)
into a string variable.  For example, if I were able to place the string
(corresponding to the variable name) "iSAMPLE" into a variable named sVAR,
I could implement the assignment statement as follows:

sNUM = str$(5)
sASSIGNMENT = sVAR+" = "+sNUM
run command sASSIGNMENT

This rather than the

run command "iSAMPLE = 5"

as it is listed above.

After that first one, this should be cake for you guys.

Thanks for the help.

G


Bill Thoen wrote:

> [EMAIL PROTECTED] wrote:
> >
> > I saw Bill's answer, and immidiately thought: this doesn't work.
> > At least not as a MapBasic program. Tried it in 4.1 and it didn't.
> > And you were thinking of utilizing this in MB code, Gary ?
> >
> > The problem is the scope. Or name space if you prefer that term.
>
> Oh yeah... good point. Forgot about that. My brain was in the
> laundry getting washed and pressed that day, I guess.
>
> - Bill Thoen
> ----------------------------------------------------------------------
> To unsubscribe from this list, send e-mail to [EMAIL PROTECTED] and put
> "unsubscribe MAPINFO-L" in the message body, or contact [EMAIL PROTECTED]

   --

---------------------------------------------
Gary S. Spring, Associate Professor
Department of Civil Engineering
University of Missouri-Rolla
Rolla, MO 65409-0030
Phone: 573-341-6286
Fax: 573-341-4729
http://www.umr.edu/~spring/

----------------------------------------------------------------------
To unsubscribe from this list, send e-mail to [EMAIL PROTECTED] and put
"unsubscribe MAPINFO-L" in the message body, or contact [EMAIL PROTECTED]

Reply via email to