How to use the result of one SQL SELECT statement in a subsequent event (AJAX call?)

I’m working on an Oracle APEX app, using Master/Detail drill down forms. I’m having difficulty working out how APEX uses a value looked up as the result of an SQL statement run in one event in a subsequent SQL statement. In JavaScript, this is async callbacks and/or Promises; from the difficulty I’m having here it’s pretty clear that there’s an async mechanism at work behind the scene.

I’m working with APEX version 22.2.

Where I’m having trouble is when inserting a new record. I’d like to be able to look up some values based on a value that the user enters, when the user leaves the field.

The fields in question are:

PO_NUM

Ok VENDOR_CODE
VENDOR_NAME

I would like, when the user enters a PO_NUM, to look up the VENDOR_CODE, and from there look up the VENDOR_NAME in a subsequent SQL statement that uses the looked-up VENDOR_CODE.

These are all items on a form. I have this Dynamic Action set up for PO_NUM:

  1. Event: Lose Focus
  2. Selection Type: Item(s)
  3. Item(s): PO_NUM

And under the True section:

  1. Action: Set Value
  2. Set Type: SQL Statement
  3. SQL Statement: (SQL statement that looks up VENDOR_CODE using the value entered in PO_NUM)
  4. Items to Submit: PO_NUM
  5. Affected Elements Selection Type: Item(s)
  6. Item(s): VENDOR_CODE

This all works as intended: user enters a PO number in the text field, tabs off of it, and the Vendor Code shows up in the VENDOR_CODE item on the form. (Note: I don’t know if this is relevant, but on the PO_NUM field properties themselves, I have a custom attribute readonly. I wanted this field to be read only, but for denormalization purposes I also need to insert its value into a field on submit.)

Where I’m running into trouble is using that Vendor Code to look up the Vendor Name in a subsequent SQL statement, and put the result in the VENDOR_NAME item. I’ve tried a number of things, without any luck. My most recent theory has been to use the Change event for VENDOR_CODE, with the idea that the value won’t change until it comes back from the server, and then I can use it for the next SQL statement. But doesn’t work.

For the record, here’s the Dynamic Action I have in the VENDOR_CODE item:

  1. Event: Change
  2. Selection Type: Item(s)
  3. Item(s): VENDOR_CODE

And in the True section:

  1. Action: Set Value
  2. Set Type: SQL Statement
  3. SQL Statement: (SQL statement that uses :VENDOR_CODE to look up the associated VENDOR_NAME in a vendor table`)
  4. Items to Submit: (none)
  5. Affected Elements Selection Type: Item(s)
  6. Item(s): VENDOR_NAME

I’m thinking that there’s a problem with the async part of this, but I wonder if I’m missing something simple. How do I get this running?

As it turns out, the problem was with the Items to Submit in the Change event. After changing this to VENDOR_CODE, I got the result I was looking for.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa

How to use the result of one SQL SELECT statement in a subsequent event (AJAX call?)

I’m working on an Oracle APEX app, using Master/Detail drill down forms. I’m having difficulty working out how APEX uses a value looked up as the result of an SQL statement run in one event in a subsequent SQL statement. In JavaScript, this is async callbacks and/or Promises; from the difficulty I’m having here it’s pretty clear that there’s an async mechanism at work behind the scene.

I’m working with APEX version 22.2.

Where I’m having trouble is when inserting a new record. I’d like to be able to look up some values based on a value that the user enters, when the user leaves the field.

The fields in question are:

PO_NUM

Ok VENDOR_CODE
VENDOR_NAME

I would like, when the user enters a PO_NUM, to look up the VENDOR_CODE, and from there look up the VENDOR_NAME in a subsequent SQL statement that uses the looked-up VENDOR_CODE.

These are all items on a form. I have this Dynamic Action set up for PO_NUM:

  1. Event: Lose Focus
  2. Selection Type: Item(s)
  3. Item(s): PO_NUM

And under the True section:

  1. Action: Set Value
  2. Set Type: SQL Statement
  3. SQL Statement: (SQL statement that looks up VENDOR_CODE using the value entered in PO_NUM)
  4. Items to Submit: PO_NUM
  5. Affected Elements Selection Type: Item(s)
  6. Item(s): VENDOR_CODE

This all works as intended: user enters a PO number in the text field, tabs off of it, and the Vendor Code shows up in the VENDOR_CODE item on the form. (Note: I don’t know if this is relevant, but on the PO_NUM field properties themselves, I have a custom attribute readonly. I wanted this field to be read only, but for denormalization purposes I also need to insert its value into a field on submit.)

Where I’m running into trouble is using that Vendor Code to look up the Vendor Name in a subsequent SQL statement, and put the result in the VENDOR_NAME item. I’ve tried a number of things, without any luck. My most recent theory has been to use the Change event for VENDOR_CODE, with the idea that the value won’t change until it comes back from the server, and then I can use it for the next SQL statement. But doesn’t work.

For the record, here’s the Dynamic Action I have in the VENDOR_CODE item:

  1. Event: Change
  2. Selection Type: Item(s)
  3. Item(s): VENDOR_CODE

And in the True section:

  1. Action: Set Value
  2. Set Type: SQL Statement
  3. SQL Statement: (SQL statement that uses :VENDOR_CODE to look up the associated VENDOR_NAME in a vendor table`)
  4. Items to Submit: (none)
  5. Affected Elements Selection Type: Item(s)
  6. Item(s): VENDOR_NAME

I’m thinking that there’s a problem with the async part of this, but I wonder if I’m missing something simple. How do I get this running?

As it turns out, the problem was with the Items to Submit in the Change event. After changing this to VENDOR_CODE, I got the result I was looking for.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật