CAPI TEXT Condition in Group roster

Discussions about CSEntry
Forum rules
New release: CSPro 8.0
Post Reply
sham
Posts: 69
Joined: February 3rd, 2022, 7:30 pm

CAPI TEXT Condition in Group roster

Post by sham »

Dear all,

This is another challenge that I have been battling with in the CAPI text Condition.


In the CAPI text on variable(AMOUNTSPENT), I want to prefix the name of the fruit from curocc(1) and curocc(2) to read as follows;
How much did you spend on Maize in the past 7 days? And How much did you spend on Beans in the past 7days? Respectively.

I have done that and it’s working perfectly using the logic below;
How much did you spend on ~~VEGNAME~~ in the past 7days?

However, from curocc(3) and curocc(4) I want the CAPI text to only prefix the fruit name that was specify under the SPECIFY variable if any;
I have made references to the materials available about the “CAPI TEXT condition” but still not achieving the results.

Below is the logic I used; Both at the “CAPI text window” and that of “Condition window”
CAPI TEXT window1
How much did you spend on ~~VEGNAME~~ in the past 7days?
Condition1: curocc(FRUIT_REC000)=1

CAPI TEXT window2
How much did you spend on ~~VEGNAME~~ in the past 7days?
Condition2: curocc(FRUIT_REC000)=2

CAPI TEXT window3
How much did you spend on ~~ SPECIFY~~ in the past 7days?
Condition3: curocc(FRUIT_REC000)=3

CAPI TEXT window4
How much did you spend on ~~ SPECIFY~~ in the past 7days?
Condition4: curocc(FRUIT_REC000)=4

Any help on that as well.
I am most grateful.
Attachments
evidence2.png
evidence2.png (15.2 KiB) Viewed 3567 times
Evidence.png
Evidence.png (17.03 KiB) Viewed 3568 times
etuser
Posts: 85
Joined: September 3rd, 2019, 5:57 am

Re: CAPI TEXT Condition in Group roster

Post by etuser »

Can you please try the following, it might help

Define a string variable on crop global, like

PROC GLOBAL
string Crop_name;

On the PROC of "Specify" variable, write the following

PROC SPECIFY

if Length(strip($)) in 0 then
Crop_name = VEGNAME;
else
Crop_name = $
Endif;

on the CAPI TEXT write

How much did you spend on ~~Crop_name~~ in the past 7days?
sham
Posts: 69
Joined: February 3rd, 2022, 7:30 pm

Re: CAPI TEXT Condition in Group roster

Post by sham »

Hi,
@etuser and team, thank you very much for your time and your wonderful swift feedback.

I have use the logic and it partially working.
Partially means because there is a skip logic condition in SPECIFY variable, the logic could not prefix the names for maize and Beans since it does not apply to those occurrences . To simply put, CAPI Text does not pull or prefix those crop names at AMOUNTSPENT.
On the other hand, the logic is doing soo well for other1,other2 since SPECIFY is applicable to them if the response in CONSUME= yes(1).

After going through some of the reference materials including the Cspro help menu, I noticed I could incorporate "Notappl" in the logic to resolve that. Below is the modified logic from what you gave me;

PROC SPECIFY
if Length(strip($))= Notappl then
Crop_name = VEGNAME;
else
Crop_name = $;
Endif;

Despite the above effort, I am still not getting the results is there something that I missed.? and How do I resolve that?

Once again, I am most grateful for your time.

Thank you.
Attachments
Evidence4.png
Evidence4.png (15.34 KiB) Viewed 3552 times
Evidence3.png
Evidence3.png (13.32 KiB) Viewed 3552 times
etuser
Posts: 85
Joined: September 3rd, 2019, 5:57 am

Re: CAPI TEXT Condition in Group roster

Post by etuser »

Just putting the logic on the PREPROC of AMOUNTSPENT variable and it should work , like

PROC AMOUNTSPENT

preproc

if Length(strip(SPECIFY)) in 0 then
Crop_name = VEGNAME;
else
Crop_name = Specify;
Endif;
sham
Posts: 69
Joined: February 3rd, 2022, 7:30 pm

Re: CAPI TEXT Condition in Group roster

Post by sham »

Hi Family,
@etuser and Team, the logic is working perfectly.

I appreciate your time and support.

Thank you.
Post Reply