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

any way to get a summary of text fields 1

Status
Not open for further replies.

leeskers

Programmer
Feb 19, 2003
8
US
Hello,

Kind of an odd question, I suppose, but I will give an example of the reasoning. I need to come up with a property management report for the head of the company which details the property, the company head's percentage, and a list of percentages for other investors.

I have an ownership_percent table which has the property id, the ownership entity, percentage for that entity, and other information which is not needed. Example follows:

OWNERSHIP_PERCENT
PID ENTITY PERCENT
1 A 25
1 B 25
1 C 50
2 A 51
2 D 49

The piece of the desired report that I cannot quite get my finger looks like the following:
OWNER
PID NAME PERCENT OTHER
1 PROP 1 25 B 25%, C 50%
2 PROP 2 51 D 49%

I can get the owners percentage, but I am struggling to "summarize" the other percentages in a text field for that prop id. Any suggestions?

Thanks.
 
Where did this mysterious Name field come from?

Presumably the Owners percent is Entity A?

Anyway, this solution is dependent upon your version of Crystal (and I'll omiot the Name field since it isn't in the data example):

Group by the PID, and add in a formula to concatenate the non A entities for displaying in a single line:

Group Header Formula
whileprintingrecords;
stringvar Others := "";

Details:
whileprintingrecords;
stringvar Others;
If Entity <> &quot;A&quot; then
Others := Others + &quot; &quot; + {table.entity}+&quot; &quot;+{table.percent}

Group Footer:
whileprintingrecords;
stringvar Others;
ltrim(Others)

-k
 
SV - I was just about to post when you did. Here's a slight variation:

{@resetnonowner} - Place in group (PID) header:
whileprintingrecords;
stringvar nonowner := &quot;&quot;;

{@detnonowner} - Place in details:

whileprintingrecords;
stringvar nonowner;

if {table.entity} <> &quot;A&quot; then nonowner := nonowner + {table.entity} + &quot; - &quot; + totext({table.percent},0,&quot;&quot;)+&quot;%&quot; + &quot;, &quot; else
nonowner := nonowner + &quot;&quot;;
nonowner;

{@displaynonowner} - Place in group (PID) footer:

whileprintingrecords;
stringvar nonowner;
left(nonowner,len(nonowner)-2);

-LB
 
thanks much. the whileprintingrecords was the piece of the puzzle that i was missing.

and the mysterious name field was from another table, i just plugged my actual format in there.... sorry.

thanks again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top