Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old July 16th, 2003, 07:53 AM
Anibal Hernande Anibal Hernande is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 33 Anibal Hernande User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Should I use a LOOKUP, a REGEX or what? How would you do it?

Gentlemen:

Could you let me know what strategy would you use for doing the following?

The Example Data shown below is being gathered from a Machine through the RS232 port into a RichTextBox1 in VB.NET

Once the Data is in the RichTextBox1 we need to parse it into Textboxes, which are labeled accordingly for the User to examine the collected data.

Once the Data is examined, the user clicks the SAVE button and the data is inserted into the Datagrid1 below on the same mainform1, thereby creating a new record entry in the Database.

Here is the explanation of The Example Data below; lets take line 8 as an example;

CA3*450*325*225*0*775*650*350*425

Each Asterisk separates a field name; there are 8 fields in this line.

Value 450 is field CA301
Value 325 is field CA302
Value 225 is field CA303
Value 0 is field CA304…. You get the idea?

QUESTION:
What technique would you use to parse these values into their corresponding Textboxes? Assuming that the name of the textboxes will be the name of the fields, example;

Textbox1 name = CA301
Textbox2 name = CA302
Textbox3 name = CA303…. You get the idea?

On a Separate Database we have the all the element definition for these fields.
CA301 Value of Cash In Since Last Reset
CA302 Value of Cash To Cash Box Since Last Reset
CA303 Value of Cash to Tubes Since Last Reset
CA304 Value of Bills In Since Last Reset
CA305 Value of Cash In Since Initialization
CA306 Value of Cash To Cash Box Since Initialization
CA307 Value of Cash To Tubes Since Initialization
CA308 Value of Bills In Since Initialization


Example Data

DXS*9259630004*VA*V1/1*1**
ST*001*0001
ID1*ªªªªªªªªªªªªªªªªªªªªªª*Merlinazary 4 67100-7 *701***
ID4*2*1*
ID5*990302*0634
VA1*0*0*0*0
VA2*0*0*0*0
CA3*450*325*225*0*775*650*350*425
CA4*0*0*0*0
CA7*0*0
DA2*0*0*0*0
TA2*0*0*0*0
LS*0100
PA1*1*50*
PA2*0*0*0*0
PA1*2*50*
PA2*0*0*0*0
PA1*3*50*
PA2*0*0*0*0
PA1*4*50*
PA2*0*0*0*0
PA1*5*50*
PA2*0*0*0*0
PA1*6*50*
PA2*0*0*0*0
PA1*7*50*
PA2*0*0*0*0
PA1*8*50*
PA2*0*0*0*0
PA1*9*50*
PA2*0*0*0*0
PA1*10*50*
PA2*0*0*0*0
LE*0100
EA2*CR**0
EA2*DO*2
EA3*0
EA7*9*9
MA5*BAUD*9600
MA5*SWITCH*UNLOCK*1,2*50*7,8,10
MA5*TUBE1**0
MA5*TUBE2*
MA5*SEL1*1,7
MA5*SEL2*2,8
MA5*SEL3*3
MA5*SEL4*4
MA5*SEL5*5
MA5*SEL6*6
MA5*SEL7*9
MA5*SEL8*10
MA5*SEL9*11
MA5*SEL10*12
MA5*SEL11*
MA5*SEL12*
SD1*000000000000
G85*75EC
SE*56*0001
DXE*1*1

Reply With Quote
  #2  
Old July 16th, 2003, 11:49 AM
unatratnag unatratnag is offline
Average Intelligence
Dev Shed Novice (500 - 999 posts)
 
Join Date: Apr 2003
Location: Ohio/Chicago
Posts: 678 unatratnag User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 10 m 22 sec
Reputation Power: 6
Send a message via AIM to unatratnag
if the fields are always in the same order, couldn't you just do a split?

array = split (instring, split_on)

Reply With Quote
  #3  
Old July 16th, 2003, 11:54 AM
Anibal Hernande Anibal Hernande is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 33 Anibal Hernande User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Unatratnag:

That will be real nice if all the fields were in the same order from machine to machine. Reality is that they are not. Therefore I have to rely on the field name in order to place it in the right textbox.

Do you have any idea my friend?

Andy

Reply With Quote
  #4  
Old July 16th, 2003, 12:01 PM
unatratnag unatratnag is offline
Average Intelligence
Dev Shed Novice (500 - 999 posts)
 
Join Date: Apr 2003
Location: Ohio/Chicago
Posts: 678 unatratnag User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 10 m 22 sec
Reputation Power: 6
Send a message via AIM to unatratnag
not understanding then i guess

ID1*ªªªªªªªªªªªªªªªªªªªªªª*Merlinazary 4 67100-7 *701***
ID4*2*1*
ID5*990302*0634


for the first one

ID101 = ªªªªªªªªªªªªªªªªªªªªªª
ID102 = Merlinazary 4 67100-7
ID103 = 701
ID104 and on = NULL

is this correct?

and for ID4, 3+ would be NULL?

Reply With Quote
  #5  
Old July 16th, 2003, 12:04 PM
Anibal Hernande Anibal Hernande is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 33 Anibal Hernande User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
unatratnag:

