2 Replies Latest reply on May 13, 2012 1:04 PM by raybaudi

# Logical function problem: Selecting more than one value

### Title

Logical function problem: Selecting more than one value

### Post

Hello Friends! I'm having some issues with a logical function and I'm hoping someone here can help me.

I'm trying to create a database using one table for the analysis of ceramic artifacts from archaeological excavations. The way our analysis works is that each individual sherd is evaluated on a number of different features, such as Vessel Type, Estimated Time Period, Shape of the Vessel, etc. Now each of these features/attributes has a descriptive value list that the answer is chose from and a corresponding number code value list. For example: there are nine possible time periods a vessel could belong to, including Unknown, Initial Period, Early Horizon, etc. And each of those is associated with a number code, ie: Unknown = 0, Initial Period = 1, Early Horizon = 2, and so on.

Now I have figured out, using the the Case () function, how to make it so that when Initial Period is selected in the Estimated Time Period (Descriptive) field, 1 is automatically selected in the Estimated Time Period (Number) field. However, for some of our analysis attributes it's possible for more than one value to be selected, ie: a sherd can be both Initial Period and Early Horizon, in which case I would need 1 and 2 to be selected in the Number field. When I use Checkbox and select more than one value in the Descriptive field, however, nothing is selected in the Number field.

Here's the coding I've been using:

```Case ( Periodo Estimado_D = "No conocido - Unknown" ; 0 ;
Periodo Estimado_D = "Periodo Inicial - Initial Period" ; 1 ;
Periodo Estimado_D = "Horizante Temprano - Early Horizon" ; 2 ;
Periodo Estimado_D = "Huarás – Huarás" ; 3 ;
Periodo Estimado_D = "Intermedio Temprano - EIP" ; 4 ;
Periodo Estimado_D = "Horizonte Medio - Middle Horizon" ; 5 ;
Periodo Estimado_D = "Intermedio Tardío - LIP" ; 6 ;
Periodo Estimado_D = "Horizonte Tardío - Late Horizon" ; 7 ;
Periodo Estimado_D = "Colonial" ; 8)```

Like I said, I've got it to work when I only select one item from the list, but i need it to work when I select more than one choice from the list. I'm not sure if I need to use a different function or if there's something else I need to do.

I'd appreciate any help! Thank you!

• ###### 1. Re: Logical function problem: Selecting more than one value

I would not use a Case function here.

I would create a table with the periods and their code. That way it's easier to change or add periods or codes.
How ever I'm assuming Archoelogical periods don't change that often and that quick  :)

If you make a second table and create a relationship you can select multiple values, List ther respective codes and substitute the return charachters in that list to create a horizontal list.

Look at my example file to get an idea of how it works.

http://dl.dropbox.com/u/18099008/Demo_Files/MultiSelect_Archeology.fp7

• ###### 2. Re: Logical function problem: Selecting more than one value
`ONLY to solve your calculation problem ( DaSaint point is correct and you should do what he said ):List(If ( ValueCount ( FilterValues ( Periodo Estimado_D ; "No conocido - Unknown" ) ) ; 0 ) ;If ( ValueCount ( FilterValues ( Periodo Estimado_D ; "Periodo Inicial - Initial Period" ) ) ; 1 ) ;If ( ValueCount ( FilterValues ( Periodo Estimado_D ; "Horizante Temprano - Early Horizon" ) ) ; 2 ) ;If ( ValueCount ( FilterValues ( Periodo Estimado_D ; "Huarás – Huarás" ) ) ; 3 ) ;If ( ValueCount ( FilterValues ( Periodo Estimado_D ; "Intermedio Temprano - EIP" ) ) ; 4 ) ;If ( ValueCount ( FilterValues ( Periodo Estimado_D ; "Horizonte Medio - Middle Horizon" ) ) ; 5 ) ;If ( ValueCount ( FilterValues ( Periodo Estimado_D ; "Intermedio Tardío - LIP" ) ) ; 6 ) ;If ( ValueCount ( FilterValues ( Periodo Estimado_D ; "Horizonte Tardío - Late Horizon" ) ) ; 7 ) ;If ( ValueCount ( FilterValues ( Periodo Estimado_D ; "Colonial" ) ) ; 8 ))`