[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

8.2

PABX String parsing in Delphi

Asked by PeterConradie in Delphi Programming

Tags: delphi, string

Hi All

I get the following output from a serial port of an LDK-100 PABX System Version LGE/GS90P-2.2Dh DEC/03
The output is intended for a dot matrix printer and prints about 50 lines and then outputs a LF/FF
to top of form and prints the page header as shown.

The lines containing data are all 95 characters long and if there is no data then the lines are padded out
to 95 characters with spaces. The 96th character is a cr/lf pair. Lines with less than 95 characters have no data
and must be discarded, including the page header and printer control characters like LF and FF. Valid strings
need to be parsed and split into fields to be written to a database for a call costing and reporting application.
The data is output one line at a time as each call in completed.

All the data is in columns. Assuming the first character is col 1, the data needs to be parsed as follows:

Col 1-4    Call Sequence Number
Col 5       Space
Col 6-10  PABX Ext Number
Col 11     Space
Col 12-14 Call Circuit Number
Col 15      Space
Col 16-23 Call Duration (hh:mm:ss)
Col 24      Space
Col 25-32 Call Date (dd/mm/yy)
Col 33      Space
Col 34-38 Call Time (hh:mm)
Col 39      Space
Col 40      I=Inbound/O=Outbound/t=Transferred (I/O/t) if O and number dialed is prefixed with 0 the call is long distance
               or if the number is prefixed with 08 or 07 the a mobile phone is being called. Anything else (1,2,3,4,5,6,7,8,9) is a local call
Col 41-58 Called Ext/Number Dialed
Col 59      Space
Col 60-62 Accounting Code
Col 63      Space
Col 64-68 Control Code
Col 69      Space
Col 70- 80 Call Cost
Col 81      Space
Col 82-93 Account Code
Col 94      Space
Col 95      Asterisk/Space
   

The code for capturing the serial data has been done and works flawlessly as can be seen. Writing each record to the database is also complete.

There are obviously many ways to parse the lines into fields as described, but I am looking for the "Delphi Best Practice" way
to do this and any suggestions are welcome. Sorry for the verbosity, rather too much detail than too little.

---- Site Name :              ---------------------------------------------------------------
 NO   STA   CO  TIME     START          DIALED             ACT  CNT   COST       ACCOUNT CODE
---- ----- --- -------- -------------- ------------------- --- ----- ----------- ------------
9171 1600  020 00:00:08 03/11/04 08:26 I1600 RING 00:05                                       *
9171 1630  020 00:00:24 03/11/04 08:26 t                                                      
9172 1600  019 00:00:21 03/11/04 08:27 I1600 RING 00:05                                        
9167 1615  021 00:04:47 03/11/04 08:23 T092634885447        **     0           0              
9173 1600  004 00:00:12 03/11/04 08:27 I RING 00:08                                           *
9173 1631  004 00:00:56 03/11/04 08:28 t                                                      
9176 1600  005 00:00:11 03/11/04 08:32 I RING 00:07                                           *
9177 1600  008 00:00:10 03/11/04 08:33 I RING 00:19                                           *
9178 1629  017 00:00:44 03/11/04 08:33 O0216836654          **     0           0              
9176 1631  005 00:02:11 03/11/04 08:32 t                                                      *
9174 1600  018 00:04:42 03/11/04 08:31 O4217111             **     0           0              
9177 1606  008 00:02:29 03/11/04 08:33 t                                                      
9176 1630  005 00:01:40 03/11/04 08:35 t                                                      
9179 1602  016 00:00:33 03/11/04 08:37 O0215524660          **     0           0              
9181 1631  015 00:00:00 03/11/04 08:39 O01                  **     0           0              
9180 1603  016 00:01:09 03/11/04 08:38 I1603 RING 00:01                                        
9182 1631  014 00:00:25 03/11/04 08:39 O0315791884          **     0           0              
9183 1606  013 00:00:17 03/11/04 08:40 O0217975582          **     0           0              
9185 1606  011 00:00:18 03/11/04 08:41 O0825567634          **     0           0              
9184 1631  012 00:02:14 03/11/04 08:41 O0800116771          **     0           0              
9186 1600  012 00:00:06 03/11/04 08:43 I RING 00:02                                            
9187 1600  011 00:00:08 03/11/04 08:45 I1600 RING 00:02                                       *
9188 1631  010 00:00:00 03/11/04 08:45 O4944250             **     0           0              
9189 1600  010 00:00:14 03/11/04 08:45 I RING 00:07                                           *
9189 1628  010 00:00:25 03/11/04 08:46 t                                                      
9190 1600  013 00:00:14 03/11/04 08:47 I1600 RING 00:04                                       *
9191 1600  014 00:00:11 03/11/04 08:47 I RING 00:20                                            
9190 1630  013 00:01:06 03/11/04 08:47 t                                                      
9187 1614  011 00:03:49 03/11/04 08:45 t                                                      
9192 1603  015 00:02:19 03/11/04 08:47 I1603 RING 00:02                                        
9194 1626  008 00:00:00 03/11/04 08:50 O083600              **     0           0              
9195 1626  007 00:00:00 03/11/04 08:50 O083400              **     0           0              
9193 1602  009 00:00:31 03/11/04 08:50 O0833792813          **     0           0              
9197 1600  007 00:00:06 03/11/04 08:50 I1600 RING 00:04                                       *
9196 1626  006 00:00:26 03/11/04 08:50 O0834050008          **     0           0              
9197 1603  007 00:00:22 03/11/04 08:50 t                                                      
9198 1626  005 00:01:21 03/11/04 08:51 O0215524660          **     0           0              
9199 1603  004 00:02:15 03/11/04 08:51 O0861111333          **     0           0              
9201 1614  002 00:00:24 03/11/04 08:53 O4918007             **     0           0              
9200 1629  003 00:00:44 03/11/04 08:53 O0126652223          **     0           0              
9202 1630  001 00:00:10 03/11/04 08:54 O0825792122          **     0           0              
9203 1603  030 00:00:00 03/11/04 08:54 O5485005             **     0           0              
9204 1603  029 00:00:28 03/11/04 08:55 O7196323             **     0           0              
9205 1628  028 00:01:45 03/11/04 08:55 O0826559918          **     0           0              
9206 1606  027 00:00:00 03/11/04 08:57 O01                  **     0           0              
9207 1603  026 00:00:22 03/11/04 08:57 O0824427645          **     0           0              
9209 1626  025 00:00:45 03/11/04 08:57 O0836270929          **     0           0              
9210 1630  024 00:00:38 03/11/04 08:58 O0825792122          **     0           0              
9211 1603  023 00:00:59 03/11/04 08:58 O7196323             **     0           0              
9212 1600  023 00:00:09 03/11/04 09:00 I1600 RING 00:02                                       *
9212 1602  023 00:01:25 03/11/04 09:00 t                                                      
9213 1602  022 00:00:10 03/11/04 09:02 O4852387             **     0           0              
9214 1600  022 00:00:14 03/11/04 09:03 I1600 RING 00:03                                       *
9214 1631  022 00:01:55 03/11/04 09:03 t

Thank you

PC
[+][-]01/02/05 04:55 AM, ID: 12938893Accepted Solution

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

About this solution

Zone: Delphi Programming
Tags: delphi, string
Sign Up Now!
Solution Provided By: mokule
Participating Experts: 5
Solution Grade: A
 
[+][-]01/02/05 10:01 AM, ID: 12939769Assisted Solution

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 30-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]01/06/05 05:00 AM, ID: 12971473Assisted Solution

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 30-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]01/06/05 07:06 AM, ID: 12972616Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01/06/05 07:30 AM, ID: 12972863Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01/10/05 07:20 AM, ID: 13003538Assisted Solution

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 30-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]01/11/05 08:44 AM, ID: 13015469Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01/12/05 01:11 AM, ID: 13022048Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03/01/05 12:28 AM, ID: 13427210Administrative Comment

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 30-day free trial to view this Administrative Comment or ask the Experts your question.

 
[+][-]03/01/05 01:14 AM, ID: 13427385Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03/01/05 01:54 AM, ID: 13427570Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03/01/05 03:05 AM, ID: 13427888Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03/01/05 03:19 AM, ID: 13427941Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03/05/05 03:14 AM, ID: 13465277Administrative Comment

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 30-day free trial to view this Administrative Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091021-EE-VQP-81