Auto mathematical calculations using numeric items

Discussions about CSEntry
Post Reply
CMH
Posts: 31
Joined: April 1st, 2022, 1:54 am

Auto mathematical calculations using numeric items

Post by CMH »

Hi Experts,

I need help for following three scenarios around numeric items B12, B18 and B19. Can you please help in providing logic text or some leads in this regard.

1. For B19 the value should auto fill/appear that would be actually answer of B12 divided by B18. Value in B19 decimals is also a possibility.
• answer in B12 =100, to be entered by enumerator
• answer in B18 = 7, to be entered by enumerator
• answer in B19 = 100/7=14.29, auto filled/appeared and may not be edited

2. For B19 the value should auto fill/appear that would be actually answer of B12 plus B18.
• answer in B12 =100, to be entered by enumerator
• answer in B18 = 7, to be entered by enumerator
• answer in B19 = 100+7=107, auto filled/appeared and may not be edited

3. For B19 the value should auto fill/appear that would be actually answer of B12 minus B18.
• answer in B12 =100, to be entered by enumerator
• answer in B18 = 7, to be entered by enumerator
• answer in B19 = 100-7 =107, auto filled/appeared and may not be edited


regards
Arjun Brti
Posts: 49
Joined: October 15th, 2020, 3:40 am

Re: Auto mathematical calculations using numeric items

Post by Arjun Brti »

Do following like this:

B19
Preproc
$ = B12/B18;
setproperty($,"Protected","Yes");

You can calculate the other values using the "-" and "+" operators like this.
Remember, the B19 variable should be 2 decimal place or as your need.

Thanks.
CMH
Posts: 31
Joined: April 1st, 2022, 1:54 am

Re: Auto mathematical calculations using numeric items

Post by CMH »

Dear Arjun,

Thank you very much it is working :) .

However, now B19 item does not appear on devise because we protected it. I want B19 should appear on devise with auto calculated value with no option for enumeration to change/edit the value in B19. Appreciated, if you help in this regard too.
Arjun Brti
Posts: 49
Joined: October 15th, 2020, 3:40 am

Re: Auto mathematical calculations using numeric items

Post by Arjun Brti »

I think you can create the "Blocks" using B19 and other variables (two or more variables), which appear in a single screen on android. For more about Blocks:
https://www.csprousers.org/help/CSPro/blocks.html

If other user have other ideas they will share.

Thanks.
CMH
Posts: 31
Joined: April 1st, 2022, 1:54 am

Re: Auto mathematical calculations using numeric items

Post by CMH »

Its working through using blocks. Thanks its helpful :) .
sherrell
Posts: 397
Joined: April 2nd, 2014, 9:16 pm
Location: Washington, DC

Re: Auto mathematical calculations using numeric items

Post by sherrell »

In addition to blocks you can also just save the value to a local variable on entry, then write it back to the cell on exit.

But since B19 is being calculated, you also have the option of just repeating the calculation on exit.

Sherrell
Post Reply