[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index] [Date Index] [Thread Index]
[SQR-USERS Info] [SQRUG Home Page]

[sqr-users] Debugging a Lookup Table



Hi,

I am having a problem with a lookup table.  I have to access data from another 
database, so I want to just read it once, up front, and create a lookup table.  
It looks to me like everything should work, but it's not - I am not getting any 
values returned to my lookup statement.  I do not believe that there is any way 
to actually see or display what has been loaded into the lookup table - is that 
correct?  Here are the details:

   load-lookup
      name=departments
      table=department@smarttime
      key=to_char(division_number,'09999')||department
      return_value=department
      rows=9999
.....
            let $key = $division_number||$home_department
            display $key
            lookup departments $key $st_dept
            display $st_dept
            if isnull($st_dept)
               do Insert-Department
               end-if

It is trying to do Insert-Department every time.  If I use a query tool and 
retrieve:

select to_char(division_number,'09999')||department from department;

this should give me what is loaded into the key values of the lookup table.  
One of the values is: 
 
0000160100

The displays from the logic where I try to retrieve the lookup value on my 
first selected record show: 

0000160100 

for the display of $key, and this is followed by a null line where I display 
$st_dept.  The keys look identical to me, but I have no way of telling that it 
was actually stored in the lookup table, so I can't figure out why it's not 
finding the match.

I get this in digest mode, so if you would please copy me on any reply at 
dewhite@vicr.com, I would appreciate it.  This is holding up what I wanted to 
accomplish today, but I don't want to have to back down and rewrite it to use 
arrays instead of lookup tables!

BTW, when the program does the load-lookup, it does display the correct number 
of rows that have been loaded, and I also confirmed that if I place a syntax 
error in the key clause of the load-lookup, it will abend on an error, so it is 
accepting the to_char() function as valid syntax.  I am using SQR 4.3.2.

TIA,

Denise M. White
Sr. Software Engineer
Vicor 

_______________________________________________
sqr-users mailing list
sqr-users@sqrug.org
http://www.sqrug.org/mailman/listinfo/sqr-users