Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Printing sequential labes in Crystal

Posted on 2013-06-03
11
Medium Priority
?
269 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
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

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…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…

618 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