Solved

Use data from .txt file into Crystal reports

Posted on 2016-07-25
9
58 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
Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

 
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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
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…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

770 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