AMX I!-DATABASEPLUS AND DBWIZARD Instruction Manual
AMX I!-DATABASEPLUS AND DBWIZARD Instruction Manual

AMX I!-DATABASEPLUS AND DBWIZARD Instruction Manual

Integration!solutions

Advertisement

Quick Links

instruction manual
i!-DatabasePlus and
DBWizard
i n t e g ra t i o n ! S o l u t i o n s

Advertisement

Table of Contents
loading

Summary of Contents for AMX I!-DATABASEPLUS AND DBWIZARD

  • Page 1 instruction manual i!-DatabasePlus and DBWizard i n t e g ra t i o n ! S o l u t i o n s...
  • Page 2 CUSTOMER REMEDIES. AMX Corporation’s entire liability and your exclusive remedy shall be, at AMX Corporation's option, either (a) return of the price paid, or (b) repair or replacement of the SOFTWARE that does not meet AMX Cor- poration's Limited Warranty and which is returned to AMX Corporation. This Limited Warranty is void if failure of the SOFTWARE or hardware has resulted from accident, abuse, or misapplication.
  • Page 3: Table Of Contents

    Table of Contents Table of Contents Introduction .......................1 i!-DatabasePlus ......................... 1 DBWizard .......................... 1 Supported Operating Systems ..................1 Minimum PC Requirements ....................2 Installing i!-Database Plus....................2 Installing DBWizard ......................2 Setup ..........................3 Programming i!-Database Plus ................5 Data Source Name......................5 Structure Query Language (SQL) ..................
  • Page 4 Table of Contents Webserver path........................32 Absolute database path ......................32 NetLinx AXI file........................32 NetLinx local IP port ....................... 32 NetLinx code prefix ........................ 32 Encapsulate ........................... 32 Writing Your AXS File ..................... 33 i!-Database Plus and DBWizard...
  • Page 5: Introduction

    Introduction Introduction i!-DatabasePlus ™ ™ i!-Database Plus is an application that allows you to connect a NetLinx Master to a server or PC database. The kit consists of two files: NetLinxDBInclude.asp: A server database script designed to run on Microsoft web servers.
  • Page 6: Minimum Pc Requirements

    Introduction Minimum PC Requirements Windows-compatible mouse (or other pointing device) At least 5 MB of free disk space (150 MB recommended) VGA monitor, with a minimum screen resolution of 800 x 600 A Network adapter A Web server such as Personal Web Server (PWS) or Internet Information Server (IIS). ®...
  • Page 7: Setup

    Introduction Setup NetLinxDBInclude.asp and NetLinxDBInclude.axi work in conjunction with your code to allow access to a PC database. In order to use these two files, you will need the following: © A PC running a Microsoft Windows operating system such as Windows 95, Window 98, Windows NT Workstation, Windows NT Server, Windows 2000 Workstation or Windows 2000 Server.
  • Page 8 Introduction i!-Database Plus and DBWizard...
  • Page 9: Programming I!-Database Plus

    Programming i!-Database Plus Programming i!-Database Plus i!-Database Plus consists of creating three files: ASP file AXI file AXS file If you already used DBWizard to generate an include file, you can skip to Creating an AXS file section on page 15 to finish your programming. Prior to explaining how to program these files, a brief overview is necessary.
  • Page 10: Http, Cgi And Xml

    CGI parameters. The "&" is used to separate CGI parameters. So this URL contains two CGI parameters: the first is a CGI parameter called myname and contains a value of amx. The second is myhometown and contains a value of dallas. The CGI application on the web server has access to these variables and can use them to help understand the context in which the request was made.
  • Page 11: Xml (Extensible Markup Language)

    Programming i!-Database Plus The NetLinx Database Gateway uses CGI to pass the database request to the server script. Both the NetLinxDBInclude.axi and NetLinxDBInclude.asp must agree to use the same CGI parameters to pass this information. The standard set of CGI parameters they use are in the following table. CGI Parameters Parameter Parameter Name Description Notes...
  • Page 12 Programming i!-Database Plus <struct> <index>3</index> <var><name>TitleID</name><data>12328612</data></var> <array><name>Artist</name><string>Buffet, Jimmy</string></array> <array><name>Title</name><string>A-1-A</string></array> <array><name>Copyright</string><data>MCA</string></array> <array><name>Label</name><string>MCA</string></array> <array><name>ReleaseDate</name><string>1974</string></array> <var><name>NumTracks</name><data>11</data></var> </struct> </array> </rsHeader> pair indicates which query this represents: it is simply <rsHeader></rsHeader> an echo of the hdr CGI parameter. pair contains pairs which contain the <struct></struct> <var></var>...
  • Page 13: Creating An Asp File

    Programming i!-Database Plus Creating an ASP file All you need to do in your ASP file is include the NetLinxDBInclude.asp file, and call a single function, . There are only two lines of code: RunDBQuery <!-- #INCLUDE FILE="NetlinxDBInclude.asp" --> <% RunDBQuery "DeluxeCD.mdb", "" %> The first parameter is the name of a Microsoft Access database.
  • Page 14 Programming i!-Database Plus (***********************************************************) TYPE DEFINITIONS GO BELOW (***********************************************************) DEFINE_TYPE (* TITLES *) STRUCTURE _sDB_TITLES CHAR strArtist[128] CHAR strCopyright[128] CHAR strLabel[128] CHAR strReleaseDate[128] CHAR strTitle[128] SLONG slTitleID The next section creates NetLinx variables needed to store the data and connect to the database. variable contains information about the current database transaction, the location sDB_CLIENT of the web server database script.
  • Page 15 Programming i!-Database Plus Once the SQL has been generated, the request is entered into a queue to be sent to the web server. The parameters for are the queue structure for the connection, a tag, the SQL DB_ADD_TO_QUE statement and a list box structure. The tag will be returned by the web server to identify the results. Tags should be unique for every query or sets of queries generated.
  • Page 16 Programming i!-Database Plus ' VALUES (',$27,strArtist,$27,', ',$27,strCopyright,$27,', ',$27,strLabel,$27,', ', $27,strReleaseDate,$27,', ',$27,strTitle,$27,', ',ITOA(slTitleID),')'" (* SEND THE QUERY *) DB_ADD_TO_QUE(sDB_QUE,'TITLES',strSQL,sTempListBox) (*********************************************) (* NAME: DB_UPDATE_TITLES (***************************************************************************) (* Format query to update an entry to TITLES data (***************************************************************************) DEFINE_FUNCTION DB_UPDATE_TITLES(CHAR strArtist[128], CHAR strCopyright[128], CHAR strLabel[128], CHAR strReleaseDate[128],...
  • Page 17 Programming i!-Database Plus need to fill this out properly. See the section Putting It All Together section on page 28 for reference. Also, call to initialize your listbox. DB_LISTBOX_INIT (***********************************************************) STARTUP CODE GOES BELOW (***********************************************************) DEFINE_START (* INIT dB WEB CLIENT *) DB_INIT_CLIENT (sDB_CLIENT,dvDB_CLIENT,'192.168.12.175',80,'/dB/CDExample.asp') CREATE_BUFFER dvDB_CLIENT,sDB_CLIENT.strBUFF (***********************************************************)
  • Page 18 Programming i!-Database Plus packet, isolate the package and remove the data contained within. The <struct></struct> helper function removes the data for a given field name and returns the string DB_GET_XML_VALUE containing the data. All you need to know is the column name from that database and this function returns the data.
  • Page 19: Creating An Axs File

    Programming i!-Database Plus sDB_TITLES[nLIST_PTR].strArtist = DB_GET_XML_VALUE(strDB_RECORD,'Artist') sDB_TITLES[nLIST_PTR].strCopyright = DB_GET_XML_VALUE(strDB_RECORD,'Copyright') sDB_TITLES[nLIST_PTR].strLabel = DB_GET_XML_VALUE(strDB_RECORD,'Label') sDB_TITLES[nLIST_PTR].strReleaseDate = DB_GET_XML_VALUE(strDB_RECORD,'ReleaseDate') sDB_TITLES[nLIST_PTR].strTitle = DB_GET_XML_VALUE(strDB_RECORD,'Title') sDB_TITLES[nLIST_PTR].slTitleID = ATOL(DB_GET_XML_VALUE(strDB_RECORD,'TitleID')) lLOOP = FIND_STRING(sDB_CLIENT.strBUFF,'<struct>',nLAST+LENGTH_STRING('<struct')) IF (sTempListBox.snTOTAL > 0) sTempListBox.snTOTAL = TYPE_CAST(nLIST_PTR) DB_DISPLAY_TITLES(sDB_TITLES,sTempListBox) (* CLEAR BUFFER *) DB_ACK_QUE (sDB_QUE,sDB_CLIENT) CLEAR_BUFFER sDB_CLIENT.strBUFF The very last bit of code keeps your queue going.
  • Page 20 Programming i!-Database Plus The next section creates some variables you will need. Create a set to hold the buttons DEVCHAN which control the movement through the list. This action can be seen when you get to the section below. DEFINE_EVENT (***********************************************************) VARIABLE DEFINITIONS GO BELOW (***********************************************************)
  • Page 21 Programming i!-Database Plus FOR (; nLOOP <= sTempListBox.nDISPLAY_SIZE; nLOOP++) (* CLEAN UP EMPTY ENTRIES HERE *) SEND_COMMAND dvTP,"'!T',0+nLOOP,''" SEND_COMMAND dvTP,"'!T',10+nLOOP,''" SEND_COMMAND dvTP,"'!T',49,'Displaying ',ITOA(sTempListBox.snFIRST),'-', ITOA(sTempListBox.snLAST),' of ',ITOA(sTempListBox.snTOTAL)" SEND_LEVEL dvTP,1,sTempListBox.nLEVEL_VAL sTitleListBox = sTempListBox The next section creates a level for the scroll bar. Use this later to actively jump to any point in your list.
  • Page 22: Netlinxdbinclude.asp

    Programming i!-Database Plus TO[dcTITLES_CTRL[nIDX]] If you want to edit the database, you need to capture data from the user and call your other SQL building routines to send your request off to the server. NetlinxDBInclude.asp Functions The following table describe the functions contained in the NetlinxDBInclude.asp file. NetlinxDBInclude.asp Functions XMLTag The XMLTag function is used when converting record sets to XML.
  • Page 23 Programming i!-Database Plus RunDBQuery The RunDBQuery function is used to convert record sets to XML. Converts ADO RS to Syntax: XML. RunDBQuery( strDBPath, strProvider ) Variables: strDBPath = Represents the file path or DSN to the database. If the file has no path included, the path is assumed to be local in the same directory as the ASP file.
  • Page 24: Netlinxdbinclude.axi

    Programming i!-Database Plus NetlinxDBInclude.axi Constants All constants can be overridden by defining your own values in your program. NetlinxDBInclude.axi Constants Parameter Value Description Notes Passed IP_TCP (* TCP/IP COMMUNICATIONS *) IP_CLIENT_OPEN and IP_CLIENT_CLOSED. Time to wait for ASP to nDB_MAX_TIMEOUT = 60 (* MAXIMUM TO WAIT FOR XML process and return XML.
  • Page 25: Structures

    Programming i!-Database Plus Structures STRUCTURE _sDB_CLIENT CHAR strBUFF[10000] (* BUFFER FOR XML *) CHAR strQUERYSTRING[1000] (* QUERY STRING *) CHAR strWEB_SERVER[100] (* IP OR NAME OF SERVER *) CHAR strDB_ASP_FILE[100] (* FILE NAME/PATH OF DB ASP FILE *) INTEGER nWEB_PORT (* PORT WEB SERVER IS LISTENING ON *) CHAR strASP_COOKIE[300]...
  • Page 26: Functions

    Programming i!-Database Plus Functions The following table is a list of functions contained in the NetlinxDBInclude.axi. NetlinxDBInclude.asp Functions DB_ACK_QUE() The DB_ACK_QUE function is used to acknowledge the last message sent by the queue. It should be called whenever a message is properly processed in the Acknowledges the queue DATA_EVENT for the database server script connection.
  • Page 27 Programming i!-Database Plus NetlinxDBInclude.asp Functions (Cont.) DB_CHECK_QUE() The DB_CHECK_QUE function is used to watch the queue and send messages when the client is ready. It should be called once in DEFINE_PROGRAM. Sends the next command from the sDB_QUE to the Syntax: sDB_CLIENT database server DB_BUILD_HTTP_GET (_sDB_CLIENT sDB_CLIENT)
  • Page 28 Programming i!-Database Plus NetlinxDBInclude.asp Functions (Cont.) DB_GET_XML_VALUE() The DB_GET_XML_VALUE function is used to extract values from XML into NetLinx data structures only when not using XML_TO_VARIABLE. Extracts values from XML into NetLinx data Syntax: structures only when not DB_GET_XML_VALUE(CHAR strITEM_DATA[], CHAR strTAG[]) using Variable: XML_TO_VARIABLE.
  • Page 29 Programming i!-Database Plus NetlinxDBInclude.asp Functions (Cont.) DB_LISTBOX_INIT() The DB_LISTBOX_INIT should be called for all sDB_LISTBOX structures before use. Initializes an sDB_LISTBOX structure. Syntax: DB_LISTBOX_INIT(_sDB_LISTBOX sTempListBox, INTEGER DisplaySize, INTEGER nPanelIndex) Variables: sTempListBox = Represents the list box structure. (Required.) DisplaySize = Represents the size of page for the list box. (Required.) nPanelIndex = The index for the panel viewing data with this list box.
  • Page 30 Programming i!-Database Plus NetlinxDBInclude.asp Functions (Cont.) DB_PRINT_ERROR() The DB_PRINT_ERROR function is used to print any database script errors to the NetLinx terminal. This should be called whenever the XML stream from a web Extracts a database script server is processed. error from an sDB_CLIENT structure Syntax:...
  • Page 31 Programming i!-Database Plus NetlinxDBInclude.asp Functions (Cont.) DB_SCALE_SLIDER() The DB_SCALE_SLIDER copies the slider value to the sTempListBox structure. Calculates the slider Syntax: position, 0 - 255, for a DB_SCALE_SLIDER(_sDB_LISTBOX sTempListBox) given sDB_LISTBOX Variables: structure. sTempListBox = Represents the list box structure. (Required.) Return Values: DB_SCALE_SLIDER returns a number representing the position in the list, with a value of 0 - 255.
  • Page 32: Putting It All Together

    Programming i!-Database Plus Putting It All Together Once you have created all the files, it is time to put them to work. The first thing you want to do is put the database, the NetLinxDBInclude.asp file, and database server script in a path accessible by your web server.
  • Page 33: Running Dbwizard

    Running DBWizard Running DBWizard File Menu You can create, open and save DBWizard (DBW) files. The DBW file contains the database connection, all queries you have generated and all the information about the webserver connection and NetLinx code parameters. You can save your work in DBWizard; if you have a small change to make, you can add it to your existing database queries.
  • Page 34: Queries Tab

    Running DBWizard Queries Tab The Queries tab is where you build and decide how to access the database from NetLinx. On the left, you will see a set of tabs for Tables and Views. This represents the information contained in the database.
  • Page 35: File Tab

    Running DBWizard File Tab The options under the File tab allow you to control the NetLinx code (AXI file) and database server script (ASP file) that will be generated. The options are: ASP File Webserver Host name or IP Address Webserver IP Port Webserver Path Absolute Database Path...
  • Page 36: Webserver Path

    Running DBWizard Webserver path The path from the web server root where the ASP file will exist. This is the path relative to the web server root where the database and database server script will be placed. If you do not know where this will be yet, leave it blank. If you have control of the web server, enter a simple directory name that represents your application.
  • Page 37: Writing Your Axs File

    Running DBWizard Writing Your AXS File Now that DBWizard has generated the AXI file for you, you still have some work to do. The AXI generated by DBWizard now contains all the code necessary to read and write information to the database, as well as the basic infrastructure required to send your requests to the web server. However, you still need to decide when and what you need to write to and from the database.
  • Page 38 AMX reserves the right to alter specifications without notice at any time. brussels • dallas • los angeles • mexico city • philadelphia • shanghai • singapore • tampa • toronto* • york 3000 research drive, richardson, TX 75082 USA • 469.624.8000 • 800.222.0193 • fax 469.624.7153 • technical support 800.932.6993...

This manual is also suitable for:

I!-databaseplusDbwizard

Table of Contents