table lookup efficiency

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf table lookup efficiency

  • Creator
    Topic
  • #49402
    Nora Katz
    Participant

      Does it make any difference (for searching)  to put items in a table in numeric or alphabetic order?  I’m concerned about some large tables that I need to build, whether it will slow the thread down significantly.

    Viewing 4 reply threads
    • Author
      Replies
      • #61807
        Jim Kosloskey
        Participant

          Nora,

          I have never tested this but I was told years ago that due to the hashing algorithm used to search the table the order does not matter.

          However, from a maintenance and troubleshooting standpoint, I find having the table in a particular order to be valuable.

          Jim Kosloskey

          email: jim.kosloskey@jim-kosloskey.com 29+ years Cloverleaf, 59 years IT - old fart.

        • #61808
          Nora Katz
          Participant

            Thanks for the info.

            Yes, I agree, having the values in order makes for easier lookups also.  

            Is there a utility for loading values from a file into a Cloverleaf table?

          • #61809
            Jim Kosloskey
            Participant

              Nora,

              No. You need to write your own.

              I have done this before – I wrote a Tcl proc to read in a delimited file (which was exported from a Database and FTP’d to Cloverleaf).

              If you would like the proc, I will try to find it and send it to you. You will probably need to modify it for your purposes.

              Jim Kosloskey

              email: jim.kosloskey@jim-kosloskey.com 29+ years Cloverleaf, 59 years IT - old fart.

            • #61810
              Nora Katz
              Participant

                Thanks, that would be great.  I did create something, but it was not in tcl.  But, I’m getting better at using tcl, so I think I can create something.

                If you can find your file, it would give me a head start.  No big rush.

                Thanks again for your help.

              • #61811
                Richard Hart
                Participant

                  Nora.

                  We load the ‘tables’ into an array and access them this way – like Jim, we have a script which loads the data file into our tables.  We use TCL for our translations and ‘source’ the tables and check their CVS id before using them.  The example below is used by our clinical system for imaging.

                  proc ExamCode {aCode} {

                                 # make the array global, so it is always available

                         global ExamCodeArray

                                 #

                                 # if the code is DATA_INIT then we initialise the array

                                 #

                         if {[string equal $aCode DATA_INIT]} {

                                         # ExamCode DATA_INIT START – do NOT remove this line

                                  set ExamCodeArray(ABDO)        “ABDO”

                                  set ExamCodeArray(ABDOE)       “ABDO”

                                  set ExamCodeArray(ABDOENR)     “ABDO”

                                  set ExamCodeArray(ABDONR)      “ABDO”

                                  set ExamCodeArray(YWCWX)       “YWC”

                                         # ExamCode DATA_INIT END – do NOT remove this line

                         } else {

                                         #

                                         # set the return variable to the default value,

                                         # in this case the original code

                                         #

                                 set myData $aCode

                                         #

                                         # make sure we don’t fall over if there is NO data!

                                         #

                                 catch {set myData $ExamCodeArray($aCode)}

                                         #

                                         # return the data from the array

                                         #

                                 return $myData

                         };# end of if

                  }

                  ExamCode    DATA_INIT

                  ExamTechnique   DATA_INIT

                  ExamDelete   DATA_INIT

                         #

                         # return OK

                         #

                  return 0

              Viewing 4 reply threads
              • The forum ‘Cloverleaf’ is closed to new topics and replies.