Each Date=One & Add Em (AREV Specific)
At 20 JUL 2000 08:37:43PM Donna wrote:
Six classes and six empty fields to enter the date attended the class. Or the 'Date Attended" could be empty if the person did not show up. Now, I am trying to add the number of times the individual attended classes. i.e. Out of 6 class dates, how many have a value and how many are empty? These are single FMC's not a MV field. What's my best shot at this? I've managed to get myself totally confused and it's probably very simple.
TIA
Donna Arev 3.1
At 20 JUL 2000 09:34PM Bill Titus wrote:
Donna,
Here's a simple formula.
@ANS=(@RECORD#"")+(@RECORD#"")+(@RECORD#"")+(@RECORD#"")+(@RECORD#"")+(@RECORD#"")
Hope it helps.
Bill
At 20 JUL 2000 09:59PM Larry Wilson - TARDIS Systems wrote:
If the fields are sequential, then:
Ans=INT(SUM(FIELD(@RECORD,@FM,StartAmc,6))/DATE())
This should accurately return an answer.
Larry Wilson
At 21 JUL 2000 12:30AM Warren Kinny, Exodus Systems, Australia wrote:
Hi Donna,
Just a quickie. Larry's suggestion won't work because DATE() will vary and be after the event. However, as he says if the fields are seqyential, you can certainly use the
FIELD(@RECORD,@FM,START.FLD,6) formula to get one variable to check.
So if they are for example fields 3-8 of the record, then you could :
TEMP=FIELD(@RECORD,@FM,3,6)
Because you are looking for empty fields, they will be just @FM in your array. Therefore, if you want to be fancy, you could :
MISSED=COUNT(@FM:TEMP:@FM , @FM:@FM)
ATTENDED=6 - MISSED
Ie you count up the number of double @FM's in your string. Note that to do that you have to put an @fm on the front and back of your string
to make sure it copes with the first or last field being blank.
SO you could get it down to 1 line of code if you're desperate :
ATTENDED=6 - COUNT(@FM:FIELD(@RECORD,@FM,3,6):@FM, @FM,@FM)
Of course, you can always just use a Loop :
ATTENDED=0
FOR I=1 TO 6
ATTENDED += (@RECORD '')NEXT I
(Assuming again fields 3 through 8).
If the fields are not sequential, just mod like this to pass back
the appropriate fields numbers.
ATTENDED=0
FOR I=1 TO 6
FMC=FIELD('3/5/9/12/13/15','/',I)ATTENDED += (@RECORD '')NEXT I
Personally, I think a loop is clearer for someone else reading the code later and trying to work out what it's doing.
Hope that helps !
Warren Kinny
At 21 JUL 2000 04:47PM Larry Wilson - TARDIS Systems wrote:
Actually, my way will work, but instead of DATE(), you put in the first date that the class could have been held (StartingDate).
Try it out.
At 25 JUL 2000 04:10PM Donna wrote:
Thanks to each of you gentleman!! All fantastic ideas, if you are curious I used the Bill Titus suggestion. Short and sweet!
Donna