Results 1 to 5 of 5

Thread: wjmoregon@reflexnet.net

  1. #1
    Joey Guest

    Default wjmoregon@reflexnet.net

    I need to have the ability for a user to be able to select certain criteria, ie., state, job, salary, etc. I then need a table to come up with the results, and give a percentage of that match.<BR><BR>Any ideas?<BR>Thanks!

  2. #2
    Joey Guest

    Default OOPPSS...Database Comparison

    Sorry...that should have been the Subject, not email!!

  3. #3
    BalletChick Guest

    Default RE: wjmoregon@reflexnet.net

    You&#039ll have to explain just a bit more. Can you give an example, perhaps? I am not sure if you mean show which percentage of records in the table match all criteria... or if you mean by what percentage all criteria were met by each record... or ??<BR><BR>

  4. #4
    Joey Guest

    Default RE: wjmoregon@reflexnet.net

    I would like it to say something like <BR>username from results and percentage of match, as in<BR>this person matched you, but only at 75% whereas this other person was 100%. Is that more clear?

  5. #5
    BalletChick Guest

    Default hope this helps...

    Yes, that helps.<BR><BR>The easiest way I know of to do what you want is to do a select using OR&#039s for each param and then do the calculation. For example, let&#039s say that I am allowing a search on four fields: state, job, salary and age. My search might look like this:<BR><BR>select [fields] from [table] where State=&#039FL&#039 or job=37 or (salary&#062;110 and salary&#060;159) or (age&#062;24 and age&#060;30)<BR><BR>Then (assuming that the weight of each of these is the same, that is to say 25%) I could loop through all of the records (actually you should use GETROWS for speed, but I will do this for clarity) and do the calculation for each one, e.g.:<BR><BR>while not rs.EOF<BR>&nbsp;&nbsp;&nbsp; MatchPercent = 0<BR>&nbsp;&nbsp;&nbsp; if rs("State") = "FL" then MatchPercent = MatchPercent + 25<BR>&nbsp;&nbsp;&nbsp; if rs("Job") = 37 then MatchPercent = MatchPercent + 25<BR>&nbsp;&nbsp;&nbsp; if rs("Salary")&#062;110 and rs("Salary")&#060;159 then MatchPercent = MatchPercent + 25<BR>&nbsp;&nbsp;&nbsp; if rs("Age") &#062; 24 and rs("Age") &#060; 30 then MatchPercent = MatchPercent + 25<BR>&nbsp;&nbsp;&nbsp; response.write "Record matched by " & MatchPercent & "%"<BR>&nbsp;&nbsp;&nbsp; &#039<BR>&nbsp;&nbsp;&nbsp; rs.movenext<BR>wend<BR><BR><BR>Now, naturally you would not want to use this code "as is", you need to make it more generic, and it would be good in your case to allow it to dynamically determine the percentage weighting of each variable. For example, the AGE range may be worth more for the total percentage than, say, the SALARY range. If that were the case, then you could weight the AGE match differently. You also need to takeinto account how many search parameters were included by the user making the search. For example, if the user above had only desried to search on Age, Salary Range and Job, bit not State, then each of the search params might have had a weight of 33.333 instead.<BR><BR>Dig?<BR><BR><BR><BR><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