Our questionnaire has a question that record the amount of contribution paid for the National Pension Fund (3% of basic salary) by the household . This question is normally related these two questions:
Do you contribute to the National Pension Scheme? (Yes or No)
Basic Salary (Amount)
Now, each household member who answered ‘yes’ to question a) is required to provide an amount for the NPF contribution which will be 3% of his/her basic salary. Kindly note that, the maximum amount for a household member to contribute NPF is 254 irrespective of the amount of his/her basic salary.
What have been done so far?
Create a long integer variable type(name: basic_3)
The Result
The issue is that it displayed all the members whether they are entitled and not for the NPF contribution. In the case, above only the household member Tom was entitled for the contribution. Therefore, it will be grateful if you could please assist us with the codes, to restrict the household members only to those who are entitled to pay for the NPF contribution.
Why do you ask the last question 6.2.18i in the first place? Do you want the enumerator to enter the total amount of contributions to the NPF, in this case 1048? This does not make sense/is not necessary given you have obtained this information already and computed it in the software ( total_basic_3).
If you would like to display the information of total_basic_3, use a static text, which also gives you the opportunity to display it in a nice manner with paragraphs etc.
In any case, if you would like to adjust your displayed text to only display those members that actually contribute to the fund (q1 == “Do you contribute to the National Pension Scheme?” ), revise basic_3_str to:
Thank you very much Peter. Indeed it works well but there is an issue regarding the total.
It seems that the total 1048, still sum the NPF contribution for all members of the household who are are entitled and not for this particular contribution. I have tried to modify the total_basic_3. Unfortunately it is not working. Please could you help with this issue.
Well regarding your comment on the question 6.2.18i, I understand your point of view, but unfortunately the question cannot be removed as this questionnaire is approved by the Board. Yes, it is required by the enumerator to enter the total, but we are trying to facilitate his/her work by displaying the calculated figures.
Regarding the static text, I wanted to ask if it is possible to display information in a tabular form?
total_basic_3 == members.Select(x=>x.basic_3).Sum() even though your syntax should work as well.
Do you have basicSalary enabled only if q1==1?
In doubt, adjust also total_basic_3 to members.Where(x=>x.q1==1). select(y=>y.basic_3).Sum()
With respect to the static text:
First of all, you could display the total separately from basic_3_str, therefore delete the last part “Total: {total_basic_3}” in your string variable.
In the static text you could write:
%basic_3_str%
< br>< br>
This amounts to a total Household contribution of: %total_basic_3%.
If you also would like to show the respective household members contribution below each other: Spontaneously I only could suggest a quick and dirty approach:
Create several variables based on basic_3_str with the syntax of
and so forth…
In the static text you write:
Contributions by the HH to the fund:
%basic_3_str1%
< br>< br>
%basic_3_str2%
< br>< br>
…
…
…
This amounts to a total Household contribution of: %total_basic_3%.
A bit dirty, maybe someone else knows a better way.
Thank you for your kindly support. The codes worked perfectly.
With respect to the static text, it is observed that one is required to create a certain number of variables basic_3_str1, basic_3_str2… beforehand and which normally need to be greater than the number of household members.
Yap. My “dirty” proposed solution implied that you create around 8 or so variables through which you should cover most households I suspect (I assume children can not provide to the fund…). But again, its quite static and there are probably “cleaner” solutions.
Just to add: Use a validation condition for 6.2.18i that it must equal the calculated total (or at least close to it). If this information is that important to you, you also could ask a question to the respondent about how much in total they approximately paid to the fund which you again could use to validate 1) the salary responses and the 2) fund contributions.