Auto increment variable or questions

I am new to SS but was using CSPro and in CSPro I was able to generate an auto-increment serial number base on the number of questionnaire and starting from any desired number.

Can I do so in SS.
I wish each of my questionnaire to have a serial number which is auto incremental thus ensuring two questionnaires not having the same serial number. I would prefer doing so into a variable.


Not clear what you mean. We need more info.
In Survey Solutions each interview is assigned a globally unique number. No two interviews could have the same interview id. Additionally, we also generate interview key, which is a human readable unique number. Theoretically, it could be repeated, but one would need to generate billions of interviews to produce the duplicate.

I am not sure about your question because interviews could be generated from assignments on tablets in offline mode. So, one tablet does not know what is happening on the other tablets. So, I am not clear how you can have an auto-increment in a situation when each interview is independent from all others.

Please clarify.

No need. You give me just what I was looking for. Just explain to me how to generate the interview key. Apologies. Its been five days since I am using SS and without prior training and have not launch the app on a tablet yet. I understand what you mean by assignment but have not been through yet. I am in the designing phase only.
Thank for your comprehension. :yum:

Interview key is generated for each interview is supposed to be used to communicate between team members about any particular interview. It not supposed to be used in conditions.

If you need some value that is “unique” per interview to do some randomization, you can use Random variable that is generated by the system Quest.IRnd. It will produce different floating number between 0 and 1 that doesn’t change during interview flow, but is different for each interview

Noted! Thanks. But can I serially marked each questionnaire?

No. Each interview is independent and created offline on Interviewer tablet, you cannot give unique serial number across offline devices

Jeanbernard, I think you are confusing interviews and questionnaires. This is not the same in Survey Solutions.

Assuming you are doing a survey of 10,000 households and want to have households numbered uniquely 1…10,000 create 10,000 assignments and preload a unique serial number 1…10,000. This number (your household sample number) will be retained and shown on the dashboard of the interviewer. It will also be exported in the final sample. It will not affect our internally generated interview key, which must be unique across ALL surveys running on the same server.

If your assignments call for more than 1 interview this does not apply.

Oh, yes and by the way, how would you do that in CSPro? Generate a sequential and unique number of interview on, say, 100 tablets used simultaneously?

Actually you are right. What I meant was interview. Let’s get back to CSPro. In CSPro there is is function call “VisualValue” which seek (lets say snumber) on the previous interview and increment from there. Given I have 10000 interviewers, all will depend on the quota assigned to each interviewer. Therefore each tablet will start from a given number. So once I grouped everything together, there a unique serial number for each interview.

Sorry to insist but I really need a generating increment in my questionnaire. My point (I understood what you explained above, thanks) I have an optional section (say evaluation) comprising of three subsections (say eva 1, eva 2 and eva 3). If one respondent answers all three he will be bored and my interview will take too much time. I wish to automatically assign an option per interview and rest assured that out of three interviews, I have one of each.

If you can help.

The main point we are trying to make is that you cannot assign sequential numbers to interviews that are conducted on tablets in offline mode. Each tablet does not know what is going on on other tablets.

Straight to the point! I love that and that stuck in my mind - no worries. But on the same tablet, can I (in a way or another) alternate a section without relying on the interviewer to do so?

I mean during the questionnaire design

There may be an alternative - to use the random number stored in Quest.IRnd and enable/show those questions only when it is < .5, this way (approximately) 50% of your interviews will have it shown. You can try to do finer ‘selection strategy’ by preparing some random number column as a part of your assignment as well.

Thanks to all of you (for your help and most of all patience and understanding :innocent:).

Dear Misha and Jean Bernard,
I’ve solved this in Cspro by creating an user defined function who create a sequential number for each questionnaire based on:
1.- Tablet MAC ID or Processor ID or Android ID who’s transformed in numeric number;
2.- Enumerator ID. A numeric number assigned to each enumerator;
3.- A range series of number (Min-Max) Allocated to each enumerators:
So, even if we collect data offline, we have unique sequential number for each questionnaire.
Best Regards,

There is no easy way of generating unique id on each device (you can get more details here). There are ways to generate unique ids in distributed systems, but I haven’t seen an implementation for them to be sequential.

Dear Andrii,
However i implement it with Gregory Martin’s help in CSPro years ago and it run fine.
Best Regards,