ti.barcode module titanium. How to know if a coupon already exists for the item scanned at a store..??

You must Login before you can answer or comment on any questions.

Application type: mobile SDK: [INFO] Titanium SDK version: 2.1.2 (08/24/12 14:46 ed7f777) Platform & version: android 2.3 Device: Android Device Host Operating System: OSX 10.7.4 Titanium Studio, build: 2.1.2.201208301612

Hello guys... I have a query regarding "ti.barcode" module in titanium, actually i'm successfully scanning 'coupon' in my app, where 'coupon' code is being saved. Now i want to know if any user scans an "item" at a store in a market, is it possible to know whether 'coupon' for that "item" already exists or not..?? Thanks in advance... :)

— asked 8 months ago by Anuj Vashistha
1 Comment
  • I assume you are inserting a 'coupon' code into the DB. Simply search for that prior to insertion and do not duplicate if it exists.

    — commented 8 months ago by Nick The Geek

1 Answer

Hello Anuj, If your querying your scan against a database, you can simply do something like

var items = db.execute('SELECT * FROM tablename WHERE id='+idOfItem);
if(items.rowCount ==1) return true;

Your Answer

Think you can help? Login to answer this question!