Page 1 of 1

Adding three field value and write in fourth fields

Posted: April 19th, 2013, 8:21 am
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

Re: Adding three field value and write in fourth fields

Posted: April 19th, 2013, 11:45 am
by lls
Hi,

Have you tried

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

?

Re: Adding three field value and write in fourth fields

Posted: April 19th, 2013, 3:21 pm
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.

Re: Adding three field value and write in fourth fields

Posted: April 20th, 2013, 12:16 pm
by Purushottam
lls wrote:Hi,

Have you tried

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

?

thankx

Re: Adding three field value and write in fourth fields

Posted: April 21st, 2013, 7:08 am
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

Re: Adding three field value and write in fourth fields

Posted: April 22nd, 2013, 5:50 pm
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.