Generate CAPI questions

Discussions about creating CAPI applications to run on Android devices
Forum rules
New release: CSPro 8.0
arkagwa
Posts: 119
Joined: November 18th, 2014, 5:25 am

Re: Generate CAPI questions

Post by arkagwa »

Dear Josh

Kindly assist i am using %NAME% where NAME is the coding variable to recall the answer of previous question for the next question so that the interviewer can read the previous answer. I have noted that in numeric answers/value sets, the next question displays number of the value set instead of the label. In this picture the value set is 11 coded as cartridges
Screenshot 2018-10-29 21.30.23.png
Screenshot 2018-10-29 21.30.23.png (21.69 KiB) Viewed 107177 times
Attachments
Users Instrument.zip
(26.15 KiB) Downloaded 255 times
Gregory Martin
Posts: 1777
Joined: December 5th, 2011, 11:27 pm
Location: Washington, DC

Re: Generate CAPI questions

Post by Gregory Martin »

You have to assign the label in logic. One way to do it is by creating a function:
PROC GLOBAL

function string StockItem1Label()
    StockItem1Label = getlabel(STOCK_ITEM1, STOCK_ITEM1);
end;
Then use %StockItem1Label% in the CAPI text.
arkagwa
Posts: 119
Joined: November 18th, 2014, 5:25 am

Re: Generate CAPI questions

Post by arkagwa »

Dear Josh

On the same form attached in the previous question, i have a code to check if disposed quantity is greater than stocked amount.
In case data is not available, i have a special code of 9,999=Missing.
When i am making the sum as indicated below i find error on the sum because the missing value has been included in the summation. What coding should i add to avoid it?

Example code:
totstock=STOCKED_2013 + STOCKED_2014 + STOCKED_2015 + STOCKED_2016 + STOCKED_2017 + STOCKED_2018;
totdisposal=QUANTITY_2013 + QUANTITY_2014 + QUANTITY_2015 + QUANTITY_2016 + QUANTITY_2017 + QUANTITY_2018;
If totdisposal>totstock then errmsg(7);
reenter QUANTITY_2013;
endif;
Gregory Martin
Posts: 1777
Joined: December 5th, 2011, 11:27 pm
Location: Washington, DC

Re: Generate CAPI questions

Post by Gregory Martin »

Take a look at this: http://www.csprousers.org/help/CSPro/se ... ement.html

You can use that functionality to change the behavior of mathematical operations so that special values (missing, notappl, default) are treated as 0 values.
arkagwa
Posts: 119
Joined: November 18th, 2014, 5:25 am

Re: Generate CAPI questions

Post by arkagwa »

Dear Martin

Thanks for your support, works very nice
btri Arjun
Posts: 37
Joined: August 17th, 2018, 6:09 am

Re: Generate CAPI questions

Post by btri Arjun »

Dear CSPro uesr

I developing a CAPI application. For this, I defined the CAPI language "ENG" = English (_VS1) and "NEP" = Nepali (_VS2). First of all I have added all CAPI question, label and code in English. After then, I added the Nepali CAPI question, label and code as well. Now, when I changed the language from Option menu, the CAPI question changed in Nepali but the label and code not changed (shows in English). I cant fond the mistake.

Thank you

With best regards
Arjun
Gregory Martin
Posts: 1777
Joined: December 5th, 2011, 11:27 pm
Location: Washington, DC

Re: Generate CAPI questions

Post by Gregory Martin »

See these posts:

http://www.csprousers.org/help/CSPro/de ... uages.html

http://www.csprousers.org/help/CSPro/mu ... aries.html

Instead of creating different value sets for each language, which was the only way to do this in older versions of CSPro, you will want to create a multiple language dictionary. Add "ENG" and "NEP" to the dictionary and then set the labels as appropriate. Once you do this, when you change the language, the 1) question text; 2) value sets; 3) form labels should all change.
btri Arjun
Posts: 37
Joined: August 17th, 2018, 6:09 am

Re: Generate CAPI questions

Post by btri Arjun »

Dear Gregory,

Thank you for your response. Than, I tried to my label best to do this, but its not working. So, I have attached my application in this email. Please have a look in my application and suggested me what mistake I have made.

With best regards,
Arjun.
Attachments
APPs.zip
(37.64 KiB) Downloaded 260 times
Gregory Martin
Posts: 1777
Joined: December 5th, 2011, 11:27 pm
Location: Washington, DC

Re: Generate CAPI questions

Post by Gregory Martin »

You need to add the multiple languages under the same value set name. For example, look at the screenshot.
languages.png
languages.png (8.63 KiB) Viewed 106890 times
Instead of having two values sets, you should only have one. Click on the language bar, change to NEP, and then modify the value labels from Yes/No -> चाहन्छु/चाहन्न. In other words, you will never have two value sets, one for English and one for Nepali, but will instead have one value set with two sets of labels, one in English and one in Nepali.
Post Reply