Crystal Reports 2011 - Insert a carriage return on change of

Hello, I’m wondering if there is a way to insert a carriage return on change of product codes on my invoices.

For example: Product Code 12345 is sold with different sizes and colours.
I need these to be grouped.
On change of the product code, I want a carriage return to clearly show the next product codes.

My formula is @Linecode
In @Linecode is the data field {ZSALES_INVOICES._Code}

Thank you.
jspcAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ido MilletProfessor of MIS at Penn State Erie and Owner, Millet SoftwareCommented:
It's not clear where you want the "carriage return".  Assuming you need vertical space as a new set of invoices for product code begins, Insert a group (Level 2) on Product code within the Invoice group (Level 1).  Then, use either the Group Header Level 2 or Group Footer Level 2 to provide the vertical separation.
Ido MilletProfessor of MIS at Penn State Erie and Owner, Millet SoftwareCommented:
Sorry, meant "a new set of line items"
mlmccCommented:
That certainly is one way.  If you are building the list of items then you can try this

If Not OnFirstRecord AND Previous({LineItemField}) <> {LineItemField} Then
     YourString  := YourString & chr(13);

If you  just want a carriage return
If Not OnFirstRecord AND Previous({LineItemField}) <> {LineItemField} Then
      chr(13);

mlmcc
C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

jspcAuthor Commented:
Hello, thank you for your comments.
I am sorry if I haven’t made myself clear. Please see attached a word doc which will hopefully be easier to understand.

I tried the example of If Not OnFirstRecord AND Previous({LineItemField}) <> {LineItemField} Then  chr(13); however, this made the product code disappear.

Your comments are much appreciated.

Thank you.
See-a-carriage-return-example.docx
jspcAuthor Commented:
I forgot to mention in the example I have included, I had to manually insert the new line. (Highlighted Yellow Line)
See when the product code changes, I want Crystal Reports to insert a new line for me automatically.
Ido MilletProfessor of MIS at Penn State Erie and Owner, Millet SoftwareCommented:
The example you show doesn't look like a Crystal report.
If you are using Crystal Reports, then my suggestion above (use Grouping to take advantage of Group Header or Footer as a natural vertical separation) should work.
jspcAuthor Commented:
This is a screen shot example from my accounting software which uses crystal reports.
This was the best way of showing you as I can't currently get Crystal to achieve this. I hope that make sense now.
Ido MilletProfessor of MIS at Penn State Erie and Owner, Millet SoftwareCommented:
It does. The answer still stands.
jspcAuthor Commented:
I am new to Crystal Reports and am not 100% clear on what you mean.
Would you mind demonstrating from a screen shot if possible and paste this in a Word Document?
Ido MilletProfessor of MIS at Penn State Erie and Owner, Millet SoftwareCommented:
Use the menu option of
Insert, Group
jspcAuthor Commented:
Hello,

Thanks again, however it's not giving me the desired result.
Please see attached word document for details.
By-adding-the-Group-by-Line-seperat.docx
Ido MilletProfessor of MIS at Penn State Erie and Owner, Millet SoftwareCommented:
See my original answer.  Assuming you need vertical space as a new set of invoices for product code begins, Insert a group (Level 2) on Product code within the Invoice group (Level 1).  Then, use either the Group Header Level 2 or Group Footer Level 2 to provide the vertical separation.  Suppress the other headers/footers.
jspcAuthor Commented:
Don't worry about it --- I'm not following what you are saying.
As I mentioned, I am new to Crystal Reports.
Ido MilletProfessor of MIS at Penn State Erie and Owner, Millet SoftwareCommented:
Upload your report with saved data.  I will re-upload it after making the changes.
jspcAuthor Commented:
Oh ok,  thank you.
Here is a copy of the tax invoice.
SalesInvoice.rpt
jspcAuthor Commented:
Sorry, use this one.
SalesInvoice.rpt
Ido MilletProfessor of MIS at Penn State Erie and Owner, Millet SoftwareCommented:
Your report's structure allowed for a simpler solution. See attached.
Image of resulting layout: http://screencast.com/t/DDC3limngv4
SalesInvoice_Fixed.rpt
jspcAuthor Commented:
Thanks for your efforts.
Please see my attached Word Doc.
Current-Form.docx
mlmccCommented:
Change the suppression formula on Details C to

OnLastRecord
OR
{ZSALES_INVOICES._Code} = Next({ZSALES_INVOICES._Code})

Open in new window


mlmcc
SalesInvoiceRev1.rpt
jspcAuthor Commented:
Hello, unfortunately that doesn’t group the code together as I want them to be. Please see attached file.
See-a-carriage-return-example.docx
Ido MilletProfessor of MIS at Penn State Erie and Owner, Millet SoftwareCommented:
You forgot to explain what you mean by same Description.  Here is the fixed report using the firs portion of the Description as the matching target.

Image: http://screencast.com/t/ZoNMMviEwu9
Ido MilletProfessor of MIS at Penn State Erie and Owner, Millet SoftwareCommented:
You forgot to explain what you mean by same Description.  Here is the fixed report using the first portion of the Description as the matching target.

