Extracting string varible from roster as a variable

Good evening,

I have a list of names and a roster where DOB can’t be stored as a calendar entry, as a respondent should be allowed to answer DON’T KNOW for month or date.

So the roster has the following separate questions:

q215d Day when born (numeric)
q215m Months when born (single-select categorical from 12 months options, where Jan…1 Feb…2)
q215y Year when born (numeric)

I need to display a summary of all names (from list) and dates of birth from a roster as a static text (as SurSol can’t show summary tables):

Name: %name1% DOB: %d1% %m1% %y1%
Name: %name2% DOB: %d2% %m2% %y2%

To do that I created variables: d1 m1 y1

Where d1 is a long integer variable: ros[1].q215d
Where y1 is also a long integer variables: ros[1].q215y

But for m1, when I create a string variable ros[1].q215m, it says I have a syntax error.

Now, I know that to get a name from a listing question I used a string variables using the following expression (where list is the listing question):

(new Func(() =>
{
var member = list.Select(x => x.Item2).ToArray();
return member[0] ;
})).Invoke()
etc.

Do you have suggestions on how can I create a string variable that would show a month as text for m1 (based on q215m)?

Thanks

Vladimir

Update:

When I create month as m1= ros[1].q215m as a long integer variable, it works but shows a number associated with the answer. 1 for Jan and 2 for Feb.
I would like to have a Month being shown as a string

Thank

V

One (not optimal) way to do that would be nesting inline if conditions
Misha

Update:

For sex I managed to get the strings for another string variablew using the following, for instance, sex (q213)

ros[1].q213==1 ?
“Boy” :
“Girl”

But that has only 2 options: 1 for boy and 2 for girl.
In my case, I have 12 options for number of months, so not sure how to structure the syntax.

V

Hi Misha,

Could you please provide some guidance on this, on how to start - and I will try to figure out the rest? Thank you

BW,
Vlad

http://www.tutorialsteacher.com/csharp/csharp-ternary-operator

Fantastic, thank you!