Page 1 of 1

Help for logic code

Posted: January 26th, 2018, 7:03 pm
by PEHAN Boré Hermann
Hello Sir,
I needed an help.
I have a table like the file's attached.
I want to put in column "Expensive total" the somme of "expensive 1", "expensive 2", "expensive 3", ..., "expensive 8".
Also, i would like that if medecine (i)="", to skip to "Type of patient".
Is there somebody to help me to get this logic code?

Thank everybody for your eventual helps.

Re: Help for logic code

Posted: January 29th, 2018, 4:57 pm
by josh
To compute a sum you can just add the variables together:

EXPENSIVE_TOTAL = EXPENSIVE_1 + EXPENSIVE_2 + EXPENSIVE_3 ....

You can do this in the preproc of EXPENSIVE_TOTAL

For the skip you just need to use the skip command and and if then else expression. The only tricky part is that you need to use strip to remove the padding (the extra spaces) since alpha values in CSPro are fixed length.
if strip(MEDECINE_1) = "" then
    
skip to TYPE_OF_PATIENT;
endif;

Re: Help for logic code

Posted: February 20th, 2018, 9:02 am
by Rodriguez Ajabu
Hello,

I'm creating my application but I'm hooked on a display instruction.
for Q1 the answer is either 1 = yes or 2 = no, Q2 is 1 = yes or 2 = no, Q3 is 1 = yes and 2 = no
so, I would like that at the level of Q4 only the labels that received 1 could appear.

Re: Help for logic code

Posted: February 20th, 2018, 9:58 am
by josh
Next time please create a new post instead of replying to an unrelated topic.

What you want to do is commonly referred to as "dynamic value set" in CSPro. The function to use is called setvalueset(). You can look in the help for info on that function. You can also search this forum for "setvalueset" and "dynamic value set" to see related questions.