Creating Fills in Questions

Discussions about creating CAPI applications to run on Android devices
Forum rules
New release: CSPro 8.0
Post Reply
Anthony
Posts: 1
Joined: June 2nd, 2018, 12:34 am

Creating Fills in Questions

Post by Anthony »

Dear Cspro Team.
Want to know how to set fills in questions .
I use" % variable% " it always display the correct value which was captured.
But now the issue is; I have developed a capi application, has a roster which is set to 23 max. The first Item is "Asset_code" with values 1- 23 each have its own value label.like House=1, car= 2, bicycle =3,...23.
, the next Item is "Doyou_ownthis_asset".. I pre inserted the codes for Asset_Code so that each line represent asset name. So when i put the fill in question on capi " Do you own %Asset_Code%?. It brings the asset code not the value. Like "Do you own 1" but i wat it to display "Do you own House?", When I go to line 2 it should read "Do you own Car?" And so on to 23.
josh
Posts: 2399
Joined: May 5th, 2014, 12:49 pm
Location: Washington DC

Re: Creating Fills in Questions

Post by josh »

There are two ways you do this in CSPro:

1) Use occurrence labels

On your roster set the occurrence labels to the asset name for each row of the roster. Then in your question test use %getocclabel% to use the occurrence label as the fill i.e. "Do you own %getocclabel%?". For details on how to set the occurrence labels see http://www.csprousers.org/help/CSPro/oc ... abels.html

2) Use a user defined function as fill in the question text (requires version CSPro 7.1 or later)

Create a function in the proc global that gets the asset name for the current row of the roster:
function string getAssetName()
    getAssetName =
getlabel(ASSET_CODE, curocc(ASSETS_ROSTER));
end;
where ASSETS_ROSTER is the name of the roster containing the asset code field.

Then use that as a fill in the question text: "Do you own %getAssetName%?".

Both of these approaches are documented in the help: http://www.csprousers.org/help/CSPro/cr ... tions.html
Post Reply