Moving to outside of a roster and then re-entering it.

Discussions about CSEntry
Forum rules
New release: CSPro 8.0
Post Reply
Jayanta
Posts: 9
Joined: July 28th, 2021, 4:04 am

Moving to outside of a roster and then re-entering it.

Post by Jayanta »

Hi All,

I have this query of moving to fields outside of a roster and then re-entering the roster. Kindly help me achieve this scenario.

For instance, I have a roster TABLE1_FORM. It has 4 rows and one column as RESPONSE. 4 corresponding fields, that is DESC1, DESC2, DESC3, DESC4 are present outside the roster aligned to each row of the roster.

The flow for these fields is as :
(1) if RESPONSE value is > 0 for any row, let's say Row1, it moves to the outside field aligned to it, that is DESC1.
(2) After entering value for DESC1, it should re-enter the roster and move to next row, that is Row2.

This process should continue till it reaches DESC4 after which it moves to the next section.

My code is as such:

Code: Select all


PROC RESPONSE
PREPROC
if CUROCC() = 1 and RESPONSE(1) >0 then skip to next;
endif;
if CUROCC() = 2 and RESPONSE(2) >0 then skip to next;
endif;
if CUROCC() = 3 and RESPONSE(3) >0 then skip to next;
endif;
if CUROCC() = 4 and RESPONSE(4) >0 then skip to next;
endif;

POSTPROC
if CUROCC() = 1 and RESPONSE(1) >0 then move to DESC1;
endif;
if CUROCC() = 2 and RESPONSE(2) >0 then move to DESC2;
endif;
if CUROCC() = 3 and RESPONSE(3) >0 then move to DESC3;
endif;
if CUROCC() = 4 and RESPONSE(2) >0 then move to DESC4;
endif;

PROC DESC1
move to TABLE1_FORM;
PROC DESC2
move to TABLE1_FORM;
PROC DESC3
move to TABLE1_FORM;


Please find attached the image of the respective ROSTER/FORM.
Image

However, this logic fails when you are modifying an entered data or partially saving it. :(
Kindly let me know, if this is the correct way to do it. Or do we have any other solution for this. Thanks in advance. :)
sherrell
Posts: 397
Joined: April 2nd, 2014, 9:16 pm
Location: Washington, DC

Re: Moving to outside of a roster and then re-entering it.

Post by sherrell »

Hi Jayanta,

Is there a reason you're not putting the 4 descriptor fields (DESC1-DESC4) in the roster? For you really want to include those fields within the roster. You also don't need the preproc logic, and the postproc logic can be drastically simplified.

So, your table will have 4 rows and TWO columns. The only logic you need is:

PROC RESPONSE
if $ = 0 then
skip to next; // don't collect DESC field when response=0
endif;

By default, if you don't stipulate preproc or postproc, logic is considered postproc. So, unless you need to have logic in an onfocus or preproc or killfocus block, you don't need to write postproc. $ is the abbreviation for the variable in the current block.

Sherrell
Jayanta
Posts: 9
Joined: July 28th, 2021, 4:04 am

Re: Moving to outside of a roster and then re-entering it.

Post by Jayanta »

Thanks sherrell for your prompt response.
But it is kind of necessary for me to put the DESC fields outside the roster, because we cannot copy/paste data inside the roster. With DESC fields outside the roster, you have the option to copy data from external file, and by right clicking the outside field in CSPro and clicking on Paste option you can paste the copied data.

My code works when you enter 1 set of data in one go. But, it would fail if you modify a entered data or partially save it.

Kindly let me know if there is any alternative solution for this. Thanks :).
Gregory Martin
Posts: 1777
Joined: December 5th, 2011, 11:27 pm
Location: Washington, DC

Re: Moving to outside of a roster and then re-entering it.

Post by Gregory Martin »

This isn't directly answering your question, but if you want to paste into a field (without tickmarks) on a roster, you can trigger the "context menu" with the paste option by pressing Shift+F10. Or, if your keyboard has it, you can use the Menu key: https://en.wikipedia.org/wiki/Menu_key
Jayanta
Posts: 9
Joined: July 28th, 2021, 4:04 am

Re: Moving to outside of a roster and then re-entering it.

Post by Jayanta »

Thanks Gregory. Thanks a ton. This will do my job. 🤗.
Post Reply