set attributes protect lock the next field in roster

Discussions about CSEntry
Post Reply
Jing Liu
Posts: 42
Joined: July 1st, 2015, 3:19 am

set attributes protect lock the next field in roster

Post by Jing Liu »

Hi,

I am trying to use code to control everything rather than to change 'field property'. And I found this strange thing happened. And may I ask if there is any command can be used to control the number of roster rows rather than filling in a field name into the 'Occurence control field' in roster property?

In my roster, HR01 is the sequential roster ID, Name is the next field for name. If I choose ‘sequentical’ and ‘protected’ in the field roster, then it works. But if I use the following command, then field ‘NAME’ cannot be entered. It is the ‘set attributes ($) protect’ make that problem.

PROC HR01
preproc
{Fill in sequencial number}
$ = Curocc();
{Field is protected}
set attributes ($) protect; // should change to protect in the field property, all the next field cannto be entered.

I am not sure if this is a small bug or did I do anything wrong?

best

Jing
You do not have the required permissions to view the files attached to this post.
josh
Posts: 2403
Joined: May 5th, 2014, 12:49 pm
Location: Washington DC

Re: set attributes protect lock the next field in roster

Post by josh »

Setting a field in a roster to protected while you are in the roster does not work. You need to do that before you enter the roster. Also setting a field in a roster as protected sets that attribute in all the rows in the roster not just the current row.

To control the size of the roster without the occurrence control field you can use the command endgroup when you get the last row you want them to enter. For example if you want 5 rows then in the first field of the roster you could have the following logic:

PROC HR01
// End roster after 5th row to limit number of rows to 5
if curocc() > 5 then
endgroup;
endif;

Alternatively you can have a field "More people" with the value set Yes - 1, No -0 in your roster. Then use the following logic to end the roster:

PROC MORE_PEOPLE
// End roster if no more people chosen
if MORE_PEOPLE = 0 then
endgroup;
endif;
Jing Liu
Posts: 42
Joined: July 1st, 2015, 3:19 am

Re: set attributes protect lock the next field in roster

Post by Jing Liu »

Hi Josh,

Thanks for your reply.

Yes, I would like to make one field protected for all the rows in roster. I just found that it is no problem when i click on the property of that field to 'protect' but lock the next field if i use the command in preproc. I did a bit more testing today. And found it create problem if the next field is alpha entry, but not for Num entry.

best

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

Re: set attributes protect lock the next field in roster

Post by josh »

Interesting. I found different behavior. In my test when I set the first roster field (a numeric) to protected in the preproc of that field it did not lock the next field (an alpha) however when I got the next row of the roster I was able to type into the protected field - in fact I was able to enter alpha characters into it although nothing was saved. When I set the field protected before entering the roster it worked as expected.
Jing Liu
Posts: 42
Joined: July 1st, 2015, 3:19 am

Re: set attributes protect lock the next field in roster

Post by Jing Liu »

Hi,

I am using CSPro 6.1.0 now. May be I can send you the program later can we can test the same program?

best

Jing
Post Reply