Tough Arithmetic problem in ASP

# Thread: Tough Arithmetic problem in ASP

1. DKL Guest

## Tough Arithmetic problem in ASP

Hi,<BR><BR>I have asp variable LOGIC which may have values like "&#060;=20" or "&#062;30" or "&#062;=1000". <BR>I have one more asp variable CURRENTNUMBER which may any value greater than 0.<BR><BR>Let&#039;s assume that LOGIC has value "&#060;=20". The value of CURRENTNUMBER should satisfy the value in LOGIC.<BR>If CURRENTNUMBER = 10 the system should write "Valid"<BR>If CURRENTNUMBER = 30 the system should write "Invalid"<BR><BR>The biggest problem is how to split/get the operation ( i.e &#060;, &#060;= etc) and the number from variable LOGIC ?<BR><BR>Thanks in advance.

2. Senior Member
Join Date
Dec 1969
Posts
1,431

## R&D execute

should be able to do<BR><BR>dim blnResult<BR><BR>Execute("blnResult=" currentNumber & LOGIC)<BR><BR>If blnresult Then<BR> response.Write "Valid"<BR>Else<BR> response.Write "InValid"<BR>End If<BR>

3. Senior Member
Join Date
Dec 1969
Posts
1,431

## OOPS actually use EVAL

If eval(currentNumber & LOGIC) Then<BR>response.Write "Valid"<BR>Else<BR>response.Write "InValid"<BR>End If<BR>

4. DKL Guest

## THANK YOU VERY MUCH

Both are working.

5. Krank (was Frank) Guest

## Use EVAL though

if you have something like =20 as execute actually executes that statement ie<BR><BR>Execute("myvar=20") : myvar now is = 20<BR>Eval("myvar=20") : myvar same value as before just runs test on logical statement.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•