Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Add to table
Message
De
18/01/2005 04:28:44
 
 
À
17/01/2005 18:45:46
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Titre:
Divers
Thread ID:
00977855
Message ID:
00977987
Vues:
17
hi,
thank you both so much,it works,but i mixed your code and code form Mr Riche
as under it works ,
m.a= day(thisform.text2.Value)
m.a1= year(thisform.text2.Value)
LOCATE FOR  dat=thisform.text2.Value
IF !FOUND() 

ldDate = thisform.text2.value
lnMonth = MONTH(ldDate)
ldDate = ldDate - DAY(ldDate) + 1  
*? ldDate
  && Make sure we are on the first day of the mont
  DIMENSION laDOW(7)
laDOW(2)='Monday'
laDOW(3)='Tuesday'
laDOW(4)='Wednesday'
laDOW(5)='Thursday'
laDOW(6)='Friday'
laDOW(7)='Saturday'
laDOW(1)='Sunday'
***************************
DO WHILE lnMonth = MONTH(ldDate)
   APPEND BLANK
   replace dat WITH ldDate
   Replace WEEKDAY WITH laDoW(DOW(Dat))
   IF WEEKDAY='Friday'

replace rem WITH 'Friday'
endif
   ldDate = ldDate + 1
   
ENDDO
ELSE
=MESSAGEBOX("found)")
endif
thisform.grid1.refresh
thanks,
m.qasem

>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.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform