Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Preformatted Report File

Posted on 2013-11-14
10
Medium Priority
?
237 Views
Last Modified: 2013-11-20
Hello All,
I have a proc whose final result is from the below query:

select REPLICATE(' ',26)+ 
REPLICATE(' ',9 - LEN(residentnumber)) + 
residentnumber 
+ REPLICATE(' ',29)+ 
TransactionID+ REPLICATE(' ',16-LEN(TransactionID)) + REPLICATE(' ',30)
+ cast(Quantity as varchar)
+REPLICATE(' ',12-LEN (Quantity))
+ cast(sum(UnitPrice) as varchar) + REPLICATE(' ',12-LEN (sum(UNITPRICE))) + 
REPLICATE(' ',13) 
+ DATE + REPLICATE(' ',8-LEN(DATE))+ 
 REPLICATE(' ',37) AS RECORD
 from @t group by ResidentNumber,TransactionID,date,Quantity

Open in new window

Is there a way in crystal that instead of returning a formatted data from the query, I return the raw data and add those spacing on the report.
Please let me know.
0
Comment
Question by:Star79
  • 5
  • 4
10 Comments
 
LVL 101

Expert Comment

by:mlmcc
ID: 39648343
What are you trying to do?

In Crystal you can use Left and Right (depending on where the padding is) to get what you want.

For instance
This converts the residentnumber to a string and adds spaces to the left.

Right(Space(9) & CStr({residentnumber},0,""), 9)

To add trailing spaces

Left(CStr({residentnumber},0,"") & Space(9) , 9)


There are problems with Crystal if you are trying to export this to a fixed format.  Crystal tends to strip the leading and trailing spaces from the export.

mlmcc
0
 

Author Comment

by:Star79
ID: 39648435
hello mlmcc,
I have used the same query to return the data and exported the report to text file.I have attached the text file, but I see a char 'o' in the first line and again couple of lines below appearing 5 times at the beginning of a line in the file. Not sure how is that coming.If i could remove that  char, the file is all set for production.Please help.
test.txt
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 39648755
What is the query you are using for the report?

What formula are you using to show the fields on the report?

mlmcc
0
How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

 

Author Comment

by:Star79
ID: 39649013
the query that iam using is in the original post
and Iam not using any formula. Just dropped the concatenated resultset into the report and exported it to text file.
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 39649453
Your query must be adding it for some reason.  Crystal wouldn't add it.  WHen I viewed the text file it showed a weird character at the start and between some records.

mlmcc
0
 

Author Comment

by:Star79
ID: 39649485
Yes mlmcc , thats what iam trying to get rid of.
0
 

Accepted Solution

by:
Star79 earned 0 total points
ID: 39649597
thank you.I was able to get rid of the character.
When doing the export to excel I had enter 0 for Do not paginate option and it removed the special char.
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 39650187
I suspected the special character was a new page but didn't know how to get rid of it.

mlmcc
0
 
LVL 35

Expert Comment

by:James0628
ID: 39650823
FWIW, the character wasn't actually an 'o' (the letter).  It was a small rectangle.  I didn't check, but it was presumably a Form Feed, which you will get in an exported text file if CR tries to add page breaks.

 If that was your only problem, then I guess you can accept your own post as the solution.

 James
0
 

Author Closing Comment

by:Star79
ID: 39662014
my answer gives the solution for the problem
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

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…
There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

916 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