Have an idea?

Visit Sawtooth Software Feedback to share your ideas on how we can improve our products.

User Nouman Saeed

Member for: 3 years
Type: Registered user
Full name: Nouman Saeed
Organization: Aftab Associates
Location: Pakistan
Website:
About:

Activity by Nouman Saeed

Score: 820 points (ranked #54)
Title: Bronze
Questions: 19 (1 with best answer chosen)
Answers: 3
Comments: 19
Voted on: 2 answers
Gave out: 2 up votes, 0 down votes
Received: 0 up votes, 0 down votes

Wall for Nouman Saeed

Please log in or register to post on this wall.
Nouman,

Code like that can almost always be shortened and simplified using loops.  The most common loops you will use in virtually any programming language are "for," "foreach," and "while."  Each of these behaves similarly, but it is often easier to use one of them over the others for a given task.  There are plenty of examples of using each loop type online.

For what you have in mind, I think "for" is the best tool for the job.

for (var i = 1; i <= 6; i++) {
    if (input.id == 'E1_c' + i + '_7') {
        for (var j = 1; j <= 6; j++) {
            if (i != j) {
                SSI_RadioReset('E1_c' + j);
            }
        }
    }
}


I would recommend comparing my code to your own to get a deeper grasp on exactly how it works.  A few specifics:

* Note the syntax for how a for loop is created.  There's three parts inside the parentheses: the creation and initial value for the variable to use, the final value for the loop to go to, and the "i++" that tells the code to go up from the start value to the end value in steps of 1.
* Note how both loops are followed with a pair of braces ("{" and "}").  The code between those braces will run N times.  Between those braces, the loop variables "i" and "j" tell us which loop iteration we are on.
* Note how "+" can be used to combine strings.  Now that we have a variable "i" that is iterating from 1 to 6, we can use "'E1_c' + i + '_7'" to give us "E1_c1_7," "E1_c2_7," and so on.

There are some other more advanced steps I would take in rewriting this code, but this seems like a good start for now.
Oct 24 by Zachary
Nouman,

My initial impression is that the font behavior you are observing is a problem with the Android device rather than Offline Surveys.  If you look into your device's settings, can you find an area related to font support?  Perhaps an area for certain formats to be downloaded to the device?

Our support team may have more experience with font-related problems.  They may be able to offer further insight at support@sawtoothsoftware.com.

- Zachary
Jul 7, 2017 by Zachary
...