YOUR FEEDBACK
andy.mulholland wrote: intriguing !!! We have full scale 'Mashup Factories' in Chicago USA and Utrec...
AJAXWorld RIA Conference
Early Bird Savings Expire Friday Register Today and SAVE !..


2008 East
DIAMOND SPONSOR:
Data Direct
Frontiers in Data Access: The Coming Wave in Data Services
PLATINUM SPONSORS:
Red Hat
The Opening of Virtualization
Intel
Virtualization – Path to Predictive Enterprise
Green Hills
IT Security in a Hostile World
JBoss / freedom oss
Practical SOA Approach
GOLD SPONSORS:
Software AG
The Art & Science of SOA: How Governance Enables Adoption
PlateSpin
Effective Planning for Virtual Infrastructure Growth
Fujitsu
Automated Business Process Discovery & Virtualization Service
Ceedo
Workspace Virtualization
Click For 2007 West
Event Webcasts

2008 East
PLATINUM SPONSORS:
Appcelerator
Think Fast: Accelerate AJAX Development with Appcelerator
GOLD SPONSORS:
DreamFace Interactive
The Ultimate Framework for Creating Personalized Web 2.0 Mashups
ICEsoft
AJAX and Social Computing for the Enterprise
Kaazing
Enterprise Comet: Real–Time, Real–Time, or Real–Time Web 2.0?
Nexaweb
Now Playing: Desktop Apps in the Browser!
Sun
jMaki as an AJAX Mashup Framework
POWER PANELS:
The Business Value
of RIAs
What Lies Beyond AJAX?
KEYNOTES:
Douglas Crockford
Can We Fix the Web?
Anthony Franco
2008: The Year of the RIA
Click For 2007 Event Webcasts
SYS-CON.TV
POWERBUILDER LINKS YOU MUST CLICK ON


A Real-Time Physical Inventory Solution Using PocketBuilder, ASA, and a Wi-Fi Connection
A case study: A physical inventory count is necessary to reconcile the quantity on hand stored in a database

Step 5: Connect to your database
In the open event of the application object, connect to your database and open your main window:

SQLCA.DBMS='odb'
SQLCA.DBPARM="ConnectString='DSN=blwmed;UID=dba;PWD=sql'"
CONNECT USING SQLCA;
If SQLCA.SQLCODE <> 0 then
    Messagebox("Connect Error", SQLCA.SQLErrText)
    Halt Close
End If

Open(w_main)

Step 6: Write code to initialize the bar code scanner
PocketBuilder has native hardware support for the PPT8800 called SymbolBarCodeScanner. Drop one in on your main window and call it bar_code.

Add your initialization code to a ue_postopen event:

bar_code.Open()
bar_code.ScanNoWait()

Step 7: Create a GUI
Note: The information that is retrieved when you scan a bar code is typically the SKU. The title, author, and quantity are retrieved from the database using the SKU as a key. Though not technically necessary (we really only need SKU and quantity to perform the update), it's a nice touch for the user. It is populated in the cb_ok clicked event as part of processing the SKU (See Figure 4).

Step 8: Code for the ScanTriggered event


int iRet
string stmp
iRet = This.RetrieveData()
If iRet = 1 Then
stmp = This.ScannedData
sle_sku.Text = stmp
cb_ok.TriggerEvent('clicked')
End If
iRet = This.ScanNoWait()
Notice, we must specifically state what field we want to put the scanned data into. This is not the case with the Y cable scanners you might have seen at POS stations. These typically emulate the keyboard so it is possible to scan into any text field without further coding. This is not the case with the Symbol.

Step 9: Process the scanned data in the clicked event of CB_OK


String ls_text
Integer li_scanned
Datastore lds_Item
Long ll_rowcount

ls_Text = Upper(Trim(sle_sku.text))
li_scanned = Integer(sle_scanned.Text)

lds_Item = CREATE datastore
lds_Item.dataobject = 'd_inventory'
lds_Item.SetTransObject(SQLCA)

ll_RowCount = lds_Item.Retrieve(ls_Text)
If ll_RowCount <= 0 Then
MessageBox(is_ModuleName, 'Item Not Found')
sle_sku.text = ''
Return 1
End If
st_title.text = lds_Item.GetItemString(1, 'in_title')
st_author.text = lds_Item.GetItemString(1, 'in_author')
st_qty.text = String(lds_Item.GetItemNumber
(1, 'in_qty_onhand')+ li_scanned)

