on 06-29-2007 6:21 PM
Post Author: John
CA Forum: Formula
Hey all. I thought I had my original problem fixed, but now, I have a new one.
The report is not counting the first record in the report. Here is the code....
WhilePrintingRecords;numbervar b;If {PRODUCT_INVENTORY.PRODUCT_ID} = "RBC" and {PRODUCT_INVENTORY.UNIT_NO} <> Previous ({PRODUCT_INVENTORY.UNIT_NO})Thenb := b + 1
Everything else is correct, it's just that the first instance (whatever product_id is equal too) is not counting.
Any suggestions?
Thanks
John
Post Author: synapsevampire
CA Forum: Formula
Example data can be made up, and should be.
A set of example data and expected results will net great results, try it sometime.
-k
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Post Author: John
CA Forum: Formula
synapsevampire:
Try supplying example data and the required output instead of descriptions.
We don't know why you are using "{PRODUCT_INVENTORY.UNIT_NO} <> Previous ({PRODUCT_INVENTORY.UNIT_NO})", right?
Nor how the report is grouped, where you are displaying the total, etc.
Now why would the counts vary based on what a fields value is? Weird logic...
You can always subtract 1 in that one instance, but I suspect that if you supplied example data and the expected output the logic would be very different.
-k
Hey, yeah, sorry the logic isn't as strong as you are probably used to. Newbie here just trying to weed through it.
Couple of answers for ya. Can't give exact example data as it is related to patient data. Sorry. The counts are based on the same field. That field can have 3 different values. Think of it this way. If the field was Blood Type and you wanted to count the # of O, A and B blood types. They would all be listed under the same heading in the report. As for why I was using Product <> Previous Product... well.. I had an earlier thread that dealt with this and this thread was "kinda" a continuation of that. No way you could have known that and I should have specified previously. Sorry for the confusion and thanks for the effort.
Have a good one!
John
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Post Author: John
CA Forum: Formula
Jagan:
When you're on the first record what do you expect Previous() to do? Try adding OnFirstRecord, e.g.
WhilePrintingRecords;numbervar b;If {PRODUCT_INVENTORY.PRODUCT_ID} = "RBC" and (OnFirstRecord or {PRODUCT_INVENTORY.UNIT_NO} <> Previous ({PRODUCT_INVENTORY.UNIT_NO})) Thenb := b + 1
Thanks Jagan!
OnFirstRecord is what I was looking for. This fixed it right up.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Post Author: qcheng
CA Forum: Formula
Did you specify the initial value of b? It may work if create a new formula field called 'Initial' using the following code:
whileprintingrecords;
numbervar b:=0
and put the formula field 'Initial' in the section just before the first record and suppress it.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Post Author: Jagan
CA Forum: Formula
When you're on the first record what do you expect Previous() to do? Try adding OnFirstRecord, e.g. WhilePrintingRecords;numbervar b;If {PRODUCT_INVENTORY.PRODUCT_ID} = "RBC" and (OnFirstRecord or {PRODUCT_INVENTORY.UNIT_NO} <> Previous ({PRODUCT_INVENTORY.UNIT_NO})) Thenb := b + 1
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Post Author: synapsevampire
CA Forum: Formula
Try supplying example data and the required output instead of descriptions.
We don't know why you are using "{PRODUCT_INVENTORY.UNIT_NO} <> Previous ({PRODUCT_INVENTORY.UNIT_NO})", right?
Nor how the report is grouped, where you are displaying the total, etc.
Now why would the counts vary based on what a fields value is? Weird logic...
You can always subtract 1 in that one instance, but I suspect that if you supplied example data and the expected output the logic would be very different.
-k
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Post Author: John
CA Forum: Formula
I would, but, here's the problem.. The record set that I am counting can be 1 of 3 possibilities. So, it could be = to RBC, FFP, or PLT. If the first record is RBC, it would work, but, it could be FFP or PLT. So, if I start with b := 1, I have just as much chance of being +1 instead of even.
Thanks!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Post Author: yangster
CA Forum: Formula
are you always off by just 1?if so then just set b := 1 to start the count instead of b:= 0
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
78 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.