Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to create value/page break for distinct number of records

Status
Not open for further replies.

sofseattle

Technical User
Dec 2, 2004
12
US
Is there a way to create a sectional page break based on the results of a formula?
I would like to have a separate page each time the "batch" changes, but am not getting good results.
I have a running total formula that counts the distinct # of sales orders and then assigns a value which I am putting in a formula field called batch

@batch:

if {#Test} = 1 or {#Test} = 2 or {#Test} = 3 or {#Test} = 4 or {#Test} = 5 or {#Test} = 6 or {#Test} = 7 or {#Test} = 8 or {#Test} = 9 or {#Test} = 10 or {#Test} = 11 or {#Test} = 12 then 1
else
if {#Test} = 13 or {#Test} = 14 or {#Test} = 15 or {#Test} = 16 or {#Test} = 17 or {#Test} = 18 or {#Test} = 19 or {#Test} = 20 or {#Test} = 21 or {#Test} = 22 or {#Test} = 23 or {#Test} = 24 then 2
else
if {#Test} = 25 or {#Test} = 26 or {#Test} = 27 or {#Test} = 28 or {#Test} = 29 or {#Test} = 30 or {#Test} = 31 or {#Test} = 32 or {#Test} = 33 or {#Test} = .34 or {#Test} = 35 or {#Test} = 36 then 3
else
if {#Test} = 37 or {#Test} = 38 or {#Test} = 39 or {#Test} = 40 or {#Test} = 41 or {#Test} = 42 or {#Test} = 43 or {#Test} = 44 or {#Test} = 45 or {#Test} = 46 or {#Test} = 47 or {#Test} = 48 then 4
else
if {#Test} = 49 or {#Test} = 50 or {#Test} = 51 or {#Test} = 52 or {#Test} = 53 or {#Test} = 54 or {#Test} = 55 or {#Test} = 56 or {#Test} = 57 or {#Test} = 58 or {#Test} = 59 or {#Test} = 60 then 5
else
if {#Test} = 61 or {#Test} = 62 or {#Test} = 63 or {#Test} = 64 or {#Test} = 65 or {#Test} = 66 or {#Test} = 67 or {#Test} = 68 or {#Test} = 69 or {#Test} = 70 or {#Test} = 71 or {#Test} = 72 then 6
else
if {#Test} = 73 or {#Test} = 74 or {#Test} = 75 or {#Test} = 76 or {#Test} = 77 or {#Test} = 78 or {#Test} = 79 or {#Test} = 80 or {#Test} = 81 or {#Test} = 82 or {#Test} = 83 or {#Test} = 84 then 7
else
if {#Test} = 85 or {#Test} = 86 or {#Test} = 87 or {#Test} = 88 or {#Test} = 89 or {#Test} = 90 or {#Test} = 91 or {#Test} = 92 or {#Test} = 93 or {#Test} = 94 or {#Test} = 95 or {#Test} = 96 then 8
else
if {#Test} = 97 or {#Test} = 98 or {#Test} = 99 or {#Test} = 100 or {#Test} = 101 or {#Test} = 102 or {#Test} = 103 or {#Test} = 104 or {#Test} = 105 or {#Test} = 106 or {#Test} = 107 or {#Test} = 108 then 9
else
if {#Test} = 109 or {#Test} = 110 or {#Test} = 111 or {#Test} = 112 or {#Test} = 113 or {#Test} = 114 or {#Test} = 115 or {#Test} = 116 or {#Test} = 117 or {#Test} = 118 or {#Test} = 119 or {#Test} = 120 then 10
Else
if {#Test} >121 then 11





Any assistance would be greatly appreciated.



 
Insert a group on sales order ID (you don't have to display this group if you don't want to). Then place the following formula in the group footer:

whileprintingrecords;
numbervar cnt;
cnt := cnt + 1

Then go to the section expert->group footer->new page after->x+2 and enter:

whileprintingrecords;
numbervar cnt;
remainder(cnt,12)=0

-LB
 
Hey LB,
Thanks so much, this got me pretty close but not quite there. I still see batch 2 and batch 3 on 1 page. I am trying to get it to page break by batch number. The orignal post was how to get it into the batches which I got figured out.
I have attached a snipet of the preview page and you can see batch 2 and 3 are still on same page.

Thanks in advance for any advice!

 
 https://files.engineering.com/getfile.aspx?folder=c44960dd-7b78-44c5-a044-489e4e4154ed&file=Capture.PNG
I can’t tell anything from your file about how you implemented my suggestion. All my suggestion does is insert a page break after every 12 unique sales order IDs. Isn’t that what you wanted it? I tested it and it worked here.

If that is what you wanted to do, then you should explain exactly how you implemented my suggestion.

-LB
 
Sorry about that LB.

I will try to be more clear on what I am trying to do....

I created the batch formula that creates the " batch " of 12 unique sales orders and that value is placed in a formula called batch. The batch formula can hold up to 10 unique batch numbers and anything else is placed into an other of batch 11. That is the formula that is in the original post above.

Now what I am trying to get it to do is a page break for each new batch number.

as an example here is sample data for my columns on a single page:
What I am trying to get to is get a page break when the batch # formula changes from 1 to 2, from 2 to 3, etc.

ITEM Quantity Bin Sales Order# Pick # Batch#

1 1 01-l44b 2945 546 1
2 2 02-l44b 2946 546 1
3 1 03-l44b 2947 546 1
4 1 04-l44b 2948 546 1
5 1 05-l44b 2949 546 1
6 1 01-l44b 2950 546 1
7 1 01-l44b 2951 546 1
8 1 01-l44b 2952 546 1
9 1 01-l44b 2953 546 1
10 1 01-l44b 2954 546 1
11 1 01-l44b 2955 546 1
12 1 01-l44b 2956 546 1
13 1 01-l44b 2999 546 2
14 2 02-l44b 2918 546 2
15 1 01-l44b 2911 546 2
 
I think you are overcomplicating this. You are essentially “batching” every 12 sales order #, which is what my suggestion did. Why not try it instead of your approach?

-LB
 
LOL I do tend to over think things sometimes
I will give that a try

Thanks
 
Is there a way to do this as a distinct count? The sales order's may appear multiple times within a batch, so when I try this it is counting each individual sales order instead of distinct sales order numbers

whileprintingrecords;
numbervar cnt;
cnt := cnt + 1
 
If you insert a group on sales order ID and then place the formula in the group footer, it will only count once per ID.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top