I have a table; WeightLog (WeightID, ProfileID, WeightDate, Weight)
In my Reports/Chart page, I list the weight entries for the Current Month. Pretty boring huh?
The Requirement
I need to show the weight difference between one entry and the next. So I will add another column to the right of Weight (Gain/Loss) that will show the difference between that entry and the previous entry. Values are expected to be; 1, 2, 0, -1, -2, and so on.
It has to be dynamic, as it needs to recalculate on Add, Delete, and Edit.
The Situation
I have tried Running Totals. Both the solutions from the forum and the solution from the Caspio Help Tutorial. I tried to duplicate the Help Tutorial exactly and never got it working as it had so many inconsistensies. Very frustrated.
The reason the Running Totals didn't work in this situation, is that, I am not carrying a "Running Balance" forward. I need to hold and replace a value on each record.
What I've Tried
I added a Calculated Field (PreviousWeight) and the following calculation (from the examples for Running Balance):
SELECT IsNull([@field:WeightLog_Weight],0) FROM PreviousWeight WHERE WeightLog_WeightID <= target.[@field:WeightLog_WeightID] AND WeightLog_ProfileID = target.[@field:WeightLog_ProfileID]
You can post now and register later.
If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.
Question
Lynda
The Set Up
The Requirement
The Situation
What I've Tried
SELECT IsNull([@field:WeightLog_Weight],0) FROM PreviousWeight WHERE WeightLog_WeightID <= target.[@field:WeightLog_WeightID] AND WeightLog_ProfileID = target.[@field:WeightLog_ProfileID]
Does anyone have any ideas?
Lynda
Link to comment
Share on other sites
2 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.