Sum in Android

Leo Lobo

New Member
Hi , I have as APP with a session where I read RFID tags to count our stock . it has a lookup table where Code Is the Main Code , the EPCs are the Tags and product Name Is the description like below
Code EPC. Product Name
1000. 0001. Soccer ball
1000. 0002. Soccer ball
1000. 0003. Soccer ball
What I want is to have a Grid that shows a result like below

Product Name Qty
Soccer ball 3

I use an Android Tablet and as Android works different from Win Mobile What suggestion can I have To make this happen ?
 

OliverR

Member
Hi, I did some testing and it seems Leo Lobo is right. The SUM field in a cached grid doesn't seem to work in Android, or at least not with the settings that work in Windows Mobile.

I'm also curious to know if there is a solution for this.
 

James

Member
I couldn't do it with a cached grid, but after a GridPost you can use SQL magic and a "holder" session to display counts in a live grid.

Use Session1 as a lookup session, Session2 as main scanning session, Session3 as scratch session. Session3 can be disabled to not clutter the launcher.

Session1 fields: Code, EPC, Product Name
Session2 fields: EPC, Product Name w/lookup to Session1
Session3 fields: Product Name, Quantity Found

Everything is done from the Session2 form. Controls needed: EPC field, Product Name field, Cached grid, GridPost button, Live grid, Refresh button. Configuring the EPC and Product Name fields, the cached grid, and the GridPost button is left as an exercise to the reader.

Set the Live grid's source to Session3 with columns for Product Name and Quantity Found. The Refresh button should refresh the live grid.

In the form logic, create two OnClick rules for the Refresh button to ExecuteSQL. The first is

DELETE FROM Session3;

The second is

INSERT INTO Session3(Field1, Field2) SELECT DISTINCT Field2, COUNT(Field2) FROM Session2 GROUP BY Field2;

After doing a GridPost, click the Refresh button and it will update to reflect the counts of each Product Name in Session2. I've run into race conditions with SQL and live grids, so you may have to wait a few seconds before clicking Refresh to see the data.

Going through the video tutorials might yield a simpler method. I think one of them talked about incrementing/decrementing counts as scans are being done.
 

Leo Lobo

New Member
James Thanks for your attention
As I am a New user Is it possible To send me the TPE
So I can look the APP !
 

James

Member
I deleted the project I did earlier. I threw this together but didn't load it on the handset - let me know if I fudged a setting.
 

Attachments

Top