Skip to Content
0

Google Maps in an HTML Viewer

Jul 21, 2017 at 08:34 PM

83

avatar image
Former Member

Hello Experts,

I am attempting to use an HTML viewer to build a google map. I am using the sample from google maps API documentation as a test and am able to update the HTML viewer content and have the HTML portion appear correctly but not the map.

When I run the code outside Personas in Chrome it works (removing the variable for Personas).

I have attached the code I have in my script. Any help is greatly appreciated.

map-viewer.txt

Thanks,

Andrew

map-viewer.txt (1.4 kB)
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Best Answer
Tamas Hoznek
Jul 22, 2017 at 11:13 AM
0

Here is an example for displaying the map in IE03 (equipment display) for the equipment's address that's on the screen in separate fields. You will have to replace the control IDs for your transaction's fields, where the address details are coming from. You also have to replace Your_GMaps_API_key with your own key.

Use this code to update the URL for your HTML viewer:

var address=session.findById("wnd[0]/usr/tabsTABSTRIP/tabpT\\02/ssubSUB_DATA:SAPLITO0:0102/subSUB_0102B:SAPLITO0:1051/subSUB_1051A:SAPLIPAR:0130/subADRESSE:SAPLIPAR:0122/ctxtDIADR-STREET").text.concat(",", session.findById("wnd[0]/usr/tabsTABSTRIP/tabpT\\02/ssubSUB_DATA:SAPLITO0:0102/subSUB_0102B:SAPLITO0:1051/subSUB_1051A:SAPLIPAR:0130/subADRESSE:SAPLIPAR:0122/txtDIADR-CITY1").text, ",", session.findById("wnd[0]/usr/tabsTABSTRIP/tabpT\\02/ssubSUB_DATA:SAPLITO0:0102/subSUB_0102B:SAPLITO0:1051/subSUB_1051A:SAPLIPAR:0130/subADRESSE:SAPLIPAR:0122/ctxtDIADR-REGION").text, ",", session.findById("wnd[0]/usr/tabsTABSTRIP/tabpT\\02/ssubSUB_DATA:SAPLITO0:0102/subSUB_0102B:SAPLITO0:1051/subSUB_1051A:SAPLIPAR:0130/subADRESSE:SAPLIPAR:0122/txtDIADR-POST_CODE1").text);

address=address.replace(/ /g,'+');

session.findById("wnd[0]/usr/htmlViewerPersonas_2").url="https://www.google.com/maps/embed/v1/place?key=Your_GMaps_API_key&q=".concat(address);

Then you run this script onLoad and you get the map according to the address on the screen.

Show 1 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Forgot to reply earlier. This works great, thanks Tamas!

0