I'm posting a solution to an issue I had with inserting a zero when an integer or decimal question type was blank in a report template. Hope this saves someone hours of troubleshooting, despair, and frustration.
The following expression worked for me on a feature report for a survey that had nested repeats (e.g. Project main-->Site repeat-->Feature repeat). In my case, the report ran calculations on all the features within a single project. If the question is blank a zero is inserted; otherwise, a calculated value is returned.
Syntax:
${#FeatureRepeat | stats:"sum,Question name to sum,Variable name to hold sum result"}${Variable name+0 | format:"#,##0"}${/}
Example:
${#rptFeature | stats:"sum,RoadMilesDecomm,RdMi"}${RdMi+0 | format:"#,##0"}${/}
The variable name can be whatever you want it to be. The number format is optional.
Solved! Go to Solution.
I'm posting a solution to an issue I had with inserting a zero when an integer or decimal question type was blank in a report template. Hope this saves someone hours of troubleshooting, despair, and frustration.
The following expression worked for me on a feature report for a survey that had nested repeats (e.g. Project main-->Site repeat-->Feature repeat). In my case, the report ran calculations on all the features within a single project. If the question is blank a zero is inserted; otherwise, a calculated value is returned.
Syntax:
${#FeatureRepeat | stats:"sum,Question name to sum,Variable name to hold sum result"}${Variable name+0 | format:"#,##0"}${/}
Example:
${#rptFeature | stats:"sum,RoadMilesDecomm,RdMi"}${RdMi+0 | format:"#,##0"}${/}
The variable name can be whatever you want it to be. The number format is optional.
Thanks for sharing. Can you please post your solution and mark it as the answer?
I'm posting a solution to an issue I had with inserting a zero when an integer or decimal question type was blank in a report template. Hope this saves someone hours of troubleshooting, despair, and frustration.
The following expression worked for me on a feature report for a survey that had nested repeats (e.g. Project main-->Site repeat-->Feature repeat). In my case, the report ran calculations on all the features within a single project. If the question is blank a zero is inserted; otherwise, a calculated value is returned.
Syntax:
${#FeatureRepeat | stats:"sum,Question name to sum,Variable name to hold sum result"}${Variable name+0 | format:"#,##0"}${/}
Example:
${#rptFeature | stats:"sum,RoadMilesDecomm,RdMi"}${RdMi+0 | format:"#,##0"}${/}
The variable name can be whatever you want it to be. The number format is optional.