NetTalk Central
NetTalk Web Server => Web Server - Ask For Help => Topic started by: seanh on October 15, 2022, 11:22:22 PM
-
So a simple POS situation.
Invoice header, invoice lines.
I'm trying to use a barcode scanner to enter the information and go to the next line.
Lines have a Stock item. Stock item has Guid (PK) Tenant_id, Barcode I want to store the guid in the line.
Bar code may be in use by multiple tenants so is non-unique.
I'm logged in under a tenant. I want to enter the barcode via the scanner, which enters the code followed by an enter key.
I can get this to work if I do a lookup by clicking, but I can't figure out how to make it work entering the barcode via scanner
Any pointers would really help
-
Hi Sean,
It's really hard to follow what you are doing, what you are seeing, and what you are hoping for.
Perhaps make a simple example? The Books (71) example is likely a good palace to start?
Cheers
Bruce
-
I've altered the Books example that I hope will show the problem
Fields added on Product: Tenant_id Barcode
Those 2 are also in a unique Key. Note that 2 tenants may have the same barcode.
The file has been Altered to make Tenaant_id= A and Barcode = id * 100
On Line Item I added a Name which is the product name
I altered the updateLineItem form and changed the product id bit
What I want to acheive:
When adding an Line Item to be able to enter the barcode and immediately press enter (thus simulating a barcode scanner) and have the fields all filled and the form saved.
At the moment it just looks at you and I'm sure it's wrong but I'm too inexperienced to figure out where, if I need more fields or what.
-
I went to the Update Line Items form.
Focus is on the Product field.
Simulated the barcode reader by pressing "6" on the keyboard, then Enter.
Enter triggers the Save button, which is expected as it has "Save form on enter" set.
When inspecting the record I see that the correct product (Draw, ID 6) was captured.
The Name and RRP fields are empty. (Because the "save" happened before the "Additional fields").
I turned off "Save form on Enter".
Now if I press say 7, Enter then the Message Box product appears, and the other fields are filled in.
I guess if there's something wrong in all of that, you need to walk me through what you are wanting to do differently, and what you are wanting to see.
Cheers
Bruce
-
I think the problem is that there is no barcode with just "6" There is a "600"
There is a 6 in the ID field that is likely being used to look it up.
So if you could enter "600" and Enter and Get Draw and 1 Item added, thats what I want.
I only get a blank line
-
So you have a multi-component description field key;
Desc field: Pro:Barcode
Key: Pro:Tenant_id, Pro:Barcode
In this case you need to make sure the SessionValue of the higher components is set before GetDescription is called.
So in
Validate::LIN:Product Routine
before any call to GetDescription
p_web.SSV('PRO:Tenant_id','A')
cheers
Bruce
-
No, I'm still misunderstanding something along the way. I've done that and I still get just a blank line.
So to be clear To lookup the Product I Need 2 fields PRO:Tenant_id + PRO:Barcode
The field to Assign the product is PRO:ID
The Description is PRO:Barcode
-
Sean,
Not sure whether I understand your situation.
But I've had cases (not barcode, just regular lookups) where I needed a two-part lookup key (i.e., practice ID and provider ID).
I've found I needed a single-component key to make this work.
Since I'm using SQL, in my case it's easy to create a computed column
CAST(p.contextId AS VARCHAR(6))+'|'+CAST(p.providerId AS VARCHAR) AS ID
Then I put a key on that in the Clarion dictionary and it works fine. Simple to write a function that splits that ID into its two constituent pieces when needed.
JAT...
Jane
-
The SSV is correct - one just has to do it "more often" - ie before every place a GetDescription occurs.
(or, for simplicity, at the top of the procedure.)
Cheers
Bruce
-
Jane
I'm attempting to create a simple POS system that works similar to your average supermarket, You start a docket and then just scan items until you're done.
My problem is that because I'm Multi-tenant the codes for the items are only unique to the tenant. There is a unique id for the item, but the lookup has to be on the tenants code and must exclude other tenants stuff.
So that complication along with my inexperience with nettalk server (this is like my 4th project and the most complex by far) is causing me all sorts of headaches!
Bruces solution is sort of working. At least I get the look ups to work. so I'm getting there. I need it to now just save and move to insert the next line.
-
Hi
If I am understanding your problem correctly this is how I do this.
MultiTenant - You select and open the file for that tenant. ( I guess you have that working)
Create a Memory Form.
Add a ScanItemFiled. (to read the barcode or keyboard entry)
Add a Procedure BrowseItemsScanned. - (to show Item scanned)
After you scan the barcode your code gets the record from Mutli Tenant data and saves to the ViewseItemsScanned.
At the end of you code
Refresh the BrowseItemsScanned
Jump back to the ScanItemFiled. - p_web.SetValue('SelectField',clip(loc:formname) & '.' & p_web.NoColon('ScanItemFiled'))
Just an Idea.
-
@Vinnie That sounds a lot more like what I'm after.
I'm not so sure about creating such a thing, But I'll have a go.
Your ScannedItemField is that a local var? or something else?
Where abouts do you embed code to create the item?
Sorry for the newby type questions
-
Hi Sean,
I am happy to help.
This is what I do.
NetwebForm - (Memory)
Create Local Variable - ScannedItemField (name as your require - string 30)
Create Local Variable - EmptyField ((name as your require - string 1)
Note the extra field is only there so after the first field completes focus moves to the extra hidden field. You move the focus back to the first field later.
Not 100% sure all this is required now but I have done it this way for so long.
Add Local Variable ScannedItemField to NetwebForm - Type String
Add Local Variable EmptyField to NetwebForm - Type Hidden
Add Procedure to NetWebForm - BrowseProcedure - Show the data entred.
code for ScannedItemField
Use NetTalk Template - on ScannedItemField - Client-Side tab - Server Code - ( I guess you know this)
Do Your code -
If Left(p_web.GetSessionValue('ScannedItemField'),3)='200'
Access:Scanned.Open()
Access:Scanned.UseFile()
Clear(SCA:Record)
SCA:GUID = Glo:ST.MakeGuid()
SCA:ScanDate = Today()
SCA:ScanTime = Clock()
SCA:ItemScanned = p_web.GetSessionValue('ScannedItemField')
Access:Scanned.TryInsert()
Access:Scanned.Close()
End !If Despatch Note
You can play a sound of Good or Bad entry - you make the sounds
p_web.Script('ntPlay("/sounds/good.mp3");')
or
p_web.Script('ntPlay("/sounds/bad.mp3");')
Refresh the BrowseProcedure - Use NetTalk Template
Save Form
Look at Code using Embeditor - Find your code and add the bottom line after to BrowseRefresh template code. Ie next embed point down.
do Refresh::ItemsInThisBox !(GenerateFieldReset)
p_web.ntForm(loc:formname,'ready')
! Start of "After Validate New Value, After sending replies"
! [Priority 5000]
p_web.SetValue('SelectField',clip(loc:formname) & '.' & p_web.NoColon('ScannedItemField')) !! This puts the focus back to entry field
Hope this give you an idea but if not I can make an example but good to try yourself.
Cheers
Vinnie
-
Vinnie
Thank you for such a detailed explanation! I'll most definatly have a stab at this and report back.
Sean H
-
Vinnie
Thanks for the explanation, after a couple of trials I got it working pretty much the way I wanted.
Thank you so much for your help, which was wonderful!
Sean H
-
Hi Vinnie, what version of NT are you using for this? i have a similar approach and after moving to 12.55 everything is broken, did you move to 12.55?
up to version 12.50 everything works fine
-
after reinstalling NT it started working fine