fisheromacse
IS-IT--Management
I have what i think should be a straightforward report, but am having a mental block as to how to accomplish it.
I am pulling a list of clients and their monthly weights.
I need to compare the weights of each client over a year.
For example, find the amount of weight change and the % of weight changes from: last month to this month, this month compared to 3 months previous, this month compared to 6 months previous, this month compared to 9 months previous and this month compared to 12 months previous.
I am stuck on the month to month portion.
I cannot use previous record for the client, for although all clients are required to have monthly weights, some clients have daily weights others weekly. I need to compare only the 1st weights of each month.
My report is structured as follows:
GROUP HEADER 1 : Residence (suppressed)
GROUP HEADER 2 : FullName (suppressed)
GROUP HEADER 3 : CheckDate (ascending, for each month)
: Group Header 3 contains the formulas CheckDate, CheckBy, and Weight
Details : all suppressed
All GROUP FOOTERS are suppressed
Formulas:
//@CheckDate
stringvar cd := totext({table.checkdate});
Date(val(left(cd,4)),val(mid(cd,5,2)),val(right<cd,2)))
//@CheckBy
IF isnull({table.checkby}) then "No Entry"
else {table.checkby}
//@Weight
IF isnull({Table.value}) or not(isnumeric({table.value})) then 900000
else tonumber({table.value})
There will be a few other formulas that i do not have completed yet:
//@WtChange - calculate the number of pounds changed
//@PctChange - calculate the percentage of weight changed
//@SigChange - determine if % change for 1 month is greater than 5%
Here is a sample of the detail data:
Client CheckDate CheckBy Weight
Bob Bob 01/01/2010 Sue Sue 104.7
Bob Bob 01/22/2010 Mark Sue 105.3
Bob Bob 02/02/2010 Sam Sam 112.1
Bob Bob 03/03/2010 Mark Sue 108.3
Bob Bob 03/23/2010 Sue Sue 114.8
Bob Bob 03/30/2010 Sam Sam 107.4
Bob Bob 04/04/2010 Sue Sue 105.1
Bob Bob 04/16/2010 Sam Sam 105.7
Bob Bob 05/11/2010 Mark Sue 109.9
I have the formulas in the group header, so it displays the correct values, but when i attempt to find the difference between the weights, I get stuck.
I tried:
\\@PrevWt
IF {table.ID}=previous({table.ID}) and (isnumeric(previous({table.value}) and isnumeric({table.value})) then tonumber({table.value})-tonumber(previous({table.value}))
but as expected it uses the previous record, not necessarily the record displayed in the group header.
Here is how i would like the data above to display, and would have formulas for monthly weight change (current - previous), % of monthly change (((current/previous)-1)*100), and if change was significant(>5% for 1 month) to the right of Weight:
Client CheckDate CheckBy Weight
Bob Bob 01/01/2010 Sue Sue 104.7
Bob Bob 02/02/2010 Sam Sam 112.1
Bob Bob 03/03/2010 Mark Sue 108.3
Bob Bob 04/04/2010 Sue Sue 105.1
Bob Bob 05/11/2010 Mark Sue 109.9
If i forgot any information, please prompt me for it.
thanks in advance.
I am pulling a list of clients and their monthly weights.
I need to compare the weights of each client over a year.
For example, find the amount of weight change and the % of weight changes from: last month to this month, this month compared to 3 months previous, this month compared to 6 months previous, this month compared to 9 months previous and this month compared to 12 months previous.
I am stuck on the month to month portion.
I cannot use previous record for the client, for although all clients are required to have monthly weights, some clients have daily weights others weekly. I need to compare only the 1st weights of each month.
My report is structured as follows:
GROUP HEADER 1 : Residence (suppressed)
GROUP HEADER 2 : FullName (suppressed)
GROUP HEADER 3 : CheckDate (ascending, for each month)
: Group Header 3 contains the formulas CheckDate, CheckBy, and Weight
Details : all suppressed
All GROUP FOOTERS are suppressed
Formulas:
//@CheckDate
stringvar cd := totext({table.checkdate});
Date(val(left(cd,4)),val(mid(cd,5,2)),val(right<cd,2)))
//@CheckBy
IF isnull({table.checkby}) then "No Entry"
else {table.checkby}
//@Weight
IF isnull({Table.value}) or not(isnumeric({table.value})) then 900000
else tonumber({table.value})
There will be a few other formulas that i do not have completed yet:
//@WtChange - calculate the number of pounds changed
//@PctChange - calculate the percentage of weight changed
//@SigChange - determine if % change for 1 month is greater than 5%
Here is a sample of the detail data:
Client CheckDate CheckBy Weight
Bob Bob 01/01/2010 Sue Sue 104.7
Bob Bob 01/22/2010 Mark Sue 105.3
Bob Bob 02/02/2010 Sam Sam 112.1
Bob Bob 03/03/2010 Mark Sue 108.3
Bob Bob 03/23/2010 Sue Sue 114.8
Bob Bob 03/30/2010 Sam Sam 107.4
Bob Bob 04/04/2010 Sue Sue 105.1
Bob Bob 04/16/2010 Sam Sam 105.7
Bob Bob 05/11/2010 Mark Sue 109.9
I have the formulas in the group header, so it displays the correct values, but when i attempt to find the difference between the weights, I get stuck.
I tried:
\\@PrevWt
IF {table.ID}=previous({table.ID}) and (isnumeric(previous({table.value}) and isnumeric({table.value})) then tonumber({table.value})-tonumber(previous({table.value}))
but as expected it uses the previous record, not necessarily the record displayed in the group header.
Here is how i would like the data above to display, and would have formulas for monthly weight change (current - previous), % of monthly change (((current/previous)-1)*100), and if change was significant(>5% for 1 month) to the right of Weight:
Client CheckDate CheckBy Weight
Bob Bob 01/01/2010 Sue Sue 104.7
Bob Bob 02/02/2010 Sam Sam 112.1
Bob Bob 03/03/2010 Mark Sue 108.3
Bob Bob 04/04/2010 Sue Sue 105.1
Bob Bob 05/11/2010 Mark Sue 109.9
If i forgot any information, please prompt me for it.
thanks in advance.