[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index]
[Date Index]
[Thread Index]
[SQR-USERS Info]
[SQRUG Home Page]
Re: [sqr-users] Printing Entire Lookup Table?
Richard and Mac and everyone else:
Thanks for the replies. The load-lookup usage is actually a little more
annoying than the simple use to eliminate a small table join
(unfortunately). The use of the lookup in this case actually saves a bunch
of coding elsewhere and I was hoping it would save me time in the footnote
process as well (kill another bird with the same stone).
As the footnote is printed on the bottom of every page, executing one SQL
statement over and over doesn't seem like a great idea. So, since it seems
impossible to access a lookup table directly, from everyone's comments the
"best" option is to create an array which duplicates the lookup table and I
simply run through that every time.
Thanks again,
--
Matt
At 10:56 AM 7/26/2005, Mac Sandridge wrote:
>Knapp, Richard wrote:
>
>>The SQR lookup is both a table in the database and an array in your
>>computer's memory. The sad part is: you can't access either except
>>through the load-lookup command. It would be more efficient to skip the
>>load-lookup, select your pairs from the db using the same logic used to
>>load the lookup table and load these into an array that you can traverse
>>at will. Chances are that if your lookup data set is small enough to
>>print at the end of the report, the load-lookup mechanism is not an
>>efficient way to do the lookup anyway. (Just guessing here about the
>>size of the lookup table/array.)
>>
>I agree with Richard but have one suggestion, build an index string for
>finding the values. Basically, take the size of your key and use that to
>pad the key to the max length and add a value that cannot appear in the
>key. I often use \ | or ; to do this. Then, you find the position of the
>look-up key in the string with the separator concatenated to find the
>array index to use (based on 0). For example:
>
>let $StateIndexString = 'AL;AK;AZ;' ! Obviously, continuing for all 50
>values, or you can build this when populating the array
>
>so if you have a key value in $StateCode
>
>let $FindState = rpad($StateCode,2,' ') || ';'
>let #StateIndex = instr($StateCode, $StateIndexString) / 3 ! The length of
>the key and separater. You may have to truncate this number to get the
>index right.
>
>Please forgive me if the code is not perfect, I do not have my references
>here and I no longer work with SQR (such a shame too!) so I am not exactly
>sure of the syntax.
>
>Good luck!
>Mac
>
_______________________________________________
sqr-users mailing list
sqr-users@sqrug.org
http://www.sqrug.org/mailman/listinfo/sqr-users