Hi All,

We can integrate maps with axapta. Follow the intructions below.

create one form

Image

the control on which the maps would be shown is ActiveX control and the class name should be “Microsoft Web Browser”.

create a button and on click write down the following.

void clicked()

{

    #DEFINE.MapURL(‘http://maps.google.co.in?q=\%1’)
    #DEFINE.comma(‘ ‘)
    #DEFINE.newLine(‘\n’)

     str address;
    ;
    if (_address)
    {
        address = _address.Street + #comma +
        _address.City + #comma +
        _address.State + #comma +
       _address.ZipCode + #comma +
       _address.CountryRegionId;

       // Replace the newLine with comma
       address = strReplace(address, #newLine, #comma) ;
       //URL encode
       address = System.Web.HttpUtility::Url(address);
       //Add the address to the URL
       infolog.urlLookup(strfmt(#MapURL, address));
}

suppose _address is the table buffer.

the last line will open the browser and show you the map.

to show it on the form change the last line with the following code.

CtrlActivex.Navigate(strfmt(#MapURL, address));

so the form will look like this…..Image

Advertisements