Tough Arithmetic problem in ASP

Results 1 to 5 of 5

Thread: Tough Arithmetic problem in ASP

  1. #1
    DKL Guest

    Default 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. #2
    Join Date
    Dec 1969

    Default 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. #3
    Join Date
    Dec 1969

    Default OOPS actually use EVAL

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

  4. #4
    DKL Guest


    Both are working.

  5. #5
    Krank (was Frank) Guest

    Default 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