August 12th, 2012, 11:25 PM
-
Pulling data out of reports
I have some reports that I need to separate the data from. The reports will be in a TMemo, I basically want to change the caption of a label on the form with each data.. Any help on how to pull the info in orange below out would be helpful, thanks in advance..
A sample of a typical report is:
Customer name:
john
Session date:
08/03/12, 06:34PM
Resolution:
Resolved (No Response)Resolution type:
Resolution went as I expected
Scope of work:
Customer was a dispatch from another expert session: p2s Session: 8888*** LMI ID – 1467*****] PC Tuneup Scope of Work performed: PC Tuneup Additional Notes:Browser not showing pages, unable to download files and popups.
Scan was clean.
Diagnostic Session: 8888462
Title:
PC Tuneup
Problem details:
Browser not showing pages, unable to download files and popups.
Scan was clean.
Solution details:
Performed tuneup via ccleaner, disk cleanup. Reset IE, verified internet working in normal mode, customer happy. Diagnostic Session: 8888462
Product:
Product Details: (Optional)
Tags:
(Delimit tags with a comma)
Links:
August 13th, 2012, 12:29 AM
-
You should use the lines property of TMemo.
August 13th, 2012, 08:44 AM
-
Have you thought about using XML to build your report?
You could easily write code to display your data as you have above in a memo control, and still have each data element easily accessible for what ever other purpose you need.
Here are some articles to help:
http://edn.embarcadero.com/article/34110
http://www.youtube.com/watch?v=4D78MG4CaAI
http://delphi.about.com/od/windowsshellapi/a/xml_delphi.htm
August 13th, 2012, 11:51 AM
-
Have you thought about using XML to build your report?
Interesting suggestion.
Because of the way the question was phrased I jumped to the conclusion that access to the data was confined to the TMemo.
Of course, if there is access to the source code that is a misconception.
However, assuming there is access to the source data, whether it is preferable to build an XML structure, a tabular format
or some other data container will, I think, depend upon the source data structure and the overall requirements of the application.
Clive
August 19th, 2012, 12:32 PM
-
using the lines functions it won't work because...
Which is why we need more context and background to offer useful advice.
I would think that if you have access to the HTML then that is the way to go.
Based on what you say, by examining the structure of example.htm you should be able
to discern the relationship between the tags that represent report titles
(Customer name: ; session date: etc.) and the tags that enclose the data.
While I am familiar with navigating and extracting/inserting data into XML structures I have
not had the need (in Delphi) to do the same with HTML, so this is the limit of my current advice.
Clive