Creating an ASP Summary Page (ReadOnly) that Displays Data from an external Database using an ODBC driver e.g. Sage 100 ERP, formerly known as MAS 90

1 minute read time.

This article provides example code for building a Summary page that displays data from an external database table through an ODBC driver. I have used for this example a connection to a Sage ERP MAS 90 table.

I have assumed that you will have read the following articles

Below is an image of a search screen called from the main Summary page.

The code below shows how the Summary page can display the information in 3 different panels and also display summary information in the topcontent.

Because the data is in an external ERP system the default button that would allow edits to take place has been disabled.

<%

[code language="javascript"]
var strKeyID= "vendorno";
var Id = new String(Request.Querystring(strKeyID));
var intRecordId = 0;
if (Id.indexOf(",") > 0)
{
var Idarr = Id.split(",");
intRecordId = Idarr[0];
}
else if (Id != "")
{
intRecordId = Id;
}

if (!Defined(Id))
{
var Referer = Request.ServerVariables("HTTP_REFERER")+""
var RefererVariables = Referer.split("?");
var arrayKeys = RefererVariables[1].split(" &");
for (var i=0;i
{
var arrayValue = arrayKeys[i].split("=");
if (arrayValue[0].toLowerCase()== strKeyID.toLowerCase())
{
intRecordId = arrayValue[1];
}
}
}

if(!Defined(intRecordId))
{
Response.Redirect(CRM.URL("vendor/VendorList.asp"));
}

var myBlock = CRM.GetBlock("VendorDetailBox");
myBlock.Title = CRM.GetTrans("tabnames","company");
var myRecord = CRM.FindRecord("ap_vendor","vendorno='"+intRecordId+"'");

var TopContentBlock = CRM.GetBlock("Content");
TopContentBlock.Contents = "" ;

var addressBlock = CRM.GetBlock("VendorAddressBox");
addressBlock.Title = CRM.GetTrans("tabnames","address");

var phoneemailBlock = CRM.GetBlock("VendorPhoneEmailBox");
phoneemailBlock.Title = CRM.GetTrans("tabnames","PhoneEmail");

var myBlockContainer = CRM.GetBlock("Container");
with (myBlockContainer)
{
AddBlock(TopContentBlock);
AddBlock(myBlock);

AddBlock(phoneemailBlock);
AddBlock(addressBlock);
DisplayButton(Button_Default) = false;
}

CRM.AddContent(myBlockContainer.Execute(myRecord));
Response.Write(CRM.GetPage("ap_vendor"));
[/code]
%>