#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2012
    Posts
    1
    Rep Power
    0

    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:
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Jan 2006
    Location
    Carlsbad, CA
    Posts
    2,057
    Rep Power
    383
    You should use the lines property of TMemo.
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2008
    Posts
    352
    Rep Power
    7
    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
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Jan 2006
    Location
    Carlsbad, CA
    Posts
    2,057
    Rep Power
    383
    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
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Jan 2006
    Location
    Carlsbad, CA
    Posts
    2,057
    Rep Power
    383
    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

IMN logo majestic logo threadwatch logo seochat tools logo