0

I have buffer bufCustomer for table Customer global buffer gbufOrder for table Order. But this code is not working I wrote the code like find bufCustomer where bufCustomer.CustomerID = gbufOrder.CustomerID no-lock no-error. but if i check the table data,data is there but if i wrote a code like above its not working. Is there any other way to get the values?

  • 1
    You need to show your actual code. The description is far too vague to reach any conclusions from. – Tom Bascom Oct 03 '12 at 12:25
  • define buffer bufCustomer for Customer. find bufCustomer where bufCustomer.CustomerID = gbufOrder.CustomerID no-lock no-error – user1204240 Oct 09 '12 at 05:26
  • I want to get Customer Name so I wrote this which is working partially i.e getting customer Name for some of the records but i want to get the customer name for all records.Please help. – user1204240 Oct 09 '12 at 05:33
  • try run your script without the NO-ERROR option in the FIND statement. you should then receive an error, which explain you, what is wrong... – firhang Oct 09 '12 at 08:25
  • Its showing like "bufCustomer record not found".HOw to get the values? – user1204240 Oct 09 '12 at 09:11

1 Answers1

1

w/BUFFER:

DEFINE BUFFER gbufOrder FOR Order.
DEFINE BUFFER bufCustomer FOR Customer.

FIND FIRST gbufOrder NO-LOCK NO-ERROR.
IF AVAILABLE(gbufOrder) THEN
   DO:
      FIND bufCustomer where bufCustomer.CustNum = gbufOrder.CustNum NO-LOCK NO-ERROR.

      IF AVAILABLE(bufCustomer) THEN
         DO:
            DISP bufCustomer.name.
         END.
      ELSE
         DO:
            MESSAGE "Customer is not available!"
               VIEW-AS ALERT-BOX ERROR BUTTONS OK.
         END.
   END.
ELSE
   DO:
      MESSAGE "Order is not available!"
          VIEW-AS ALERT-BOX ERROR BUTTONS OK.
   END. 

w/o BUFFER

FIND FIRST Order NO-LOCK NO-ERROR.
IF AVAILABLE(Order) THEN
   DO:
      FIND Customer where Customer.CustNum = Order.CustNum NO-LOCK NO-ERROR.

      IF AVAILABLE(Customer) THEN
         DO:
            DISP Customer.name.
         END.
      ELSE
         DO:
            MESSAGE "Customer is not available!"
               VIEW-AS ALERT-BOX ERROR BUTTONS OK.
         END.
   END.
ELSE
   DO:
      MESSAGE "Order is not available!"
          VIEW-AS ALERT-BOX ERROR BUTTONS OK.
   END.

This program works with sports200 sample database (it is located in PROGRESS / OpenEdge install directory)

UPDATE:

  • checking availbility of Customer
  • add sample code without BUFFER
ksimon
  • 711
  • 11
  • 24
  • that is not yet 100% correct. you should testing the availablity of bufcustomer after the FIND bufCustomer - like after first FIND of Order. else get you some error like customer not available.. – firhang Oct 10 '12 at 12:36