4 Replies Latest reply on Sep 11, 2012 3:26 PM by philmodjunk

# List function inside IF statement?

### Title

List function inside IF statement?

### Post

Hi,

I;m trying to create a list using the List function based on if another field is populated or not.

I've tried almost every combination of the List and IF in my calculation and have had no success.

An example:

On a related table, I have Field1 - I want to list these values in Field2 in the parent table if Field3 (Also in the parent table = "Yes"

Is this possible?  What is the correct combination of these two functions?

Thank You!

• ###### 1. Re: List function inside IF statement?

Field2 =

Case (

Field3 = ""Yes" ;

List ( Relationship::Field1 ) ;

"Nuttin'"

)

• ###### 2. Re: List function inside IF statement?

Okay, cool.

That does work, but it then lists all valuse from Field1.

Is there a way to list only the values from records where Field3=Yes?  THey are both on the same table.

Thanks!

• ###### 3. Re: List function inside IF statement?

Sorry: don't understand.  Field1 and Field3 are in the same (Parent) Table?

So if Field3 in the Parent Table record  is 'Yes', Field2 in the Parent Table lists all the related values to that Parent Table record of Field1 in the related table.
If Field3 is 'No' it does not list any related fields.

Not clear what you mean instead of that.

• ###### 4. Re: List function inside IF statement?

Include yes as part of the relationship between the two tables and then list will only list those values where the value in field 3 is "yes".

Parent::PrimaryKey = ChildYes::ForeignKey AND
Parent::constYes = ChildYes::Field3

Then a calculation field in parent defined as:

List ( childYes::Field1 )

will return only those related records where Field3 = yes due to the fact that only records where the value of field 3 is yes can be related in this relationship.

constYes can be defined as a calculation field with "Yes" (in quotes) as the calcualtion expression so that this field has the same value for all records in Parent.

ChildYes can be a new occurrence of Child if needed in order to keep an existing relationship between Parent and Child from being modified.