Solved

Use data from .txt file into Crystal reports

Posted on 2016-07-25
9
63 Views
Last Modified: 2016-07-28
I want to pull data from a .txt file and include in a Crystal report daily. The .txt file is a simple 5 row file with specific fields, I want to use the header and then each item with it's value next to it.

07/25/2016 13:08:22 :  BATCH CLOSE SUMMARY

MerchantID - 7216789076309317
BatchNo - 207001
BatchItemCount - 000005
NetBatchTotal - 1236.00
C--Users-JohnPretorius-Desktop-CCTes.txt
0
Comment
Question by:John-S Pretorius
  • 5
  • 4
9 Comments
 
LVL 100

Expert Comment

by:mlmcc
ID: 41728453
Yes you can.

First you have to create an ODBC connection to the text file using the Microsoft Text driver.

Once you have that then you can use it as any other ODBC data source.

http://scn.sap.com/thread/1070686

I believe you will have to transpose the data so it is in record format
One record per line

If all you want is to show the data then you could use it in the current format.  You will have 2 columns one for the definition the other for the value.

mlmcc
0
 

Author Comment

by:John-S Pretorius
ID: 41729383
I looked at this and it seems straight forward, I'm having trouble getting the format .txt field configured in ODBC. Below 6 rows shows the content of each text file. Line 1 is the timestamp which will be my header and then I will have 2 columns for rows 3 - 6, Description and Value separated by a '-'

07/25/2016 13:08:22 :  BATCH CLOSE SUMMARY

 MerchantID - 7216789076309317
 BatchNo - 207001
 BatchItemCount - 000005
 NetBatchTotal - 1236.00
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 41729418
How is the connection showing the data?

It may be easiest to simply treat it as a single column of text and use formulas in Crystal to break it apart if you need to.

mlmcc
0
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 
LVL 100

Expert Comment

by:mlmcc
ID: 41729437
I just built a report using your sample data.

The first connection I built I let it choose the datatypes.  It worked except the large number apparently is too big for a 32-bit system so it was rounded.

I built a second connection and defined the columns as string/text.
It shows the data just fine.

mlmcc
0
 

Author Comment

by:John-S Pretorius
ID: 41729438
All fields are empty when I run the report.
0
 

Author Comment

by:John-S Pretorius
ID: 41729441
Could you kindly share the ODBC text settings, I'm thinking that I probably have this wrongly configured.
0
 
LVL 100

Accepted Solution

by:
mlmcc earned 500 total points
ID: 41729724
Here is the first ODBC Text and Number for the columns

COnfiguration 1
Click to DEFINE FORMAT

ODBC Format
You have to select the text file then change the format to CUSTOM DELIMITED and set it to -
When that is set, click GUESS and the connection will make its best guess.  You can change the name and data type

SInce this is Crystal you only need to setup the 32-bit ODBC connection

mlmcc
1
 

Author Comment

by:John-S Pretorius
ID: 41730223
Thank You very much.
0
 

Author Closing Comment

by:John-S Pretorius
ID: 41733009
Thank you
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

791 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question