Hello All,
I would like to create a script for Retrieve Positions button available on Retrieve Object Map Positions screen.
Regards
Avinash
Hello All,
I would like to create a script for Retrieve Positions button available on Retrieve Object Map Positions screen.
Regards
Avinash
Hi
Refer to this response on the same topic. The solution is in the client alone to retrieve and will show the locations.
Request
Hi,
I am aware about the solution, I was thinking to automate the process using some PLSQL scripts. As of now the user has to go Retrieve Object Map Positions screen and click on Retrieve Positions. Is there any PLSQL script available to know what code is actually called when we click on Retrieve Positions button.?
Regards
Avinash
In Apps 10 we do the geocoding using Bing Maps' geocoding API directly from the client. It should be possible to do the same call from PL/SQL using the UTL_HTTP package, but that's something you probably have to experiment with on your own. If you pull it off, I'm sure others would be interested in the solution, so don't hesitate to share.
To get you started I asked Chat GPT to create a first version for you:
CREATE OR REPLACE PROCEDURE geocode_address (p_address IN VARCHAR2, p_latitude OUT NUMBER, p_longitude OUT NUMBER)
AS
l_http_request UTL_HTTP.req;
l_http_response UTL_HTTP.resp;
l_response_text VARCHAR2(32767);
l_latitude NUMBER;
l_longitude NUMBER;
BEGIN
-- Construct the URL for the Bing Maps geocoding API request
l_http_request := UTL_HTTP.begin_request('https://dev.virtualearth.net/REST/v1/Locations?q=' || p_address || '&key=YOUR_API_KEY', 'GET', 'HTTP/1.1');
-- Send the request to the API
l_http_response := UTL_HTTP.get_response(l_http_request);
-- Read the response text
BEGIN
UTL_HTTP.read_text(l_http_response, l_response_text);
EXCEPTION
WHEN UTL_HTTP.end_of_body THEN
UTL_HTTP.end_response(l_http_response);
END;
-- Extract the latitude and longitude from the response text
-- (Note: this is a simplified example and assumes that the response is in a specific format)
l_latitude := REGEXP_SUBSTR(l_response_text, '"latitude":"([^"]+)"', 1, 1, NULL, 1);
l_longitude := REGEXP_SUBSTR(l_response_text, '"longitude":"([^"]+)"', 1, 1, NULL, 1);
-- Set the output parameters
p_latitude := l_latitude;
p_longitude := l_longitude;
END;
It also said this:
This procedure uses the
UTL_HTTP
package to send an HTTP GET request to the Bing Maps geocoding API, and it usesREGEXP_SUBSTR
to extract the latitude and longitude values from the response.Note that you'll need to replace
YOUR_API_KEY
with your own Bing Maps API key in thel_http_request
line. Also, this code is just a simplified example, and you'll need to adapt it to handle the specifics of the API response, error handling, and so on.
Good luck!
Regards
Avinash
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.