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!

I need to detect End of File for a child table. 2

Status
Not open for further replies.

GZook

Programmer
Apr 14, 2003
42
US
I have a setup where there is a master table which is related via CaseNo field to three child tables.

For each master record, there will be data in only one of the child tables.

Using only one detail line, I need to include data from the master table and the child table that is not at end of file. I need to get the data from the proper child while in a formula.

Example:
IIF(NotEOFChild1Condition, Child1.data,
IIF(NotEOFChild2Condition, Child2.data,
IIF(NotEOFChild3Condition, Child3.data,0)))

IsNull({ChildN.data}) didn't work.
Neither did Len(Trim(CStr({ChildN.data}))) > 0.

How do I go about this?
 
By the way, I'm using Crystal 8.5
 
I don't understand
the child table that is not at end of file
What sort of links are you using? Sounds like it ought to be left-outer. And also I'd try a formula doing a set of
Code:
if isnull({your.fields})
commands of the sort you tried.

Madawc Williams
East Anglia, Great Britain
 
You might try:

if not isnull({table.child1data}) then
{table.child1data} else
if not isnull({table.child2data}) then
{table.child2data} else
if not isnull({table.child3data}) then
{table.child3data}

-LB
 
Thanks to both of you for your suggestions. This is what I was trying to do in the first place and easier than what I finally did. I'm gonna make a copy of my report and give it a try.

My solution is somewhat roundabout, but it works.

I split the detail band into 3 sections (one for each child).

I put the necessary parent table fields in all three sections.

Then I put the each child's fields in its detail section.

To make only one detail line visible, I created separate formulas for each detail section that return IsNull(Childn.KeyField). Used this in the Format Section / Supress / Formula Editer.

To accomplish Group and Report level totals based on the child records, I used "Shared" variables and "Basic Syntax" for the formulas that initialize, increase, and display the Shared variables. Each formula needs to start with a Shared statement to declare the variables.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top