I am running a report that pulls out HgbA1C, BP, LDL ... values and the corresponding dates. Based on the value of HgbA1C (>9, <8 and <7) I have a column to display whether it is 1 or 0.(for eg. if HgbA1C >9 then it displays 1 else 0). That formula is working correctly. next i need the follo:
total count of HgbA1C >9
total count of HgbA1C <8
total count of HgbA1C <7
at the end of the report.
I tried with formula and running total, but the total count is wrong. Can anyone please help.
If the running total isn't working for you, you can do it with tally formulas.
Formula TotReset (Report Header):
WhilePrintingRecords;
NumberVar cntHgb7Tot := 0;
NumberVar cntHgb8Tot := 0;
NumberVar cntHgb9Tot := 0;
Formula ProvReset (Group Header for provider):
WhilePrintingRecords;
NumberVar cntHgb7Prov := 0;
NumberVar cntHgb8Prov := 0;
NumberVar cntHgb9Prov := 0;
Formula PatTally (Group Footer for patient):
WhilePrintingRecords;
NumberVar cntHgb7Prov := 0;
NumberVar cntHgb8Prov := 0;
NumberVar cntHgb9Prov := 0;
NumberVar cntHgb7Tot := 0;
NumberVar cntHgb8Tot := 0;
NumberVar cntHgb9Tot := 0;cntHgb7Prov := cntHgb7Prov + {@Hgb7Val};
cntHgb7Tot := cntHgb7Tot + {@Hgb7Val};
cntHgb8Prov := cntHgb8Prov + {@Hgb8Val};
// Etc.
Formula ShowHgb7Prov (Group footer for Provider):
WhilePrintingRecords;
NumberVar cntHgb7Prov;cntHgb7Prov;
And so forth. 🙂
Thank you for your reply.
The report is not grouped by provider, but on on patient name. Since it displays multiple observations on the same line, each observation is displayed through a formula and all the formulas are kept in the group footer section. Do you have any suggestions?
Then ignore the bits about Provider above and only use the parts that are relevant to the Report Total.
Thank you. But, I am getting only 0 as the total count. i am writing more details on the report. If you could pls help.
Hgb Value >9 <8 <7
5.9 0 0 1
8.4 0 0 0
9.8 1 0 0
5.7 0 0 1
7.6 0 1 0
>9 uses @Hgb_MoreThan9
<8 uses @Hgb_LessThan8
<7 uses @Hgb_LessThan7
@Hgb_MoreThan9
numberVar CountMoreThan9:=0;
if (Val (@HgbA1c})>9)
then
CountMoreThan9:=CountMoreThan9+1;
—————————————————-
@HgbA1c
WhilePrintingRecords;
stringvar hgba1c;
if hgba1c=""
then ""
else hgba1c;
——————————————————-
@Observations
stringVar hgba1c;
if {obs.hdid}=28
then hgba1c :={obs.obsvalue}
else hgba1c:=hgba1c;
——————————————————
obsvalue is a string field
should just be able to do a Sum for each column in your footer.
Thank you. I'll look into it.
Thank you to all, especially to SarekOfVulcan for your help and prompt replies.
At last, I figured it out.
When @Total_MoreThan9 is placed in the PageFooter the answer is 0.
Also, I think the mistake I was making was deleting the @Total_MoreThan9 from the group footer.
The code is given below:
——————————————————–
@ Total_MoreThan9
numberVar TotalMoreThan9;
if (val({HgbA1C})>9)
then
TotalMoreThan9:=TotalMoreThan9+1;
This formula is placed in the Group Footer (of patient name) and suppressed
——————————————————–
@ Disp_Tot_Cnt_MoreThan9
WhilePrintingRecords;
NumberVar TotalMoreThan9;
if (TotalMoreThan9<>0) then
ToText(TotalMoreThan9);
This is placed in Page Footer
——————————————————-