UPDATE "group1"."inventory_tb"
SET "in_qty_onhand" = "in_qty_onhand" + :li_scanned
WHERE "group1"."inventory_tb"."in_isbn" = :ls_text;
If SQLCA.SQLCode <> 0 Then
MessageBox(is_ModuleName, SQLCA.SQLErrText)
Return -1
Else
COMMIT;
End If

DESTROY lds_item

Return 1
Step 10: Cleanup
In the close event of the main window, release the bar code scanner object:

bar_code.Close()

In the close event of the application object, disconnect from your database:

DISCONNECT USING SQLCA;

Simple. We're done.

Wondering how to learn more? Check out the following links. One of particular interest to the SymbolBarcodeObject is the mobility kit. Here you can find just about anything you want to do with bar codes. These would be implemented as external function calls in PocketBuilder. If you are looking for examples, see Reed Shilt's original implementation of the SymbolBarcodeObject on CodeExchange. Note: Most of these require a handle to the bar code object. This can be obtained by using the DeviceHandle() method.

Resources

About Deanne M. Chance
Ms. Chance graduated in 1996 with a degree in computer science from the University of Illinois. She has been a frequent contributor to the PowerBuilder Developer's Journal and gave a key presentation at Sybase TechWave 2005 entitled "A Real-Time Physical Inventory Solution Using PocketBuilder ASA and a WiFi Connection." She has held several engineering positions, starting a career at Motorola where she focused on mobile I.P. by doing real-time embedded programming for the base radio controller group as part of the iDEN/Nextel project.

YOUR FEEDBACK
SYS-CON Australia News Desk wrote: Why do a physical inventory? A physical inventory count is necessary to reconcile the quantity on hand stored in a database versus what is really on the shelf. In a retail environment, this process is typically done once a year. In a perfect world, these values would always be in sync.
Chance wrote: Pardon me I meant to say PocketBuilder, not Powerbuilder!
Chance wrote: One other note, I make a reference to using the DeviceHandle() method to get an instance handle to the barcode object. Although this is valid for version 1.5x in later versions of Powerbuilder it has been changed to the read only property DeviceHandle
Chance wrote: Hi this is Chance. I noticed the author of this article is Ch Chance. This is somewhat amusing as I use to suffer from a serious stuttering problem. However, no more. So, I was wondering could you change that to Written by: Chance Thanks!!!!!
PBDJ LATEST STORIES . . .
Virtualization is actively being used by Sybase IT to help solve power/cooling issues as well as transform the datacenter into an environment that brings greater benefits to their customers, especially the engineering organization. Average CPU utilization was very low on physical serve...
Must have at least 5 years of recent experience (within the last 7 years) in building, testing, and supporting complex (multiple interfaces with database(s) and other applications) and mission-critical Windows applications using PowerBuilder. Must have at least 5 years of experience wr...
Join Scott Guthrie as he discusses Microsoft’s commitment to web standards development, Rich Internet Applications and how Microsoft is contributing to help move the web forward. Join Adobe’s Kevin Lynch as he demonstrates how Flash and HTML come together to make the most engaging,...
Particularly in a means of moving PowerBuilder applications to the web. What I’m looking for doesn’t require a server license or the installation of unmanaged code to the web server, and works well across different browsers (not just Internet Explorer). The WPF DataWindow will help...
"The rise of Enterprise Architecture is proof that organizations need to manage the impact of changes in competition, technology and regulations across their enterprise," said Dan Lahl, director of Intelligent Enterprise for Sybase. "PowerDesigner 15's unique Link and Synch technology ...
With PowerBuilder 11 Sybase gave developers what we have long hoped for – the possibility of taking an application created in a client/server architecture and turning it into a Web application, almost without having to move the code; and it's better if you don't use a server applicat...
SUBSCRIBE TO THE WORLD'S MOST POWERFUL NEWSLETTERS
SUBSCRIBE TO OUR RSS FEEDS & GET YOUR SYS-CON NEWS LIVE!
Click to Add our RSS Feeds to the Service of Your Choice:
Google Reader or Homepage Add to My Yahoo! Subscribe with Bloglines Subscribe in NewsGator Online
myFeedster Add to My AOL Subscribe in Rojo Add 'Hugg' to Newsburst from CNET News.com Kinja Digest View Additional SYS-CON Feeds
Publish Your Article! Please send it to editorial(at)sys-con.com!

Advertise on this site! Contact advertising(at)sys-con.com! 201 802-3021


SYS-CON FEATURED WHITEPAPERS

ADS BY GOOGLE
BREAKING POWERBUILDER / SYBASE NEWS
Medmatics, LLC, a leading vendor of on-demand, anticoagulation software for private practices and ho...