Problem with Dynamic Pronoun Assignment and Indexing in Roster

Hi everyone,

I’ve created a household member list question (DEM_NAME) and linked a roster to this list. This roster contains all the demographic questions. I also created a variable (textr_YOU_NAME) to hold the index of the respondent. The goal is to use the pronoun “YOU” if the interviewer is referring to the respondent themselves.

For example:
What is %textr_YOU_NAME%’s relationship to %DEM_HEAD_NAME%?

The idea is:

  • If the roster entry corresponds to the respondent, the question should use the pronoun YOU.
  • Otherwise, it should use the person’s name from the list.

Here is the syntax used in the variable:
total_members == 1 ? “YOU” :
total_members >= 2 && @rowcode == DEM_RSP_PPNO ? “YOU” :
total_members >= 2 && @rowcode != DEM_RSP_PPNO ? DEM_NAME[@rowcode - 1].Item2 : null

The problem I’m facing:
When a person is deleted from the roster — especially the last one — the DEM_NAME list updates automatically, and the index no longer points to the correct individual. This causes incorrect names or references in the questions.

Any suggestions on how to handle this issue or a better approach to maintain the correct reference would be greatly appreciated!

The idea sounds good as a plan, but in reality may be vulnerable, e.g. to the interview being interrupted in the middle, and another person providing the rest of the responses as a proxy, in which case the interviewer will continue reading the questions as “How old are you?” and the proxy respondent will frankly answer about himself/herself, not about that original household member.

You/%rostertitle% is a better solution that gives the interviewer the indication of whom is the question about.

Your code refers to the @rowcode which is NOT an index. See the following illustration of the values of @rowindex and @rowcode when ABCDE were entered as list members and subsequently BC deleted. @rowindex (a zero-based index) is renumbered, but @rowcode is not.

1 Like