Have an idea?

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

From free format with random list members resorted into correct brands

Hi all ... this is what I'm trying to do:

Brand list containing ~ 100 brands.  Each person see 40 (randomly selected).  These 40 are shown using a free format question with radio buttons (so Q1_r1 will have a label [%listvalue(Q1Ask,1)%] and will have an answer from 1 to 4, but the label could be any one of the 100 brands in the list.  Obviously, analysing this is painful and knowing how many times (on the fly) each brand has been shown is not possible.

So this was my solution (not pretty, but it does work):
I set up 100 constructed lists (Brand1 to Brand100) and used perl to determine which row (if any) within the free format question held data for that brand and recorded the value the respondent gave it.  I then set up another free format question to "call" each of these lists (so that they would set correctly).  As I say, this works - it means that if the label for Q1_r1 is showing brand48, the result from Q1_r1 is stored in the list Brand48.  It means I just export the second free format question and all is well.  And I can tell through the admin module how many times Brand48 has been shown.

My problem is that there is so much perl that the survey appears to freeze as it works it all out.  Can take a minute or so - far too long.  I have the perl for each list in a loop, so in terms of lines it's not very long but there's still too much to do, obviously.

Can anyone enlighten me with a more elegant/less resource hungry way of achieving the same thing?
asked Nov 11, 2011 by Marion Silver (5,240 points)
p.s. the reason why the question is in free format:
It actually started life out as a grid.  But the client wanted labels spanning two of the column headings.  If there is a way to do THAT in a grid question, the free format stuff, although good to know, is moot.
which version of ssi are you running?
version 7.0.22

2 Answers

0 votes
Best answer
I don't get why you meddle with reassigning the radio buttons to data in the first place. Define 100 (rows of) hidden radio buttons (basic css), each mapping their original indexes and only show the ones you want to show (random, etc) , when any of your radios are selected they will use their original values...

As for your free format necessity, can you show a screenshot on what you want to achieve and couldn't do with grid?

Edit, final solution :

This requires some more image editing, but should give you enough ideas to make it much better looking...
You can download the .ssi file from the link below. Check the column labels (image split into 4) the advanced tab (for border css) and the row labels themselves.

answered Nov 11, 2011 by Bahadir Ozkurt Gold (16,980 points)
edited Nov 14, 2011 by Bahadir Ozkurt
I've taken a screenshot but can't upload.  but if you can picture it, there's two columns - HAVE SEEN and HAVE NOT SEEN.  Beneath these, there are four columns - WOULD BUY, and WOULD NOT BUY both underneath the HAVE SEEN label, and then a WOULD BUY TO TRY and a WOULD NOT BUY underneath the HAVE NOT SEEN label.  Then we get the actual brand labels and the response options (4 to each label).  If you can figure out how I can meddle with this stuff outside using freeformat and reassigning radio buttons I'd be pleased to hear about it.

Oops - looks like Paul jumped in on my behalf there to explain the question, but I didn't see his comment before I answered.

Sorry, Paul ...
Paul opened another question, rather than a comment :)

Marion give me a few hours
something like this?

just imagine it will have better borders around and enclosing the columns below have seen and have not seen
Pretty much EXACTLY that, with images and, as you say, borders, etc.
@Marion, as far as the trying to do this in non-free format, you only want to know how to re-assign the radio button groups (ie 2 option pairs per brand)?  Or are you looking to work some dom manipulations also (ie restructuring the grid)?
Hi Ryan ... the radio buttons don't need re-assigning, or anything like that.  I just need to make the grid have a similar format to what Bahadir's screenshot shows - ie having labels across the two sets of column headings.  If there's a way of doing that WITHOUT using free format, I'm all ears! (and, of course, the client will almost without doubt also want either the column labels and headings "frozen" in place so they are always visible, or at least repeated down the grid).
That screenshot is from a grid question that uses a constructed list for rows and its logic is

