Jump to content
Sign in to follow this  
Baylah

Printing From related Tables

Recommended Posts

I have a "Master Record" with 4 portals on it. Each of those portals is related to the Master Record by a UniqueID to the Master.

Depending on the users needs at data entry time, anywhere from 1 to 4 of the portals may need to be populated during the data entry event.

I would like to have a script that will when activiated look at each portal/table and if a related record (to the master)has been created, switch to the appropriate layout and print it. If no related record has been created move to the nextportal/table and perform the same check and then exit after the last portal is checked.

Each Master Record would always have at least one Portal Row Populated, so the print result would always be at least one page and could be many more depending on how many portals rows are populated in each individual portal.

I have two issues I don't know how to resolve: the first is getting past the "no records found" message if any of the portals don't have a related record, and 2, how to loop this type request.

I think I could do a work around whereby everytime I create a Master Record a related record is created in each portal and only populated with the UniqueID in the fkID field. Then, I could write a script with an "if Not(IsEmpty)" pointed to any other unpopulalted fields to determine if a page prints.

The only thing I don't like about that is it potentially creates a bunch of empty records in the related portals. However...and forgive me for rambling...the user would never see the empty records except for the unpopulated portal in the Master Record. So maybe that is not such a bad thing? It certainly gets me past the "no records found." And that loop I know how to write. I was just thinking...I could probably back in after the print routines and then delete the unused records in the related portals.

Does anyone have a more elegant suggestion/solution for how I can pull this off?

Thanks in advance for any help,

Steve

Share this post


Link to post
Share on other sites

To seee if a portal has any records in it, you can use the Count() function. Be sure to count a related field that will always have something in it, like a remote key for the relationship.

Count( relationship1::keyfield )

Your script would have If conditional statements looking at each relationship.

If [ count( relationship1::keyfield ) > 0 ]

Go to Layout [ layout for portal 1 ]

Print []

Go to Layout [ original layout ]

End If

If [ count( relationship2::keyfield ) > 0 ]

Go to Layout [ layout for portal 2 ]

Print []

Go to Layout [ original layout ]

End If

If [ count( relationship3::keyfield ) > 0 ]

Go to Layout [ layout for portal 3 ]

Print []

Go to Layout [ original layout ]

End If

If [ count( relationship4::keyfield ) > 0 ]

Go to Layout [ layout for portal 4 ]

Print []

Go to Layout [ original layout ]

End If

This script will give you a print dialog for each layout, and it's by no means complete, but it illustrates the concept.

Share this post


Link to post
Share on other sites

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
Sign in to follow this  

×

Important Information

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