Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Add to table
Message
From
17/01/2005 18:45:46
 
 
To
17/01/2005 18:12:27
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Title:
Miscellaneous
Thread ID:
00977855
Message ID:
00977914
Views:
42
So you want to create a table with one record for every day in the year? If so, try this, not tested, but it should work. Replace yourDate and WEEKDAY with your field names.
thisform.text2.value=01/01/2005 (DD/MM/YYYY date format?)
lnMonth=month(thisform.text2.value) && String: lnMonth=val(substr(thisform.text2.value,4,2)) && 01  
lnYear=year(thisform.text2.value)   && string: lnYear=val(substr(thisform.text2.value,7,4))  && 2005
lnDate=EVALUATE('{^'+STR(lnYear,4)+ '-' + TRANSFORM(lnMonth,'@L 99') + '-01}')
DIMENSION laDOW(7)
laDOW(1)='Monday'
laDOW(2)='Tuesday'
laDOW(3)='Wednesday'
laDOW(4)='Thursday'
laDOW(5)='Friday'
laDOW(6)='Saturday'
laDOW(7)='Sunday'
FOR lnMonthCounter=1 to 12
  FOR lnDayCounter=1 to VAL(DTOC(GOMONTH(lnDate,1)-DAY(lnDate))) && Number of days in the month
    APPEND BLANK
    Replace yourDate WITH EVALUATE('{^'+STR(lnYear,4)+ '-' + TRANSFORM(lnMonthCounter,'@L 99') + '-' + TRANSFORM(lnDayCounter,'@L 99') + '}')
    Replace WEEKDAY WITH laDoW(DOW(yourDate))
  ENDFOR
ENDFOR
>hi ,
>i don't understand what you mean,
>but i need to insert at my thisform.text2.value ctod("01/01/2005")
>thanks.
>>Is the month you enter, always less than a year from now?
>>>hi,
>>>thank you,
>>>i try to do this as under ,it works as add 31 days,
>>>but i need to replace dayname if the day name is friday,
>>>and i want to add month(2) feb..to month(12),take care if thedays for every month is 31 , 30 or 29 or 28 if month is=2
>>>
>>>IF MONTH(thisform.text2.Value)=01
>>>  FOR n=1 TO 31
>>>   APPEND BLANK
>>>  endfor
>>>endif
>>>
>>>>Hi Mohammed,
>>>>
>>>>I don't mean to be rude, but I don't understand what you want.
>>>>Do you want 31 blank records? If so, under what conditions.
>>>>Why do you mention Friday?
>>>>Can you give us a better explanation?
>>>>>hi all,
>>>>>
>>>>>i need help to insert 31 records at my table if month e.i =1,if day is friday insert(replace) at myfield rem friday
>>>>>as
>>>>>31 append blank
>>>>>thanks.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform