Solved

Printing sequential labes in Crystal

Posted on 2013-06-03
11
263 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
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 

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 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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

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…
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 …
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

828 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