Image: http://screencast.com/t/ZoNMMviEwu9
SalesInvoice_Fixed_Short_Description.rpt
jspcAuthor Commented:
Bingo!
That's it.
Thank you.
James0628Commented:
It _looks_ like you want a blank line when the first 4 characters in ZSALES_INVOICES._Code change (eg. between 1002.<etc> and 1005.<etc>).

 If so, that could be done, but how do you want to handle values like "4003A", or "JOB013", or "Ausworkwear", or "PROT19-SSSSSS"?  Do you also want to look at the first 4 characters on those, and only the first 4 characters?  For example, put a blank line between "JOB013" and "JOB100", but not between "JOB013" and "JOB014"?

 Also, backtracking a bit, in your screenshot in By-adding-the-Group-by-Line-seperat.docx, you seem to be saying that on that page, you would only want a blank line in between 1001.04Red.6 and 1001.04Red.9, which doesn't seem to fit your other examples.

 James
Ido MilletProfessor of MIS at Penn State Erie and Owner, Millet SoftwareCommented:
I think you are probably trying to target changes only within composite line codes.  Here is a new version that targets changes in the 1st part of a composite line code.
SalesInvoice_Fixed_CompositeCode.rpt

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
jspcAuthor Commented:
Hi IdoMillet,

I’m wondering if you could be so kind to help me with another issue I have?

From my Accounting Software I have a Sales Order with many stock codes on it.
The same Sales Order also has a comment section with many lines of comments relating to stock codes and other information.
When the stock becomes available I then convert those stock codes from the Sales Order to an Invoice.
I want to also be able to choose the comments I made on the sales order to appear on the invoice.

I created a parameter on the comment field (ZInvoices_Description) so I could choose which comments to pass.
The issue I have with this is, all the comments appear within the database and not those relevant to the Sales Order in question.

Surely there is a way for only the comments from that Sales Order to appear to be passed.

Attached is a Word document containing my parameter and a screen shot of all the comments that are appearing plus a copy of the saved file if needed.

Thank you.
The-data-in-the-available-fields-is.docx
SalesInvoiceSelectCommentsTest.rpt
Ido MilletProfessor of MIS at Penn State Erie and Owner, Millet SoftwareCommented:
Please close this thread and start a new question.
jspcAuthor Commented:
Hi IdoMillet,

I’m wondering if you could be so kind to help me with another issue I have?

From my Accounting Software I have a Sales Order with many stock codes on it.
The same Sales Order also has a comment section with many lines of comments relating to stock codes and other information.
When the stock becomes available I then convert those stock codes from the Sales Order to an Invoice.
I want to also be able to choose the comments I made on the sales order to appear on the invoice.

I created a parameter on the comment field (ZInvoices_Description) so I could choose which comments to pass.
The issue I have with this is, all the comments appear within the database and not those relevant to the Sales Order in question.

Surely there is a way for only the comments from that Sales Order to appear to be passed.

Attached is a Word document containing my parameter and a screen shot of all the comments that are appearing plus a copy of the saved file if needed.

Thank you.
SalesInvoiceSelectCommentsTest.rpt
The-data-in-the-available-fields-is.docx
jspcAuthor Commented:
Oh sorry .. need to start a new question
jspcAuthor Commented:
Hello IdoMillet,

I'm hoping you might be able to help me with this issue I had some weeks ago.
I thought the issue was corrected but it seems it is not.

The insert of blank line isn't working. Please see attached example.

Attached is the file also.
ChangeOfPC.jpg
SalesInvoice_Fixed_CompositeCode--2-.rpt
mlmccCommented:
When is it missing?

I can't tell from the sample report.

mlmcc
James0628Commented:
I assume that the screenshot was supposed to show an example of a "missing" blank line, but:
 a) It shows data that doesn't seem to be in the report that you posted.
 b) It's not actually even from that report (the fields are different).

 But I'm going to make a guess.

 The LineCode_Short formula is trying to use "." as a delimiter to split out the first segment of ZSALES_INVOICES._Code .  For example, if _Code was "0220.XX.XX", the formula would extract "0220".

 The codes in your screenshot seem to be using "+" as a delimiter (eg. "0355+Navy+102R").  The LineCode_Short formula doesn't look for "+", so it doesn't try to split the field.

 Assuming that my guess is correct, you could try changing @LineCode_Short to this:

IF instr({ZSALES_INVOICES._Code}, ".") < 1 and instr({ZSALES_INVOICES._Code}, "+") < 1 Then ""
Else
  IF instr({ZSALES_INVOICES._Code}, ".") > 0 Then
    Split({ZSALES_INVOICES._Code}, ".")[1]
  Else
    Split({ZSALES_INVOICES._Code}, "+")[1]

 If there are other delimiters that you want to recognize (eg. the "-" in "1234-56-78"), they would need to be added to the formula.

 And you may have a problem if _Code could contain more than one of those delimiter characters at the same time (eg. "022+0.XX.XX" or "0355+Navy+102.R").

 James
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Crystal Reports

From novice to tech pro — start learning today.