Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 8331 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

The following script should do what you want. It may not always produce the optimum page arrangements, but it should be reasonable. Field names that begin with lowercase 'g' are global fields. Your print layout should should have a sub-summary part sorted by pageNo that pagebreaks after each occurrence.

code:


#Before running, all records (including the omitted ones) must have the PageNo field cleared

# and the current found set should be the songs that are to be printed.

Set Field [gPageNo, 0]

#Sort the file by number of lines per song in increasing order

Sort [sort Order: NumLines (Ascending)] [Restore sort order, no dialog]

Loop

#If there are no records left, then all songs have been assigned a page number.

Exit Loop If[status(CurrentFoundCount)=0

#Start next Page

Set Field[gPageNo, gPageNo + 1]

#Start with the longest song which will be at the end of the found set.

Go to Record/Request/Page [Last]

Set Field[PageNo, gPageNo]

Set Field[gRemainingLines,41-NumLines]

Omit Record

#Loop through all records until a small enough song is found to fit the remaining space on the page.

Loop

If[NumLines<=gRemainingLines]

#Found one, so assign the current page number to it, and then continue.

Set Field[PageNo, gPageNo]

Set Field[gRemainingLines,gRemainingLines-NumLines]

Omit Record

End If

#Quit searching if there are less than 2 lines remaining on the current page.

Exit Loop If [gRemainingLines<2]

#Otherwise look for another song to fit on the page.

Go to Record/Request/Page [Previous, Exit after last]

End Loop

#Now do next page

End Loop

#Perform a find to get the found set back

Perform Find [Request 1 (Omit): PageNo=][Restore find requests]

#Finally, perform a subscript that sorts by PageNo, goes to the print layout, and prints the songbook

Perform Script [PrintSongBook][sub-scripts]

  • Newbies
Posted

Hello, I have a database of songs that I occasionally make into song books (5 to 30 songs per book). I would like to minimize the number of pages printed without having to order the songs manually.

I have a calc field that calculates the number of lines in each song. Some have 6 lines, some have 40, the maximum number of lines on a page (with my text settings) are 41.

Is there a way to group songs by sums of 41?

I'm not sure if I've worded this in the clearest way, but this is my best shot. Your comments are welcomed.

Eide crazy.gif

[ February 04, 2002, 01:03 PM: Message edited by: Eide ]

  • Newbies
Posted

Wow!

Thanks a bunch, it took a while to implement, but the script works pretty well. I tweaked with a few of the numbers/text sizes/etc. but you pretty much nailed that one. Thank you for your time and effort!

Eide

This topic is 8331 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.