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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Format a Text Object

Status
Not open for further replies.

M8KWR

Programmer
Aug 18, 2004
864
GB
We are in the process of migrating over from Access to Crystal, so i am trying to replicate some procedures that i have written in access now in Crystal, but I am unsure where to start with this one.

What I have is three field (Company, Lead Code, Appointment Date).

I want all three field displayed in the single text box which is simple enough.

But want I need is when the Appointment date is either empty or is equal to "N/A" then I do not want the appointment date displayed.

eg (If the appointment date was filled in)

[COMPANY}, Lead Status - [LEAD CODE]
Appointment Date - [APPT DATE]

I do also require the appointment date on the next line down.

Hope i have explained myself correctly.

Could anybody assist, I would be most grateful.
 
Do a formula field, and be careful how you write it. Crystal assumes that anything with a null means that the field should not display. Always begin with something like:
Code:
if isnull({apointment.date}) 
then "No Appointment Date" 
else ""Appointment Date - " & ToText({apointment.date}, "dd MM yy")
You could then combine this with the other fields in an additional Formula Field.

It helps to give your Crystal version, since newer versions have extra options, and some extra problems. I use Crystal 8.5.

I do also require the appointment date on the next line down
If you mean the next record, then use Next({apointment.date})


[yinyang] Madawc Williams (East Anglia, UK) [yinyang]
 
Sorry I am using Version 9.

you will have to bare with me i am just getting used to crystal.

I have insert the company and lead code field into the text box to create the top line, which is fine due to this will appear on each report.

Where would i have to create the formula and how would I put this into the text box.

Sorry to be a pain.
 
If you want to do the entire thing in a single formula:

If IsNull({Table.ApptDate}) or {Table.ApptDate} = "N/A" or {Table.ApptDate} = "" then
{Table.Company} + ", " + "Lead Status - " + {Table.LeadCode}
Else
{Table.Company} + ", " + "Lead Status - " + {Table.LeadCode} + Chr(13) + "Appointment Date - " + {Table.ApptDate}

Drag the formula field on the report, and format it to 'Can Grow'. The Chr(13) will add a carriage return.

If you want to use your existing Text Object, you can create a formula just for the Appointment Code, and add it to the second line of your text object:

If IsNull({Table.ApptDate}) or {Table.ApptDate} = "N/A" or {Table.ApptDate} = "" then
""
Else
{Table.ApptDate}

-dave
 
many thanks for your help it worked a treat.

another quick one though.

I have an address text box containing 6 fields of the address. I only have 1 line showing in the report, but have stated that it does grow. But it is not working properly, it is not pushing the fields below it down before it grows, is there an option i have not flagged.

Many thanks again for all your help.
 
Is it printing them side by side instead, or only the printing the first field? If you manually resize the text object, do you see all of the fields?

-dave
 
I have put the field underneath each other so,

Address1
Address2
Address3
City
State
ZIP

on the layout you can only see Address1, and want it to autogrow down, and push all fields etc beneath it down to accomodate it, but it is not pushing the field beneath it down, but instead the extra address field are displayed over the field below it.

Hope this make sense, thanks again for all you help.
 
the extra address field are displayed over the field below it
That happens if you put something below a 'can-grow' field, and put it in the same section.

What you need to do is right-click and choose [Insert Section Below]. Use it for the field below the address.


[yinyang] Madawc Williams (East Anglia, UK) [yinyang]
 
thanks for that. Do you know if this is going to be fixed within a later version of Crystal. People must have loads of sections within a report which seems odd to me coming from using access where you can make a field grow or shrink and it would move all the fields around it accordingly.

Thanks again for all your help.

 
I'm only on 8.5, but I think that it is the Crystal design philosophy and you might as well get used to it. You can read here about planned changes.

[yinyang] Madawc Williams (East Anglia, UK) [yinyang]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top