Subreport Location Needs to change as other objects grow

I am using Crystal Reports in Mas200 for a form that prints a customers address.  Mas200 won't link the country code table to the Sales Order table if the CC is only two characters (wants 3) so the work around (which works) is to create a Crystal Subreport consisting of the countries and linked to the main report via the country code field. The Subreport is merely the country name based on the linked CC.  The problem is, the rest of the customer address is in a text field in the main report that grows depending on the number of lines in the address and therefore the location of the Subreport (country name) needs to move up or down as the number of address lines changes.  It appears the subreport cannot be added to a text field like other fields can or be used in any formula field.  How can I make this country field print at the bottom of my address block regardless of size?
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.


Could you try using a shared variable in the subreport to pass the country name back into the main report?

For example, create a formula in the subreport called Country.  The formula syntax would be

shared stringvar Country := {table.fieldname} // this field is the country name

Place that formula in the Report footer of the subreport

In the main report place the subreport in a section above the section where the address is to be displayed

The in the main report create another formula called Address

It might look like this

shared stringvar Country;

In this formula the main report address lines are concatenated with the Country value as passed from the subreport to the main report

When concatenating address lines you might need to add in a carriage return / line feed

For example

shared stringvar Country;

(I have to say that i dont have crystal installed on this PC so i may have the wrong values for +chr(10)+chr(13))

The shared stringvar Country must match case in both sub and main reports

I hope this helps a bit

Best regards


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
kahuna59Author Commented:
That pretty much did it.  Final details are, in order to keep the formula field from the subreport footer from printing where the subreport was inserted into the main report (Report Header above the Page Header) I had to suppress the formual field in the subreport.  It did not work to suppress the subreport section or the main report section, or the subreport in the main report section because the Shared variable value would not pass.  FYI, you remembered chr(13) and chr(10) correctly.  My address formula was already assembled with variable declarations and value setting with carriage returns so all I had to do was add one more declaration for the shared variable and it was good to go.
Thanks for the help.  
Glad to help, best of luck in the future.

Its good to give something back to EE....
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Crystal Reports

From novice to tech pro — start learning today.