Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need to create a flat file using Crystal Reports 1

Status
Not open for further replies.

sneveu

Programmer
Sep 14, 2011
3
US
We recently converted to a PC based software. Prior to that we were on the iSeries. We had a process on the iSeries where we created a flat file, length 500A and created records where each field starts at a specific point. For example customer name starts at positon 1 for length of 30. Next field customer address starts at position 50 for length of 25 and continue until all fields have been added. Now that we are using Crystal reports, how can I create this same file? Can I sub-string all the fields I need into 1 500 A field and how do I tell the starting position for each field.
 
What you are suggesting is possible. but I suspect this is much easier via ODBC. What type of data is the database itself? You should not have to create a flat file, you should be able to access the database directly.

Software Sales, Training, Implementation and Support for Macola, Synergy, and Crystal Reports. Check out our Macola tools:
 
Not sure what you mean what kind of data is the database. The fields are both character and numeric. When I connect to the database via Microsoft Access to view contents of a table, it is an ODBC connection. I have been an RPG programmer for 20 years and just starting to learn PC programming.
 
I have never done this myself, but I think if you used a non-proportional font like Courier New, you could create a formula that established the lengths like this:

{table.string1}+space(30-len({table.string1})+
totext({table.number1},0,"")+space(10-len(totext({table.number1},0,""))+ //etc.

Using totext on the number, I specified no decimals (0), and no separators (""). You could also format a number this way:

totext({table.number1},"0000000000")

This would pad the number with leading zeros so that the length of the formula corresponded to the number of zeros you entered in the formula.

-LB
 
in my situation, I do not know how many spaces I need. For example, the item number can be 6 - 20 characters but I still need the field following the item to start at position 147.
 
That is what the spaces do--they compensate for the difference between the length of the field and the beginning of the next field (the next position). Assuming that the position requirements take into account the field lengths, this should work. Did you try it?

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top