4 Replies Latest reply on Jun 16, 2010 3:44 PM by raybaudi

# Problem in a SCORE

### Title

Problem in a SCORE

### Post

Greetings to all. I am using FMP 11

I am suspended in the following thing: I am developing a form for a project of Psychiatry and I do not know like doing the following thing.

In a CheckBox field that has the following fields.
1) It indicates the situations to which it was exposed directly in the context of the catastrophe, can mark more than one:

• Earthquake
• Tsunami
• Civil Violence

I need that the program interprets to me that both first they are worth 1 point each and the last 2.The idea is that if the 3 are selected 4 points are had, if the first 1 is selected, etc.

My other doubt is in a RadioButton field with the following question:
7) So religious what is considered? It selects an option

• Very religious
• Quite religious
• Something religious
• Very little religious
• Nothing religious

Being the first 5 until arriving at it completes it with 0. The idea is that each phrase becomes to a number.

The objective is to be adding the points of each question.
The URL of the project is https://sourceforge.net/projects/plataformaudap/

It is in Spanish.Thanks beforehand.

• ###### 1. Re: Problem in a SCORE

You could create a calculated field for the catastrophe, returning a number, saying :

If(NOT isempty(Earthquake); 1; 0) + If(NOT isempty(Tsunami); 1; 0) + If(NOT isempty(Civil violence); 2; 0)

this will give you the total of points chosen by the using for catastrophes.

I am assuming you have a checkbox field for each catastrophe.

for the religious, create a calculated field, number type saying : (i am assuming your radio button is related to a field named "religion")

Case(

religion = "Very religious"; 5;

religion = "quite reliigous"; 4;

religion = "something religous"; 3;

religion = "very little religious"; 2;

religion = "nothing reliigous"; 1;

0

)

• ###### 2. Re: Problem in a SCORE

Mystick wrote:

If(NOT isempty(Earthquake); 1; 0) + If(NOT isempty(Tsunami); 1; 0) + If(NOT isempty(Civil violence); 2; 0)

Since this is a single checkbox formatted field with multiple selections, perhaps that should be:

If(NOT isempty(FilterValues ( Checkboxfield ; "Earthquake"); 1; 0) + If(NOT isempty(FilterValues ( Checkboxfield ; "Tsunami");); 1; 0) + If(NOT isempty(FilterValues ( Checkboxfield ; "Civil violence"); 2; 0)

There's also a function: ValueCount (checkboxfield) that will count the number of items selected for you if you only need the number of items selected.

• ###### 3. Re: Problem in a SCORE

Two other ways for the first problem, the first case insensitive, the last case sensitive:

```PatternCount ( CheckBox ; "Earthquake" )
+
PatternCount ( CheckBox ; "Tsunami" )
+
PatternCount ( CheckBox ; "Civil Violence" ) * 2```

```Evaluate ( Substitute ( CheckBox
; [ "Earthquake" ; 1 ]
; [ "Tsunami" ; 1 ]
; [ "Civil Violence" ; 2 ]
; [ ¶ ; "+" ]
) )```

• ###### 4. Re: Problem in a SCORE

A more general approach to your second problem...

```Let([
VL = ValueListItems ( Get ( FileName ) ; "YourValueListName" )
];
ValueCount ( VL ) - Position ( Filter ( Substitute ( VL ; RB ; "§"  ) ; "¶§" ) ; "§" ; 1 ; 1 )
)```

This calculation will assign a number to each value of a generical value list.

With a value list like your example, you'll have:

4
3
2
1
0