Example of Comparing Two Barcodes

I do not user TP very often and am having difficulty getting my head around this. I am trying to create a very simple app that will read Barcode1, and then Barcode2. If they match, display a message with a green background that says 'Compare OK'. If they don't match, display a message that says 'Compare Failed' with a red background. No records need to be saved - it's a simple compare only. Once the compare has been done (regardless of result), there should be a 'continue' (clear screen and start again) or 'exit' button (revert to main TracerPlus entry screen.

Does anyone have an example of this? I have created something that goes part of the way, in that it has two fields to compare the barcodes, and displays a custom validation message in event of error, but nothing if it is OK. I can clear the screen and continue, and exit.

Many thanks
 

OliverR

Member
Hi Tom, I whipped something up real quick. TracerPlus doesn't allow to customize the background color of error messages (yet) so I worked around that by just directing the user to different tabs with different labels (those you can change the colors of) depending on the validation outcome, and then just 2 buttons like you described. I "designed" (if you can call it that with something this simple :) ) this for a Windows Mobile display, and tested it briefly. It seems to do what you want it to do.

I've attached a .tpe file that you can import into TracerPlus Desktop. Note that I made this with v9; this will not work on older versions of TracerPlus as it uses a couple of simple Form Logic rules.
 

Attachments

Hi Oliver

Thank you for your efforts - they are appreciated. I have managed to import your app. I had to make one change in that I set the Data Input Type for the two data fields to type 'barcode', otherwise the camera phone I am using (Sony Experia) didn't activate the camera. However, when running the app (using the camera) it scans a code, scans another, and another, and so on. It never compares the two scans.

I can see the form logic you have created but, as I have never seen TP form logic before, I am having difficulty understanding it. Can you explain it to me please?

Also, this application has to go on to an Android 1D laser device (so the camera phone will not be an issue - it's just that I don't have laser device available for development and testing). There is already a TP scanning app on the device that I developed a couple of years ago. I need to have both apps on the same device. Am I right in assuming that I have to merge the sessions from each into a single entity as only one instance of TracerPlus can exist on any device?

Many thanks

Regards

Tom
 

Dan Peluso

Member
Staff member
Hi Tom,

If you export your project in TP Desktop via the File-->Export option, you can attach it here and I can take a look.

For your 2nd question, it is **mainly** true that you would want to merge the sessions into one TracerPlus project to use the one instance of TracerPlus on the device. If there was a user access concern about the 2 different 'apps', you could look into using our user logins feature to control access for each user to only the sessions that are appropriate for them.

There is an alternative to the one instance of TracerPlus scenario. If you become a TracerPlus publisher, you can maintain your 2 projects on the same device as different apps altogether since the publisher feature allows for building a standalone Android application and even allows overriding of the TracerPlus branding (if that was an interest). There is an additional cost to the publisher feature but figured I would mention it.
 

OliverR

Member
Hi Oliver

Thank you for your efforts - they are appreciated. I have managed to import your app. I had to make one change in that I set the Data Input Type for the two data fields to type 'barcode', otherwise the camera phone I am using (Sony Experia) didn't activate the camera. However, when running the app (using the camera) it scans a code, scans another, and another, and so on. It never compares the two scans.

I can see the form logic you have created but, as I have never seen TP form logic before, I am having difficulty understanding it. Can you explain it to me please?
Hi Tom,

The form logic rules are as follows:
1) If the validation on Control ID 7 (ie. the 2nd barcode field) fails, the focus goes to Control ID 11 (ie. the 'compare failed' label on the 2nd tab)
2) If the validation on Control ID 7 is successful, the focus goes to Control ID 14 (ie. the 'compare OK' label on the 3rd tab)

The validation on the 2nd barcode field is set so that the 2nd field has to match the 1st field, and it's set to 'validate immediately' so as to trigger the appropriate form logic rule the moment a value is entered and in the 2nd barcode field.

As to why it is not working as it should on your phone, I'm guessing this might be because it's not triggering an after scan event, which means the field is never validated. And since the 2nd field keeps focus, your device will keep opening the camera to scan another barcode. As I said I created and tested this on a Windows Mobile device, it probably behaves slightly different on an Android phone without a proper scan engine. You could get it to work correctly on your phone with some more tweaking, but since you say the intention is to deploy this to a device with a 1D barcode scanner I would suggest testing and developing it on that (or a similar) device.
 
Hi Oliver

I got it working in another way, that did not involve multiple tabs. I now have access to the 1D scanner (I have it on load for a week). The only issues I now have are

1. I have an on-screen button called 'Start Again' that re-initialises the screen and passes focus back to the text box for Barcode1. This works, apart from the fact it insists on popping up the Android keyboard, which I don't want. It also happens when focus moves from Barcode1 to Barcode2. I can't find how to suppress it - I am not sure if this is in the device itself.
2. Just below the Barcode1 and Barcode2 text boxes is text box 'Result' which is empty with a white background. When Barcode2 has been read, the Form Logic checks to see if Barcode1=Barcode2. If it does it turns textbox 'Result' green and puts the word 'PASS' in it, otherwise it turns it red and puts the word 'FAIL' in it. This isfine, except the user can put the cursor in the 'Result' box and overtype what is there.

Any ideas?


Hi Tom,

The form logic rules are as follows:
1) If the validation on Control ID 7 (ie. the 2nd barcode field) fails, the focus goes to Control ID 11 (ie. the 'compare failed' label on the 2nd tab)
2) If the validation on Control ID 7 is successful, the focus goes to Control ID 14 (ie. the 'compare OK' label on the 3rd tab)

The validation on the 2nd barcode field is set so that the 2nd field has to match the 1st field, and it's set to 'validate immediately' so as to trigger the appropriate form logic rule the moment a value is entered and in the 2nd barcode field.

As to why it is not working as it should on your phone, I'm guessing this might be because it's not triggering an after scan event, which means the field is never validated. And since the 2nd field keeps focus, your device will keep opening the camera to scan another barcode. As I said I created and tested this on a Windows Mobile device, it probably behaves slightly different on an Android phone without a proper scan engine. You could get it to work correctly on your phone with some more tweaking, but since you say the intention is to deploy this to a device with a 1D barcode scanner I would suggest testing and developing it on that (or a similar) device.
 
Hi Tom,

If you export your project in TP Desktop via the File-->Export option, you can attach it here and I can take a look.

For your 2nd question, it is **mainly** true that you would want to merge the sessions into one TracerPlus project to use the one instance of TracerPlus on the device. If there was a user access concern about the 2 different 'apps', you could look into using our user logins feature to control access for each user to only the sessions that are appropriate for them.

There is an alternative to the one instance of TracerPlus scenario. If you become a TracerPlus publisher, you can maintain your 2 projects on the same device as different apps altogether since the publisher feature allows for building a standalone Android application and even allows overriding of the TracerPlus branding (if that was an interest). There is an additional cost to the publisher feature but figured I would mention it.
Hi Dan

I have got it working as a session within my customer's primary project, which is where it should be really, but I do still have a couple of issues:

1. I have an on-screen button called 'Start Again' that re-initialises the screen and passes focus back to the text box for Barcode1. This works, apart from the fact it insists on popping up the Android keyboard, which I don't want. It also happens when focus moves from Barcode1 to Barcode2. I can't find how to suppress it - I am not sure if this is in the device itself.
2. Just below the Barcode1 and Barcode2 text boxes is text box 'Result' which is empty with a white background. When Barcode2 has been read, the Form Logic checks to see if Barcode1=Barcode2. If it does it turns textbox 'Result' green and puts the word 'PASS' in it, otherwise it turns it red and puts the word 'FAIL' in it. This isfine, except the user can put the cursor in the 'Result' box and overtype what is there.

If you can help on this that would be great. Please note that I have put this in my answer to Oliver as well (still getting used to your forum, I'm afraid)
 

Dan Peluso

Member
Staff member
Hi,

Glad to hear you are close. Without seeing your project, here are a few suggestions.

1. If your project is configured to be an Android project by default (under the Project Tab properties), you will have an option avaialable to you for any text field on the form in the Form Designer. If you highlight the text box in the Form Designer, there is a property called "Hide Keyboard". If you set this option to "On Focus", it should prohibit the KB from popping up on a "Focus" event but should still popup when clicked into the field.

2. If this result field is a textbox, is there any reason you cannot make it a label? The form logic settings should still make it settable in that case but the user would not be able to set focus there. If you need to save this data, you can also use some other field to store this result but just don't make it accessible on the form. A text field can retain and save data even if it is not visible on the form.

Let me know if these options work for what you are trying to do.

Thanks.
 
Hi Dan

Thank you for the information. I tried both of your suggestions, without success, I'm afraid.

1. I have looked for the "Hide Keyboard" option before, as I had seen it in another post. My project is set to Android as the default, but I do not get the "Hide Keyboard" option displaying for text boxes. It is not the only one that is not displaying in my version (9.0.0.1158). According to the TP Desktop downloadable manual, I should be able to see Mask Input as well in the 'Selected Control Properties' window.

2. I added a label, as suggested, and changed the Action Control property to the Control ID of the new label, but it had no effect - the field never changed. I was not sure if I should change the property 'Data Driven' to True, but it required a source field setting (otherwise there was an 'Unhandled exception error' when saving it). I set it to Barcode 2 field as that is the one that triggers the validation logic. The result was that Barcode 2 field now never gets focus.

Is it possible to just export this 'Barcode Compare' session and rather than the whole project, so that it can be worked on independently - it would obviously have to be re-imported into the project afterwards?

Regards

Tom
 
Hi Dan

I have just searched the Help system within my version of TP Desktop, and there is no reference to 'Hide Keyboard'? Is my version out of date?

Regards

Tom
 
Hi Dan

I have just downloaded TP Desktop 9.5 and installed it and have found the 'Hide Keyboard' properties (evidently not in 9.1). I tested my application was working as before on the handset, and it was, before opening it on the PC in v9.5. I downloaded the app to the scanning device and now none of the Form Logic works, even the content is the same. Is there anything I need to do, or take into account if upgrading from 9.1 to 9.5? Do I need to upgrade the background app on the scanning device?

Regards

Tom
 

Dan Peluso

Member
Staff member
Hi,

No, there should have been no upgrade steps required from 9.x to 9.5. You are correct though that the Hide Keyboard option was likely added in 9.5. I don't recall specifically but that sounds about right.

If you want to attach your project via File-->Export menu option, I can take a look.
 
Hi Dan

I updated the TP Mobile on the scanning device and re-registered it and it all now works. Not sure what version the device was on, but it is now working - thanks for your help.

Do you know if it is possible to suppress session buttons from appearing on both the Data Entry and View Data screens? I have two sessions that are 'Data Entry' but no data is ever saved, so it is pointless (and confusing) having them on the View Data screen.

Many thanks

Regards

Tom
 

OliverR

Member
Do you know if it is possible to suppress session buttons from appearing on both the Data Entry and View Data screens? I have two sessions that are 'Data Entry' but no data is ever saved, so it is pointless (and confusing) having them on the View Data screen.
If those sessions never need to be opened I think you can just uncheck the 'Enabled' checkbox in TP Desktop next to the Session Name field at the top. This will stop them from being shown on the launcher screen, but you can still use them as lookup sessions if I'm not mistaken. It's been a long time since I used that option. Give it a try and see if it works.

Alternatively, if you have user logins enabled, you can just remove those two sessions from the available sessions list for all users, in the Admin tab of your Project properties. But that only works if you have logins enabled, so may not be an option for you.

EDIT: oh, I just realized that you only want to remove them from the 'View Data' screen, but not the 'Data Entry' screen. My suggestion is no good then, I apologize. You would have to edit the launcher file manually in a text editor to remove the sessions from just the 'View Data' screen, but I've never done this for Android applications so I can't give specific instructions for that.
 
Last edited:
I just tested what you suggested and it suppresses the session from both the Data Entry and the View Data screens (ie, disables them completely). I only want two of my sessions to be disabled from the View Data screen as there is no data view capability.
 

Dan Peluso

Member
Staff member
Hi,

One option for Android is to UNcheck the "Show View Data Tab" in the Launcher section. This will hide the Data View icons on the launcher screen for any sessions.

The other option is to manually modify the Launcher page directly and manually move that file over to your device. This launcher file is named Launcher.tac and is located on your PC under the deploy/skins folder of your root project location.
 
Top