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

Conditional formatting of a bibliographic citation 1

Status
Not open for further replies.

leveetated

Programmer
Jan 24, 2008
46
US
Hello experts,

I have a bibliography to produce for a client, using the Chicago Manual of Style. lbass provided an excellent solution I adopted to show multiple authors on a single line (see
However, when a book has a second author, the second author should have its first name first and last name last. But all I can produce is something like this:

Code:
Doe, John, Smith, Joe. Mary Had a Little Lamb. New York, NY: 1980.

When I want it to look like this:

Code:
Doe, John, and Joe Smith. Mary Had a Little Lamb. New York, NY: 1980.

Is this possible? Any ideas would be appreciated!

many thanks to all.
 
Please show the formula(s) you used to accomplish this, and also show a sample of your data at the detail level that feeds into this formula.

-LB
 
Thanks lbass. In the group header I have a @reset formula:

Code:
whileprintingrecords;
stringvar x:= "";

in the details I have the @accum formula:
Code:
whileprintingrecords;
stringvar x:=x & {Person.LastName} & ', ' & {Person.FirstName} & ', '

in the group footer I have the @displ formula:
Code:
whileprintingrecords;
if {Person.RoleID} <> 52 then
stringvar x
else '';
if len(x) > 2 then
left(x,len(x)-2)

So my data is a person table joined to a linking table, which then joins to a bibliographic table with the publication record information.

I have thought about doing a running total of the number of authors per title, and formatting the @accum formula differently if it's > 1 author, but I'm having no luck with that approach.

Thank you.
 
What would you expect it to look like if there were three authors?

-LB
 
If there is more than one author, the format should just extend the two author order, with an "and" before the last author. So it would look like:

Code:
Doe, John, Joe Smith, Mary Johnson, and Daniel Jones.

Thank you.
 
Change the {@accum} formula to:

whileprintingrecords;
stringvar x;
if onfirstrecord or
{Book.BookName} <> previous({Book.BookName}) then
x := x + {Person.Last Name}+", "+{Person.First Name}+", " else
if onlastrecord or
{Book.BookName} <> next({Book.BookName}) then
x := x + "and " +{Person.First Name}+" "+{Person.Last Name} + " " else //2 spaces
x := x + {Person.First Name}+" "+{Person.Last Name} +", "
;

I don't know what you are trying to do with Role ID criterion in the display formula. This would only eliminate the string result if the last record in the group had the specific role ID, so I'm not sure what you've done is really giving you the desired results.

-LB
 
lbass, you are brilliant. Thank you so very much and for the tip on the Role ID criterion as well. You've not only saved me some valuable time, but I've learned a thing or two.

Thank you again, & all the best.

-Lee.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top