Page 1 of 1

write value in roster culomn

Posted: September 9th, 2016, 2:44 pm
by xcode
in my roster i have a size column contain
1 -350 gr
2 -450 gr
3 -650 gr
.
.
..
and next column in the roster is empty i want when user select 1 from size column the system write 000.350 in the second column and so on

Re: write value in roster culomn

Posted: September 10th, 2016, 2:23 am
by josh
In the PROC for your size column you can assign a value to the second column. For example if the dictionary variables for your columns are named SIZE and SECOND then you could write logic like this:
PROC SIZE

if SIZE = 1 then
    SECOND =
0.350;
elseif SIZE = 2 then
    SECOND =
0.450;
elseif SIZE = 3 then
    SECOND =
0.650;
endif;
You could also look at the recode command which is similar to a series of if, elseif but offers a more compact syntax. Details on that are available in online help.

If you don't want the user to be able to change the value in the second column then you could use the command noinput in the preproc of the second column to prevent user input or you could set the field to protected by right clicking on it and choosing "Field properties". Again you can look in the help for more info on protected fields and noinput.

Re: write value in roster culomn

Posted: September 10th, 2016, 9:02 am
by xcode
done thanks :)

Re: write value in roster culomn

Posted: September 10th, 2016, 10:17 am
by xcode
another question . regarding the above question i have in the size column "98-other weight" i want when the user select this the second column be available for writing as i make it protected field how can i remove protection programmatic.
i tried noinput but the user could go back and change the value even for fixed size so i need to use field protected instead of noinput.

Re: write value in roster culomn

Posted: September 11th, 2016, 1:12 am
by jfigueroa
hi xcode,

to protect a field in logic you need to use the set attributes statement.
You can do someting like this:

Code: Select all

set attributes (my_field) protect;
That way the operator is not gonna be able to access, modify or change field value in any way.
and to unprotect the field you use:

Code: Select all

set attributes (my_field) native;
For more information about how to use it, you can take a look at the set attributes statement on CSPro help. (Pressing F1).

Regards.
Joshua Figueroa.

Re: write value in roster culomn

Posted: September 11th, 2016, 9:39 am
by xcode
many thanks Joshua.