AnsweredAssumed Answered

Scripting a find request

Question asked by nolak37 on Apr 17, 2014
Latest reply on Apr 17, 2014 by philmodjunk


Scripting a find request


     Hello everyone,

     I have a database for a weight loss clinic in which we want to find a list of patients who were overweight as of their last visit.

     I created a script:

     Enter find mode

     set field date (first...last)

     sorts records (by person id in descending order and date in descending order)

     Go to first record


     set variable $id (person id)

     set variable $date (date)

     go to record (next exit after last)

     if (people id = $id and date > $date)

     omit record

     end if

     end loop

             This loops through the records and omits all records but the newest one for each person who visited within the selected dates, I then run another script that loops through these records and omits records where the person has a BMI (body mass index) lower than what the user specifies.

     Go to record (first)


     if (BMI < 40 )

     omit record

     end if

     go to record (next, exit after last)

     end loop.


     The problem I am having is that not all records that meet that criteria are omitted, after running the script i get a record count of 120 for example and if I run it again I get a record count of 102 and I end up running it 5-6 times before getting down to the correct list of records. Is there an easier way to do this? is there something wrong with my script?


     Thanks in advance for any help