?
Solved

Printing sequential labes in Crystal

Posted on 2013-06-03
11
Medium Priority
?
267 Views
Last Modified: 2013-06-20
I had a formula to print numbered labels and now I need to change it slightly, however it is not working for me.  

Here was the original formula:
    WhilePrintingRecords;
    Shared stringvar code := {Out_WhoAmI.Out_Who_LabelProductCode};
    Shared stringvar lot := {Out_WhoAmI.Out_Who_Lot};
    Shared numbervar labelcount := {Out_WhoAmI.Out_Who_LabelCount}

The LabelCount field has a value of 35 - and that is how many print.
Now I have another field entitiled PrintQty I need to consider.
The PrintQty is 70

When the PrintQty is greater than the LabelCount then it should print {PrintQty} 70 else (LabelCount} 35

I changed the formula to the following. The field returns a value of 70, however I am still only getting 35 labels printing.

    WhilePrintingRecords;
    Shared stringvar code := {Out_WhoAmI.Out_Who_LabelProductCode};
    Shared stringvar lot := {Out_WhoAmI.Out_Who_Lot};
if {Out_WhoAmI.Out_Who_PrintQty} > {Out_WhoAmI.Out_Who_LabelCount} then
    Shared numbervar labelcount := {Out_WhoAmI.Out_Who_PrintQty}
else
    Shared numbervar labelcount := {Out_WhoAmI.Out_Who_LabelCount}


Any words of wisdom on this one?
0
Comment
Question by:Joe Brown
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 3
  • 2
11 Comments
 
LVL 101

Expert Comment

by:mlmcc
ID: 39217810
WHat isnt working?

can any of the fields be NULL?

General practice is to declare the variables then use them

    WhilePrintingRecords;
    Shared numbervar labelcount ;
    Shared stringvar code := {Out_WhoAmI.Out_Who_LabelProductCode};
    Shared stringvar lot := {Out_WhoAmI.Out_Who_Lot};
if {Out_WhoAmI.Out_Who_PrintQty} > {Out_WhoAmI.Out_Who_LabelCount} then
    labelcount := {Out_WhoAmI.Out_Who_PrintQty}
else 
    labelcount := {Out_WhoAmI.Out_Who_LabelCount};

Open in new window


mlmcc
0
 

Author Comment

by:Joe Brown
ID: 39217833
I tried to simply change the original formula over so it would print the quantity of labels in the Out_Who_PrintQty field.

This is still only returning 35 labels.

I can not figure out what is wrong here. Why would the field be showing a value of 70 but it is still only coming up with 35 labels which is he value in the Out_Who_LabelCount field?


    WhilePrintingRecords;
    Shared stringvar code := {Out_WhoAmI.Out_Who_LabelProductCode};
    Shared stringvar lot := {Out_WhoAmI.Out_Who_Lot};
    Shared numbervar labelcount := {Out_WhoAmI.Out_Who_PrintQty}
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 39217858
WHere is the formula?

If you put the fields on the report  what values do you get?

mlmcc
0
On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

 

Author Comment

by:Joe Brown
ID: 39217859
The LabelCount field has a value of 35. The PrintQty field has a value of 70.
With the formula that I have written (@LabelCount) - the formula returns the value of 70.
So at this point it appears the formula is working. However, it only loads 35 labels, not 70.
0
 

Author Comment

by:Joe Brown
ID: 39217861
I tried your above request, it also returns only 35 labels.
0
 

Author Comment

by:Joe Brown
ID: 39217879
I changed my formula to the below. It is still printing the amount of labels tied to the LabelCount field and not the PrintQty field.

    WhilePrintingRecords;
    Shared stringvar code := {Out_WhoAmI.Out_Who_LabelProductCode};
    Shared stringvar lot := {Out_WhoAmI.Out_Who_Lot};
    Shared numbervar labelcount := {Out_WhoAmI.Out_Who_PrintQty}
0
 

Author Comment

by:Joe Brown
ID: 39217896
Here is the report below. Not sure if this helps to help me figure out where the issue lies.
WhoAmI-Label.rpt
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 39218048
SInce the group header is suppressed the formula is not evaluated.

What are you trying to do with the formula?

mlmcc
0
 
LVL 35

Accepted Solution

by:
James0628 earned 2000 total points
ID: 39218362
I don't think the group header suppression is a problem.  I commonly suppress sections that contain formulas and have never had a problem.

 You're setting a variable, but what, if anything, are you actually doing with that variable?  The value that you put in that variable doesn't actually affect anything in the report if you don't use that variable somewhere.

 The first problem is that you linked Out_WhoAmI.Out_Who_LabelCount to WhoAmI_LabelCount.Number, using a >= link.  That's how you're getting the correct number of labels.  The formula that you posted, and the labelcount variable, have nothing to do with it.

 The link is a problem because now you want the number of labels to be based on Out_Who_LabelCount OR Out_Who_PrintQty, whichever is greater.  With that link, you're always going to be limited by Out_Who_LabelCount.

 So, I guess you're going to need to remove that link between Out_WhoAmI and WhoAmI_LabelCount, and then use the record selection formula to compare one field or the other.  This could really hurt the report's performance.  I don't know.  I've never used unlinked tables, so I'm not sure what's going to happen.

 FWIW, your current record selection formula has {Out_WhoAmI.Out_Who_LabelCount} >= {Out_WhoAmI.Out_Who_LabelCount}, which doesn't do anything (it's just comparing the field to itself).

 I think the new record selection formula would be something like this:

(
if {Out_WhoAmI.Out_Who_PrintQty} > {Out_WhoAmI.Out_Who_LabelCount} then
  {Out_WhoAmI.Out_Who_PrintQty} >= {WhoAmI_LabelCount.Number}
else
  {Out_WhoAmI.Out_Who_LabelCount} >= {WhoAmI_LabelCount.Number}
) and
{Out_WhoAmI.Out_Who_ApprovalCode} = {?ApprovalCode}


 FWIW, you posted the report with saved data, but I couldn't use that to run any tests , because the saved data was discarded when I opened your report, because one of your formulas uses a function (for QR codes) that I don't have.

 James
0
 

Author Closing Comment

by:Joe Brown
ID: 39260729
Thank you James - i was able to find the problem within the formula used for the record selection. You were correct, this is where the problem lied. Thank you!
0
 
LVL 35

Expert Comment

by:James0628
ID: 39261927
You're welcome.  Glad I could help.

 James
0

Featured Post

Enroll in August's Course of the Month

August's CompTIA IT Fundamentals course includes 19 hours of basic computer principle modules and prepares you for the certification exam. It's free for Premium Members, Team Accounts, and Qualified Experts!

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…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

752 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