Urgent help on adding Skips

Discussions about CSEntry
Post Reply
shrestharaj
Posts: 2
Joined: August 18th, 2013, 4:11 am

Urgent help on adding Skips

Post by shrestharaj »

I am learning to use CSPRO. And during the process of making a questionnaire I am stuck on the part of adding logic. For example I having a 1-10 rating questionnaire, followed by 3 questions related to it. If the response is between 1-6 he/she answers 1a then if 7-8 he/she answers 1b and if its 9-10 he/she answers 1c. Then moves to the next question i.e 2. I would like to get the syntax/logic statement for this.

Your early response and help will be highly appreciated.
kakinyim
Posts: 42
Joined: January 16th, 2012, 6:38 am
Location: Remote/Virtual

Re: Urgent help on adding Skips

Post by kakinyim »

shrestharaj,

Welcome to the CSPro family.

I urge you to study 'SKIP' documentation by pressing F1 when at the design mode. I have pasted below some notes from the documentation of 'SKIP' function.

If you still have doubts, please get in touch.

Mutua


Skip Statement Documentation

Format 1:
skip [to [next]] field-name;

Format 2:
skip [to [next]] alpha-variable;

Format 3:
skip [to] next;


[ ] indicates that this part is optional.


Description:

The skip statement skips to the specified field. If the field has multiple occurrences, either record or item, the occurrence number must be specified to skip to the correct occurrence.

The "next" keyword skips to the next occurrence of field-name where "field-name" is a multiple-occurrence field. If "field-name" is in the same record or group as the current field, control will move to the next occurrence of "field-name". If "field-name" is not in the same record or group as the current field, control will move to the first occurrence of "field-name". Occurrence numbers cannot be used with the next keyword.

If the "field-name" is not specified after "next" (format 3), control will move to the next occurrence of the first item in the group. This is a useful way to skip to the beginning of the next occurrence.

"Field-name" can be located in any record at the same level as the current field, but it cannot be located at a different level. "Field-name" must be the name of a field that has not yet been entered. If "field-name" has already been entered, an error message will be displayed during data entry and data entry will be aborted. If you don't know whether the field has already been entered, use the move statement.

The field name can be given directly by naming the field or indirectly by using the contents of an alpha variable.

When a skip statement is executed, the preproc of field-name, if any, will be executed. None of the statements between the skip statement and the preproc of "field-name" will be executed. Skipped fields are assigned the special value of NOTAPPL.

Note that the skip statement behaves differently from the advance statement.

Example 1:

if Q305 <> 2 then
skip to Q307;
endif;

Example 2:

if Q202 <> 1 then
skip to next Q201;
endif;
Gregory Martin
Posts: 1796
Joined: December 5th, 2011, 11:27 pm
Location: Washington, DC

Re: Urgent help on adding Skips

Post by Gregory Martin »

If your initial 1-10 rating is in a field called RATING and the question after questions 1a-1c is called NEXT_QUESTION, then your code could look like this:
PROC RATING

    
if RATING in 7:8 then
        
skip to QUEST_1B;

    
elseif RATING in 9:10 then
        
skip to QUEST_1C

    
endif;


PROC QUEST_1A

    
skip to NEXT_QUESTION;


PROC QUEST_1B

    
skip to NEXT_QUESTION;
Cecilius
Posts: 6
Joined: July 19th, 2016, 12:59 pm

Re: Urgent help on adding Skips

Post by Cecilius »

Excellent answer Gregory, exactly I need this... I was using 1 or 2 :roll:

Syntax works 100% to skips
Post Reply