I'm having some issues where if I run a query based on a buffer-field obtained from a browse query, not all fields are available. For example, if I run the below code, I will get a blank customer.custName but buffer:buffer-field("custName"):buffer-value shows the correct value. It doesn't seem to be happening on all fields and I'm not sure what the correlation is between the fields that show and those that don't; fields that are displayed in the browse are also affected. Any ideas?
create buffer hbuffer for table "customer". hbuffer = browse {&browse-name}:query:get-buffer-handle(1). browse {&browse-name}:query:get-first(). repeat i=1 to browse {&browse-name}:query:num-results. if valid-handle(hbuffer) then do. find first customer where customer.custNum = hbuffer:buffer-field("custNum"):buffer-value no-lock no-error. if available customer then do. message customer.custName hbuffer:buffer-field("custName"):buffer-value. end. end. browse {&browse-name}:query:get-next(). end.
0. remove the no-error from your find first - which error do you get?
1. put hbuffer::custNum in an intermediate variable and use that
2. or cast the buffer-value explicitly to an integer
Hi sorry, you can ignore this post (I'm not sure how to delete it). It was a stupid mistake I made not realising that the key I was using was not unique. I've changed it to hbuffer:rowid and it's all good now.