Solved

Printing sequential labes in Crystal

Posted on 2013-06-03
11
258 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
  • 6
  • 3
  • 2
11 Comments
 
LVL 100

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 100

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
 

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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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 100

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 34

Accepted Solution

by:
James0628 earned 500 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 34

Expert Comment

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

 James
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
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 explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.
Concerto provides fully managed cloud services and the expertise to provide an easy and reliable route to the cloud. Our best-in-class solutions help you address the toughest IT challenges, find new efficiencies and deliver the best application expe…

929 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now