inserting formula into a DB

Results 1 to 4 of 4

Thread: inserting formula into a DB

  1. #1
    Join Date
    Dec 1969

    Default inserting formula into a DB

    Is there any way of retrieving a forumula from a DB record and then executing that formula in the asp- as is I&#039ve been storing a simple value then using a select case.<BR><BR>ie. a sample payrate record = "(hour * rate) + condition"<BR>where "hour" "rate" and "condition" would be variables existing in the asp - loaded from elsewhere in the DB.<BR><BR>many thanks

  2. #2
    jason Guest

    Default RE: inserting formula into a DB

    you&#039ve pretty much ansered your own question. just load them in as variables as you would normally i.e.<BR><BR>rate = myRecordset("rate")<BR>hour = myRecordset("hour")<BR>condition = myrecordset("condition")<BR><BR>result = (hour * rate) + condition<BR><BR>jason

  3. #3
    fatty Guest

    Default I wasn't clear

    the formula changes based on type of work (given the example) I already load all the variables but use a select case to decide the formula. It&#039s growing though and I hope for a better solution.<BR><BR>sometimes the formula might be<BR> (hour*rate)+condition)<BR>or<BR> (((hour*2)*rate)-condition)<BR>or<BR> ((hour+worker)*2)<BR>etc, etc...<BR><BR>anyway to store those equations as strings but still execute them?

  4. #4
    jason Guest

    Default RE: I wasn't clear

    if you&#039re using JScript you can eval() them which should work quite well. dunno about VBScript, but i&#039ll check<BR><BR>......insert sound of checking here......<BR><BR>yes, VBScript also has an Eval statement<BR><BR>so you can store the exression in the DB, and then dynamically include the appropriate variation. as long as you stick to a variable naming convention, you&#039ll be laughing.<BR><BR>jason<BR><BR>

Posting Permissions

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