Automatic calculation (auto fill function ?)

Discussions about CSEntry
Forum rules
New release: CSPro 8.0
Post Reply
Guest

Automatic calculation (auto fill function ?)

Post by Guest »

Hello,

I need some help with automatic calculation.

I created a form with multiple record, one of the record is set to have max 3 occurrences.

In the record with max 3 occurrences, the first field is "Year". I would like the field "Year" of occurrence 1 to be automatically filled with the content of the field "Year" which is in the first record. Then "Year of occurrence 2 to be filled with the content of the field "Year" which is in the first record + 1, etc.

Is there an auto fill function and how do I code calculation?

Sorry for my bad english and thank you for any help.
lls
Posts: 109
Joined: December 6th, 2011, 3:11 pm
Location: Geneva, Switzerland

Re: Automatic calculation (auto fill function ?)

Post by lls »

Somehow I found my way with the code below.
I'm not sure if this is the best way to do what I need.
Could I have an advice?

Thank you

**************************************
PROC Q62_ANREF

preproc

if not Q3_3_AOUVDOS = notappl then
impute (Q62_ANREF(1),Q3_3_AOUVDOS);
endif;

if not Q11B_ETATDOS = notappl then
impute (Q62_ANREF(2),Q3_3_AOUVDOS+1);
endif;

if not Q11C_ETATDOS = notappl then
impute (Q62_ANREF(3),Q3_3_AOUVDOS+2);
endif;
lls
Posts: 109
Joined: December 6th, 2011, 3:11 pm
Location: Geneva, Switzerland

Re: Automatic calculation (auto fill function ?)

Post by lls »

Resolved
Gregory Martin
Posts: 1777
Joined: December 5th, 2011, 11:27 pm
Location: Washington, DC

Re: Automatic calculation (auto fill function ?)

Post by Gregory Martin »

You don't need to use the impute function. That function is in CSPro for batch editing programs and I can't think of a case in which it would necessary in a data entry application.

I do not completely understand your code, but it sounds like you could accomplish what you want to by writing something like this:
PROC Q62_ANREF

preproc

    
if Q3_3_AOUVDOS <> notappl then
        Q62_ANREF(
1) = Q3_3_AOUVDOS;
        Q62_ANREF(
2) = Q3_3_AOUVDOS + 1;
        Q62_ANREF(
3) = Q3_3_AOUVDOS + 2;
    
endif;
lls
Posts: 109
Joined: December 6th, 2011, 3:11 pm
Location: Geneva, Switzerland

Re: Automatic calculation (auto fill function ?)

Post by lls »

This is indeed much better.

Thank you.


Last bumped by Anonymous on September 23rd, 2011, 8:50 am.
Post Reply