Exactly my friend!!! you got it!

Andy

Reply With Quote
  #6  
Old July 16th, 2003, 12:13 PM
unatratnag unatratnag is offline
Average Intelligence
Dev Shed Novice (500 - 999 posts)
 
Join Date: Apr 2003
Location: Ohio/Chicago
Posts: 678 unatratnag User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 10 m 22 sec
Reputation Power: 6
Send a message via AIM to unatratnag
hmm so.....


ID101 = ªªªªªªªªªªªªªªªªªªªªªª
ID102 = Merlinazary 4 67100-7
ID103 = 701

I don't understand how that will possibly correlate into

ID101 Value of Cash In Since Last Reset
ID102 Value of Cash To Cash Box Since Last Reset
ID103 Value of Cash to Tubes Since Last Reset

my first approach would have been to have just pulled it from the database, and have kept it in the recordset, and use that to know which column name goes into which text box. This isn't possible the way you're getting the info.

if you take the record set and move it to rich text format (the way you're getting it), it will still be in order pretty much, you would have to separate each field by a * though when making the text line....

since yours is not in order as you say (even though it seems to be 1-8 to me...), and a lot of those are just cash values, i'm not exactly sure how you can parse them out into corresponding boxes without there being a * to separate each value and there being an order to the line...... maybe i'm missing a key point here.....

Reply With Quote
  #7  
Old July 16th, 2003, 12:23 PM
unatratnag unatratnag is offline
Average Intelligence
Dev Shed Novice (500 - 999 posts)
 
Join Date: Apr 2003
Location: Ohio/Chicago
Posts: 678 unatratnag User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 10 m 22 sec
Reputation Power: 6
Send a message via AIM to unatratnag
wait a minute.... key point ascertained....

ok, so in a separate DB you have a table where there is a column ID101 and ID102 etc. and in a corresponding column you ave "used for this" or whatever function that value is right?

Reply With Quote
  #8  
Old July 16th, 2003, 12:26 PM
Anibal Hernande Anibal Hernande is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 33 Anibal Hernande User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
I have to apologize!!!


For some reason I misunderstood your “order” question.

YES the fields are Always in order, meaning that this line;

CA3*450*325*225*0*775*650*350*425

Will always be presented in this order:

CA301 (Value of 450 shown above) = Value of Cash In Since Last Reset
CA302 (Value of 325 shown above) = Value of Cash To Cash Box Since Last Reset
CA303 (Value of 225 shown above) = Value of Cash to Tubes Since Last Reset
CA304 (Value of 0 shown above) = Value of Bills In Since Last Reset
CA305 (Value of 775 shown above) = Value of Cash In Since Initialization
CA306 (Value of 650 shown above) = Value of Cash To Cash Box Since Initialization
CA307 (Value of 350 shown above) = Value of Cash To Tubes Since Initialization
CA308 (Value of 425 shown above) = Value of Bills In Since Initialization


The same thing happens for all other lines (which have different meanings of course) they will always have the same positioning sequencing.

When I meant not having order I refer to the entire file not being in order for example;

This line:
DA2*0*0*0*0
May or May not be followed by this one:
TA2*0*0*0*0

However, they do indeed have a field order positioning that does not change.

Does this make it better? Can we find a solution now?

Let me know pal!!

Reply With Quote
  #9  
Old July 16th, 2003, 12:43 PM
unatratnag unatratnag is offline
Average Intelligence
Dev Shed Novice (500 - 999 posts)
 
Join Date: Apr 2003
Location: Ohio/Chicago
Posts: 678 unatratnag User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 10 m 22 sec
Reputation Power: 6
Send a message via AIM to unatratnag
These seems odd to me, so you get the info, parse it, blah blah..

You'll have to query your database with the code and functions. I'm assuming that the ID1, and the CA3 are the primary keys, if not, just do the field that that is, and i hope you don't have duplicates of the value CA3 for something else... you shouldn't but just in case....

Case 1:
I assume you only have 8 fields on the form the text box goes and it fill thems one at a time from the input and the user verifys them one at a time, and then it's inserting this info into a different database or updating, whatever you're doing once they click.....so i don't know what the problem is with that?

Quote:
What technique would you use to parse these values into their corresponding Textboxes? Assuming that the name of the textboxes will be the name of the fields, example;

Case 2:
if this main form of yours has that many textboxes for each of the primary key + order num, pause for !?!?!?!?!! unpause i guess just insert them that way... that seems odd... split on * like before......you'd say the dbname & concatenated number field.value = array(concatenated number value)
then now you have a HUGE form with A LOT of info, and then you'd click the button and insert into DB after verification.

I hope that helps, this is kinda awkward for me so I guess i can't be much more help than that...

Reply With Quote
  #10  
Old July 16th, 2003, 12:50 PM
Anibal Hernande Anibal Hernande is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 33 Anibal Hernande User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
unatratnag:

Thank you so much for all the help provided. You have been great!!!

I will think about this problem a lot further and will try to simplify the whole process somehow. If you are able to drop me a line on my email anibal@telemetrika.com I will send you more details next week end.

Thanks pal!!!


Andy

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming > Should I use a LOOKUP, a REGEX or what? How would you do it?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway