Solved

Use data from .txt file into Crystal reports

Posted on 2016-07-25
9
48 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
 
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
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…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
A company’s greatest vulnerability is their email. CEO fraud, ransomware and spear phishing attacks are the no1 threat to a company’s security. Cybercrime is responsible for the largest loss of money to companies today with losses projected to r…

919 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now