This way the data is written where it's supposed to be, without any recoding at all.

The text in the upper side is just plain text entered into the Grid Text -> Grid header box. I believe you know enough css and JS to make the necessary format changes (like adding left borders to columns 2 and 4 and right borders to column 3 and 5) so that it looks nicer.

As for freezing the headers, you'd probably want to define a div with the header texts at an absolute position and adjust the rest to this div.

If you need pointers, let me know and I'll see what I can come up with.
Cheers, Bahadir ... yes, this question did start out life as an ordinary grid.  When the client insisted on the additional feature (the column-spanning labels) I did try coming up with something while still using the grid, but couldn't make it look any good at all, and couldn't get the labels to repeat.  Didn't even try freezing the headers.  So (hanging my head) it appears I don't know as much css or js as you give me credit for.  Any pointers would be gratefully received.
I believe you wanted to comment rather than answer :)

I'll try to prepare something that you can use as a base. But due to the seemingly obvious time difference it may be tomorrow when I'm done.

can you just give me details such as:
- are you using a fixed width for your questions or survey (or is it OK if I introduce a fixed width question)
- will there be always 40 rows? how often you want the headers repeated? every 10 rows?
- is there any specific style you are using that may cause your pages look different than the one I'll be setting up?
Yeah, I wanted to comment - I'd just woken up.  Sorry about that :-)

Thanks SO much for your help.  The brands will hold images as well as text, and thus are quite big.  I'm creating each one as a little table to hold the brand name exactly where I want it (to the right of the image, in the middle).  This being the case, I'll need to repeat the rows every 3 brands.  Unless freezing the headers is easier ...

There will always be 40 brands, but I'll be splitting it across two questions (so 20 per page).

The style I'm using for this is oceanic with graphical navigation and response buttons turned off.  I usually force a page width of 1000, but haven't for this one, so it's of course fine to introduce a fixed width question. (The wee tables I'm creating as a codeframe are 200 wide - ie <table border=0 rules=none frame=box width="200">)

This requires some more image editing, but should give you enough ideas to make it much better looking...
You can download the .ssi file from the link below. Check the column labels (image split into 4) the advanced tab (for border css) and the row labels themselves.

Bahadir, very nice solution!  Thanks heaps!
you're quite welcome sir :)
0 votes
I would have BrandList which defined the 100 brand names. I would then create a constructed list called BrandConList which looks something like this ...


*Note - not sure if the brands are coming off another question? Otherwise adjust the constructed list accordingly using an AIC command.

Create a new parent list called Q1BrandList which would have 40 brands defined as follows ...

1 ListLabel(BrandConList,1)
2 ListLabel(BrandConList,2)
3 ListLabel(BrandConList,3)
39 ListLabel(BrandConList,39)
40 ListLabel(BrandConList,40)

Assuming there will always be 40 brands in the list, you can use the Q1BrandList to display at Q1. The constructed list BrandConList (1st 40 variables from this list stores the 40 brands). The beauty of this is you are using less Sawtooth questions (40 instead of 100). You can also save each brand into it's own free format hidden question if you desire. That way the export is down to 40 fields rather than 100 which is the case when exporting the constructed list BrandConList.

So this method should tell you what brands are 1st, 2nd, 3rd, ... 39th, 40th, etc.
answered Nov 11, 2011 by Paul Moon Platinum (97,120 points)
Sorry, Paul, but I don't understand how this is different from what I've done already.  Selecting my 40 random brands isn't the problem, and of course I could just export the first free format question (Q1 in my example) and my randomised list (Q1Ask in my example).  I may of course be missing something, but how are the responses for each individual brand aggregated?
As discussed over the phone Marion, it may pay to export the relevant data out to Excel (or some other analysis software) and provide the figures that way.

Quotas with high targets that will never be reached (used for displaying only) can display the brands asked. A bit more difficult to break each brand down by the 4 possible answers.