Jump to content

Okay who is up for a challenge?


spongebob
 Share

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

Recommended Posts

We bow to thee oh mighty forum!

I hope Ill explain myself right.

I have a master record in a master table with a related table. In the related table are two lengthy text fields.

The related table has say, 20 records relating to the first master record.

When I want to print the one master record i wanto print the 20 related text bits with it.

Easy I hear you say, just smack a portal on your print layout, give it say 50 instances and set sliding printing "up" and bingo it all will print.

Yes and no and this is a baaad approach because:

a) the size of the portal may be smaller than whats in the text fields so they may be cut off and

: what if there are more than 50 related records to print?

In this app I cannot afford to not print something; it hasto print the lot.

So new approach.

Write a script that goes to the related records and dumps all the info of all the related records into one summary print field of the master record and then print that field on the print layout of the master record. I use the goto related record script step for that in my script generating the content of my "summary print field" in the master record.

So far so good now comes the hickup.

I must generate this summary print field for the master record before I print the master record of course.

However when the user hits my "print" button (which leads to my printing script) I dont know if he wants to print just THE CURRENT RECORD or all RECORDS IN THE FOUND SET.

If the guy only prints the current record its easy. Run my summary print field generation script and print the current record. That would work.

However, I find out that info, what he wants to print (current or all records) only at print dialog time (and when the user klicks ok there he may perhaps choose to print all records in the found set, which would then be printed without executing my script to generate the summary fields of all those master records and hence what prints out on some records may be simply wrong).

So I hear you say HA!! TWO SOLUTIONS:

1) Generate the summary print field for all records in the found set when the guy hits print.

---This is unacceptable because thousands of records are involved so the guy will go bananas waiting for his print dialog.

:yay:

2) Do the printing silently without the print dialog so we are sure he will only ever print one record.

----This is unacceptable as I want the guy to be able to choose his printer, as well as print more than the current record.

So: :badidea:

I feel my approach is doomed.

:titanic:

Please can anyone tell me if there is a "better way"?

Am I doomed? (I mean I know Im doomed already in principle but am I also doomed on this issue?)

:qwery:

Thanks for any suggestions

El Spongebob

Link to comment
Share on other sites

The "better way" is to print from the child records. About the only time you need to print from the Master record is if you must gather data from more than one relational direction; ie., more than 1 child table. Sometimes the Finds must be rewritten somewhat; but you can always Go To Related Record [ ID, Found Set ] to transfer to the child table.

If you must print from the Master table, then you can get your "summary" of child data, in an unstored calculation field, using a Custom Function (actually 2 CF's that work together, using the same parameters): GetRows, and GetNthRow; by Bruce Robertson, at:

briandunning.com/filemaker-custom-functions/list.php

Link to comment
Share on other sites

You must take control of the printing issue. If you script the printing options so the user must choose "current record" or "current set" BEFORE doing the rest of the steps then you can direct the way your script behaves.

As you are cross platform then you must make provision for XP and OS X to hold the print set up in different scripts for all combinations.

Personally I assume "current set" at all times (with occasional exceptions) so I make my scripts/layouts etc. work on that basis. My users do not have print setup available to them as I removed it from their password sets.

Link to comment
Share on other sites

The other "Better" way is to use GetNthRecord with a recursive custom formula in conjunction with Text formatting formulas, to get all the related child records into a single text field that can be printed.

What this does is allow you to pull each child record, format it appropriately, then squish it all into a single text field, which will properly slide/ print and pagebreak.

(A major advantage of this way is that you can include child records from as many relations as you want. The prior suggestion of printing from the child table only works if there is one child table, not if there are 2 or more)

Edited by Guest
Link to comment
Share on other sites

Hey hey hey, rock and roll!

Thank you for these tipps.

I will now implement! :thanks:

Best Wishes,

Spongebob

hmmmm next time Ill haveto think of something more difficult; you folks are all too brainy for me. Thats why my best friend is Patrick..he aint exactly bright either... :

Edited by Guest
Link to comment
Share on other sites

Ehm...just one more question as I am not using FM Pro ADVANCED (YET).

Am I correct in saying that I could write a custom function into my FM File, and then when that FM File is deployed using the normal Filemaker SERVER as well as the normal Filemaker clients (not advanced) people will be able to use my functionality without having something special like a plugin or similar extra installed on their client machine yes?

Thanks I know for you this may be obvious...

Spongebob

Link to comment
Share on other sites

This topic is 5761 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
 Share

×
×
  • Create New...

Important Information

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