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
Adding three field value and write in fourth fields
-
- Posts: 4
- Joined: April 19th, 2013, 8:13 am
Re: Adding three field value and write in fourth fields
Hi,
Have you tried
Col5 = Col2 + col3 + col4
or
$ = Col2 + col3 + col4
?
Have you tried
Col5 = Col2 + col3 + col4
or
$ = Col2 + col3 + col4
?
Re: Adding three field value and write in fourth fields
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.
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
-
- Posts: 4
- Joined: April 19th, 2013, 8:13 am
Re: Adding three field value and write in fourth fields
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
Hi Purushottam..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
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
-
- Posts: 1796
- Joined: December 5th, 2011, 11:27 pm
- Location: Washington, DC
Re: Adding three field value and write in fourth fields
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.