Help for logic code

Discussions about CSEntry
PEHAN Boré Hermann
Posts: 3
Joined: July 23rd, 2016, 2:22 pm

Help for logic code

Postby PEHAN Boré Hermann » January 26th, 2018, 7:03 pm

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.
Attachments
Essay.7z
(4.73 KiB) Downloaded 67 times

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

Re: Help for logic code

Postby josh » January 29th, 2018, 4:57 pm

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;

Rodriguez Ajabu
Posts: 1
Joined: February 20th, 2018, 8:49 am

Re: Help for logic code

Postby Rodriguez Ajabu » February 20th, 2018, 9:02 am

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.

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

Re: Help for logic code

Postby josh » February 20th, 2018, 9:58 am

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.


Return to “Entry”