Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Percentage calculation in expression of report
Message
 
 
To
30/11/2001 16:55:12
General information
Forum:
Visual FoxPro
Category:
Reports & Report designer
Miscellaneous
Thread ID:
00588031
Message ID:
00588270
Views:
44
>>Jay,
>>
>>It's an interesting idea and gives me some thoughts, say, use DEFINE for better readability. Since I'm seeking the difference between two days, your last SQL could be changed to:
>>
>>select date from DatesOftheYear where not Holiday and not WeekEnd and between(Prior_Date,Current_Date)
>>
>>I can create a cursor in the init of the form with all days...
>>
>>However, what's wrong with my code?...
>>
>
>Friday, 4:50, weekend coming. I'm out a here! Have a great one!
>
>
> Jay
>

Thanks, you too. I have ~18 min. to figure this out...
>
>>>Nadya --
>>>
>>> When working with sets of values (days for which you may have missing data), I find using SQL SELECT to work best for me. I don't know if this would work for you or give you the results you want, but, maybe it will stimulate your thought.
>>>
>>> Assume we're doing this for a non-leap year year (it can easily be extended).
>>>
>>>
>>>#DEFINE    DOW_SATURDAY   7
>>>#DEFINE    DOW_SUNDAY     1
>>>
>>>FUNCTION   IsAHoliday
>>>LPARAMETER        dDate
>>>LOCAL             llIsAHoliday
>>>
>>>    llIsAHoliday = .F.
>>>    DO CASE
>>>        CASE  MONTH (dDate) = 12 AND DAY (dDate) = 25
>>>             llIsAHoliday = .T.
>>>        CASE  etc.
>>>    ENDCASE
>>>    RETURN llIsAHoliday
>>>ENDFUNC
>>>
>>>CREATE TABLE DaysOfYear (dYearDate D, lIsWeekend L, lIsHoliday L)
>>>ldStartDate = {12/31/1998}
>>>FOR lnDateOffset = 1 TO 365
>>>   INSERT INTO DaysOfYear (dYearDate, lIsWeekend, lIsHoliday) ;
>>>       VALUES (ldStartDate + lnDateOffset, ;
>>>           INLIST (DOW(ldStartDate + lnDateOffset, DOW_SATURDAY, DOW_SUNDAY), ;
>>>           IsAHoliday (ldStartDate + lnDateOffset))
>>>ENDFOR
>>>
>>>SELECT YearDate AS dMissDate ;
>>>    FROM DaysOfYear ;
>>>    WHERE NOT llIsWeekend ;
>>>          AND NOT llIsHoliday ;
>>>          AND NOT IN (SELECT dDataDate FROM dDataTable)
>>>
>>>
>>>HTH,
>>>
>>>Jay
>>>
>>>
>>>>I'm working on some application now, which is supposed to be simple, but I'm working on three days already and it still doesn't behave, as it should :(
>>>>
>>>>For instance, here is the peice of code, which I can not make to work correctly.
>>>>
>>>>The idea is to check for gaps between two days and report them excluding weekends and holidays. What's wrong with this code or how it should be changed?
>>>>
>>>>
>>>>* -- Checking for missing data compared against last data received
>>>>* -- Check for Friday or Saturday for old and new is Monday date then we're not missing any data
>>>>		if (dow(Record_fm)=2 and Record_fm - PriorRec_To > 3) ;
>>>>		    or (dow(Record_fm)<> 2 and Record_fm > PriorRec_To+1)
>>>>			tmpDays = Record_fm - PriorRec_To
>>>>			if m.tmpDays > 1
>>>>				for i = 1 to m.tmpDays-1
>>>>* -- Check against holiday for each missing record && Sundays & Saturdays
>>>>					if dow(PriorRec_To+m.i)<>1 and dow(PriorRec_To+m.i)<>7 ;
>>>>							and !seek(PriorRec_To+m.i,'Holidays')
>>>>						lcTempStr = "May have Missing Recorded data for "+ dtoc(PriorRec_To+m.i)+"."
>>>>						if not m.lcTempStr $ m.tmpNotesStr
>>>>							tmpNotesStr = iif(empty(m.tmpNotesStr),'',m.tmpNotesStr+chr(13)) + m.lcTempStr
>>>>						endif
>>>>						llMDFlag = .t.
>>>>					endif			&& Missing Data
>>>>				endfor				&& Going to the next date to check for missing data
>>>>			endif
>>>>		endif					&& Checks for Fri or Sat and Mon
>>>>
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform