User not logged in - login - register
Home Calendar Books School Tool Photo Gallery Message Boards Users Statistics Advertise Site Info
go to bottom | |
 Message Boards » » vb.net input string handling.. char replace ? Page [1]  
pilgrimshoes
Suspended
63151 Posts
user info
edit post

***probable noob question, plz lay off the flaming and csc cock waving***

ok, here's the scenario... I know it's long, and i'm probably noobin' up and missing something easy... but there are quite a few reasons I dont code for a living.

Application being ran on a mobile device with barcode scanner. application is functional for either barcode entry or manual entry through the onboard keypad.

three fields of importance to this question, we'll call them

Material type
box number
weight

all are handled as character strings, and all but weight can have either numbers or letters.

all of the barcodes have specific prefix characters used in another application (or from vendors) before they get here, ie: (555) or (9999), but are set for each feild.

prior to passing into the stored procedures, in the code behind (vb.net.... not by coice) i've been stripping the (xxxx) with a simple if InStr ( , "(555)") then replace with nothing... a particular parse for each of the fields, since the (xxxx) data was static.

HOWEVER, the barcodes have changed, and there's no longer the parenthesis..

so now the data inputs look like 5551234567 as opposed to (555)1234567

the issue with just stripping the first X chars off each input string is that if the application is being ran manually, the 555 would not be there. having the operator prepend with the appropriate prefix is not an option. so if the LEGIT weight is 5,557 kgs, the manual input would be 5557, and if stripping the first 3 chars if they are 555 would only insert a 7.

there's also no set length of any field.

did this app just get hosed by the data change?

I dont see a way that I can tell what type of input is being read... but if there's a way to tell if it's being scanned or through a keypad that'd be a route.


am i just missing something conceptually?

2/2/2008 12:36:39 PM

Stein
All American
19842 Posts
user info
edit post

Sounds like you can just use a regular expression to remove non-alphanumeric characters, then input the data.

2/2/2008 12:57:00 PM

pilgrimshoes
Suspended
63151 Posts
user info
edit post

there are no non-alphanumeric characters in the input string now.

perhaps that wasn't clear

before and easy to handle: (555)123789

now: 555123789

[Edited on February 2, 2008 at 1:15 PM. Reason : e]

2/2/2008 1:14:07 PM

volex
All American
1758 Posts
user info
edit post

do you have control over anything besides grabbing output from this "other application" ?

[Edited on February 2, 2008 at 2:21 PM. Reason : fix]

2/2/2008 2:19:10 PM

pilgrimshoes
Suspended
63151 Posts
user info
edit post

well the input is barcodes printed from the other appliation, hence no control over that.



i know it sounds convoluted.

[Edited on February 2, 2008 at 2:29 PM. Reason : thanks to those thus far for the time.]

2/2/2008 2:28:51 PM

HaLo
All American
14224 Posts
user info
edit post

if the legit weight is 5557 wouldn't the string be 5555557??

if so then you want to strip the 555 no matter what

2/2/2008 2:50:37 PM

LimpyNuts
All American
16859 Posts
user info
edit post

What he's saying is that if it was manually entered, then it has no prefix. Why not store a flag for data entries that are manually added for the time being, and then hire someone that knows what they're doing to redesign both programs?

The state of your system is going downhill fast. Trying to fix it with hacks is not going to help you in the long run.

2/2/2008 4:33:00 PM

volex
All American
1758 Posts
user info
edit post

if you aren't getting anything other than that number I'd say you need to get that intermediate program changed if possible... could you make people who enter things manually put some sort of flag at the beginning like * or # that would not conflict with the other codes?

2/2/2008 7:34:02 PM

Wolfmarsh
What?
5975 Posts
user info
edit post

I understand your issue.

if you are using the same text box for the barcode entry vs the manually keyed entry, what i would do is watch the changed event and measure the time span between two character entries.

The barcode scanner would input characters almost instantaneously, and the manual entry even a fast typer would have some lag between keystrokes.

This isnt the most optimal solution in the world, but it would be the easiest thing to implement fast.

[Edited on February 2, 2008 at 7:57 PM. Reason : .]

2/2/2008 7:56:01 PM

dakota_man
All American
26584 Posts
user info
edit post

I WAVE MY COCK AT THEE

2/2/2008 8:04:13 PM

oldman81
New Recruit
4 Posts
user info
edit post

Check the programming manual for the scanner (I'm guessing it's a Symbol or similar). Most of the time there is an option to cause the scanner to add a prefix or a suffix to each scanned barcode string. Pick a string, program the scanner to add it as a prefix and have your program look for that prefix to tell if manual or scan. (assuming everything you scan with this can deal with a prefix)

2/2/2008 8:34:51 PM

skokiaan
All American
26447 Posts
user info
edit post

whatever you do, pick a scheme that doesn't throw away data (such as your original thoughts).


Quote :
"then hire someone that knows what they're doing to redesign both programs"

2/2/2008 10:17:33 PM

 Message Boards » Tech Talk » vb.net input string handling.. char replace ? Page [1]  
go to top | |
Admin Options : move topic | lock topic

© 2024 by The Wolf Web - All Rights Reserved.
The material located at this site is not endorsed, sponsored or provided by or on behalf of North Carolina State University.
Powered by CrazyWeb v2.38 - our disclaimer.