using getocclabel() in a roster

Discussions about CSEntry
Post Reply
mashour
Posts: 14
Joined: October 13th, 2015, 10:26 am

using getocclabel() in a roster

Post by mashour »

Hi,

I have used getocclabel() in a roster to capture the occurrence label and display it the CAPI text box, but sometimes it displays values for the previous occurrence if I decide to move back through the roster. So if my roster "SECTION_A" had a list of household items such as 1=chairs, 2=tables, 3=lamps, then by writing itemname=getocclabel(SECTION_A) I am able to display the questions "How many %itemname% do you own?". For the first occurrence it displays "How many chairs do you own?" and for the second "How many tables do you own?", etc.

However if I decide to move back using the left arrow key to correct a response in the previous row/occurrence, the occurrence label does not get updated and shows the occurrence label from the most recent occurrence. Obviously this can cause a lot of confusion in a big roster, where I am going back to change one value but can't orient myself in the table because of the incorrect label. Is there a way to fix it? I have tried storing the occurrence label during the onfocus/killfocus procedures but that causes a host of other problems. I am using the program in operator controlled mode.

M
josh
Posts: 2399
Joined: May 5th, 2014, 12:49 pm
Location: Washington DC

Re: using getocclabel() in a roster

Post by josh »

Instead of using getocclabel() in your logic, try putting it directly in the CAPI text. For example:
How many %getocclabel% do you own?
CSPro will automatically call getocclabel for you and put it in the question text. This way you can avoid coding the itemname = getocclabel(SECTION_A). This should always the correct label even when going back using the left arrow.
mashour
Posts: 14
Joined: October 13th, 2015, 10:26 am

Re: using getocclabel() in a roster

Post by mashour »

Hi Josh,

Thanks for the suggestion. I didn't know you could do that. However I'm now coming up against a different problem.

Suppose my occurrence labels were 1=chairs, 2=tables, 3=lamps, 4=other, and I allowed the user to specify what 'other' is, for example, desks. Then by using %getocclabel%, the text will read "how many other do you own?" instead of "how many desks do you own?". By storing getocclabel in itemname, I can replace the value of itemname with the other category for the 4th occurrence. Is there a way to still do this by using %getocclabel% in the question text?

M
josh
Posts: 2399
Joined: May 5th, 2014, 12:49 pm
Location: Washington DC

Re: using getocclabel() in a roster

Post by josh »

You could use setocclabel to change the label from "other" to the text that they entered. The only issue there is that you may need to set it back to "other" in certain cases.

The other option is to use your itemname variable but assign the value to that variable in the onfocus of every item that uses itemname in the question text.
Post Reply