Chapter 3 - PixieWeb Documentation:
Example "StockByCode" introduces:
"StockByCode" is one of the demos running on our webserver at http://mail.thetotal.co.nz:7301
The user enters a stock code eg 1011, 1012 ... which is the stock Item ID and the app returns enquiry details. This is probably an Intranet rather than Internet app because it requires users to already have some pre-knowledge of the codes. It could however be of wider use over the Internet for customers getting info updates eg quantities available.
Our scripting technique for legacy programs is based on the way that they deliver information to terminals with (x,y) style column and row values for each item of text information..
eg Our STOCK STATUS ENQUIRY program in its original state (part of screen
shown)

The Description "Mouse Pad" is displayed in column 22 of line 4, ie at screen
co-ordinates (22,4). So the not-so-daunting programming you need to script to
extract that description, looks like this:
Pixie.ItemLeft = 22 Pixie.ItemTop = 4 Pixie.ItemGet sDescription = Pixie.Response
To make use of an existing enquiry program on the Web, run it and look for where on the screen your information is. Our "PixieWeb" product includes a "PixiePeekaboo" utility for this purpose. This will give you the co-ordinates of each item of information for your ASP script.
Improved presentation for ASP output.
This example makes use of PixieWeb's FileGetText method to load a prepared
presentation template.
For "StockByCode.asp", here is what we have drawn up in
"Frontpage" and saved as "StockByCodeTmt.htm"
Note the placeholders, "PRODCODE" etc to be replaced by values of string
variables.
| You entered a product code of: | [--PRODCODE--] |
| Description: | [--DESCRIPTION--] |
| Selling Price: | [--SELLPRICE--] |
| Bin Location: | [--BINLOCATION--] |
| Stock On Hand: | [--STOCKONHAND--] |
| Committed: | [--COMMITTED--] |
| On Order: | [--ONORDER--] |
Here is the resulting StockByCode.asp
<% '-- ASP Visual Basic script to handle I/O ' to IPLUS Program U200M via communications module PixieWeb.dll ' ' The script-level program, here listed first, does a partial ' validation of user input variable vProdCode. ' It then checks the state of "PixieWeb" and if available, ' transmits the user input. Timeout is handled in module ' "PixieWeb.dll" by it setting a state of "ERROR" ' ' Sub Step2 collects any valid response from "PixieWeb" and ' delivers the formatted output to the User. ' ' 990909 JPC Bring in use of Pixie.FileGetText ' with StockByCodeTmt.htm template file ' 981219 JPC Adapt for major change to PixieWeb.dll
Dim Pixie
Response.Expires = -1
Set Pixie = Server.CreateObject("PixieWMA.clsAgent")
Pixie.ExecuteCompareMethod = 1
Pixie.TimeOut = 8
Pixie.Port = 23
Pixie.Host = "127.0.0.1"
Call Pixie.Connect ("{AUTO}")
Call Pixie.ExecuteET("john", ":")
Call Pixie.ExecuteET("john", "<<< Pick Systems")
Call Pixie.ExecuteET("term mm-mon", ":")
Call Pixie.ExecuteET("echo off", ":")
sProdCode = Trim(Request.Form("sProdCode"))
'-- Now start the PICKBASIC program U200M
Call Pixie.ExecuteET("U200M", "MASTER STOCK STATUS ENQUIRY")
If Pixie.State = "ERROR" Then
sMsgErr = "<H2>ERROR in database communication <BR>" _
& "at first step of calling program U200M<BR><BR>" _
& Pixie.Response & "</H2>"
Call ErrorRoutine(sMsgErr)
Else
Call Pixie.ExecuteET(sProdCode, Chr(27) & "*(" )
If Pixie.State = "ERROR" Then
sMsgErr = "<H2> ERROR in database communication,<BR><BR>" _
& Pixie.Response & "</H2>"
Call ErrorRoutine(sMsgErr)
ElseIf Instr(Pixie.Response, "INVALID PRODUCT CODE") > 0 Then
'-- ASP script now simulates a terminal user making a tidy escape
Call Pixie.ExecuteET("", Chr(27) & Chr(22) & Chr(3))
Call Pixie.ExecuteET("x", ":")
sMsgErr = "<H2>ERROR: "INVALID PRODUCT CODE"<BR><BR>" _
& Pixie.Response & "</H2>"
Call ErrorRoutine(sMsgErr)
Else
Call Step2
End If
End If
'End of "script-level" ie main program
'-------------------------------------------------------------
Sub Step2 '-- The response from Pick is now available from Pixie
Pixie.FormAnalyse
Pixie.ItemTop = 4 Pixie.ItemLeft = 22 Pixie.FormItemGet sDescription = Pixie.Response Pixie.ItemTop = 5 Pixie.ItemLeft = 22 Pixie.FormItemGet sSellPrice = Pixie.Response
Pixie.ItemTop = 6 Pixie.ItemLeft = 22 Pixie.FormItemGet sBinLoc = Pixie.Response
Pixie.ItemTop = 12 Pixie.ItemLeft = 11 Pixie.FormItemGet sStockOnHand = Pixie.Response
Pixie.ItemTop = 12 Pixie.ItemLeft = 31 Pixie.FormItemGet sCommitted = Pixie.Response
Pixie.ItemTop = 12 Pixie.ItemLeft = 51 Pixie.FormItemGet sOnOrder = Pixie.Response
'-- Technique of substituting lookup values into an .htm template
' File StockByCodeTmt.htm is a design template with text placeholders
' eg "PRODCODE" which are then replaced by variable values.
s = Pixie.FileGetText("C:\InetPub\wwwRoot\PixieInfo_asp\StockByCodeTmt.htm")
s = Replace(s, "[--PRODCODE--]", sProdCode)
s = Replace(s, "[--DESCRIPTION--]", sDescription)
s = Replace(s, "[--SELLPRICE--]", sSellPrice)
s = Replace(s, "[--BINLOCATION--]", sBinLoc)
s = Replace(s, "[--STOCKONHAND--]", sStockOnHand)
s = Replace(s, "[--COMMITTED--]", sCommitted)
s = Replace(s,
"[--ONORDER--]", sOnOrder)
Response.Write s
'-- Quit from PICKBASIC Program U200M
Call Pixie.ExecuteET("q", "You have elected to ESCAPE. Are you quite sure ?" )
Call Pixie.ExecuteET("y", "Bin Location" )
Call Pixie.ExecuteET("x", ":" )
'-- End of Sub Step2 End Sub
'------------------------------------------- Sub ErrorRoutine(sMsgErr) Response.Write "<HTML><BODY>" Response.Write "<P><CENTER>" Response.Write sMsgErr Response.Write "</CENTER></P>" Response.Write "<P><A HREF=""stockbycode.asp"">" Response.Write "Try again</A>" Response.Write "<P><A HREF=" http://www.pixieware.com">" Response.Write "Back to PixieWare Home Page</A></H2></BODY></HTML>" End Sub ' '-- END of script StockByCode.asp %>
Next: Chapter 4 , the "Book Catalog", which introduces "Drill down" technique and more presentation methods eg pictures of items.
Appendix: summarises PixieWeb object properties and methods.
Chapter 1
Chapter 2 ** Top **
Chapter 4
Chapter 5
Chapter 6
Chapter 7
Appendix
Site Map