Adding three field value and write in fourth fields

Discussions about CSEntry
Post Reply
Purushottam
Posts: 4
Joined: April 19th, 2013, 8:13 am

Adding three field value and write in fourth fields

Post by Purushottam »

Sir

I am working in data entry software for Economic Census 2012(Govt. of India).

I want the logic for Protected Field for summing three fields value in fourth one which is protected.


e.g fields Col2,col3,col4 and col5 is Protected Field

Sum(Col2+col3+col4) this value should be in Col5


Pl help

P S Meena
Deputy Director
Ministry of Statistics
Govt of India
New Delhi
lls
Posts: 109
Joined: December 6th, 2011, 3:11 pm
Location: Geneva, Switzerland

Re: Adding three field value and write in fourth fields

Post by lls »

Hi,

Have you tried

Col5 = Col2 + col3 + col4
or
$ = Col2 + col3 + col4

?
htuser
Posts: 631
Joined: December 19th, 2011, 6:26 pm
Location: Silver Spring Area, MD, USA

Re: Adding three field value and write in fourth fields

Post by htuser »

Meena and Ils,
I've already solve this problem in a different way. I've a roster (table) with 4 columns (x,y,z,t) where t = y*z and 15 rows. I create a Total in x in the last row.
x(15)="TOTAL";
And for the sum i write this code:
in the Global Proc i declare as numeric, r1

r1=sum(t where x<>"TOTAL");
i=curocc();
if i<15 then
$(i)=y(i)*z(i);
elseif i =15 then
$(15) = r1;
endif;
I use a temporary variable r1 because in my codes $(15)=r1+n, where n=sum(others), but you can directly write $(15)=sum(t where x<>"TOTAL");

Before the sum i write:
if x(i)="" then skip to x(15);
else next
endif;

and for y, i write If x="TOTAL" then skip to t(15);
endif;
I write this code (or some parts) in preproc, onfocus and postproc instead of using protected field.
And that's ok for me.
HTUSER.
G.VOLNY, a CSProuser from Haiti, since 2004
Purushottam
Posts: 4
Joined: April 19th, 2013, 8:13 am

Re: Adding three field value and write in fourth fields

Post by Purushottam »

lls wrote:Hi,

Have you tried

Col5 = Col2 + col3 + col4
or
$ = Col2 + col3 + col4

?

thankx
Bharadwaj

Re: Adding three field value and write in fourth fields

Post by Bharadwaj »

Purushottam wrote:Sir

I am working in data entry software for Economic Census 2012(Govt. of India).

I want the logic for Protected Field for summing three fields value in fourth one which is protected.


e.g fields Col2,col3,col4 and col5 is Protected Field

Sum(Col2+col3+col4) this value should be in Col5


Pl help

P S Meena
Deputy Director
Ministry of Statistics
Govt of India
New Delhi
Hi Purushottam..

I am Bharadwaj working with Sigma Research and Consulting Pvt Ltd in New Delhi. If you need any support in this regard you can write to me at bharadwajsvsrk@gmail.com

Regards

Bharadwaj
DP Manager
Sigma Research and Consulting Pvt ltd.,
New Delhi
Gregory Martin
Posts: 1792
Joined: December 5th, 2011, 11:27 pm
Location: Washington, DC

Re: Adding three field value and write in fourth fields

Post by Gregory Martin »

The reason that the sum function doesn't work for you is that the function is used for summing values across a roster. The code recommended by lls should work for you.
Post Reply