Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Return date
Message
De
07/02/2006 09:29:35
 
 
À
07/02/2006 09:21:52
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Versions des environnements
Visual FoxPro:
VFP 8
Database:
Visual FoxPro
Divers
Thread ID:
01094224
Message ID:
01094255
Vues:
6
hi,
thank you,first part,it works
 thisform.text3.value=GOMONTH(thisform.text1.value,- thisform.text2.value)
second part,
DELETE FROM allres  WHERE EXISTS(SELECT * FROM allresdintial WHERE clint_no=allres.clint_no and allresdintial.dat<=thisform.text3.value)&&
thanks

>Yeah, if that's literal code & not just fox-ish pseudo-code, there are other tweeks to be made. Aside from what Tore suggested, the line
>
>thisform.text3.value=GOMONTH
>
>will fail everytime. I think what you're trying to do right there is:
>
>thisform.text3.value=GOMONTH({^m.d}, -m.a)
>
>With, of course, addition of Tore's suggestion to apply more meaningful variable names & staying away from a-j.
>
>
>>The line GOMONTH({^m.d}, -m.a) will cause an error because of the ^, m.d is expected to be valid, thus the ^ must not be there. GOMONTH(m.d, -m.a) also assumes that m.d is a valid date and that m.a is numeric. By the way, I hope that m.d and m.a are not really used in the program, becuase a-j (and that then also means m.a to m.j) are reserved words for work areas.
>>
>>>Maybe check the value of SET("STRICTDATE") in your program & see if you either want to change the value of that, or change the code to acccomodate your current STRICTDATE setting. This value can also be adjusted in your development environment under Tools-->Options-->General.
>>>
>>>>hi,
>>>>thank you for reply.
>>>>i try to do somthing as under i got error message..Ambiguous Date/DateTime constant use the format {^yyyy-mm-dd[,][hh[:mm[:ss]][alp]]}
>>>>
>>>>
>>>>
>>>>m.a=thisform.text2.value
>>>>m.d=thisform.text1.value
>>>>GOMONTH({^m.d}, -m.a)
>>>>   thisform.text3.value=GOMONTH
>>>>
>>>>**&&& no need for  IF && I think
>>>>m.g=thisform.text3.value
>>>>DELETE FROM allres  WHERE EXISTS(SELECT * FROM allresdintial WHERE clint_no=allres.clint_no and allresdintial.dat>=m.g)&&
>>>>
>>>>
>>>>thanks.
>>>>
>>>>>Hi Mohammed,
>>>>> So it looks to me that you gave us some pseudo-code, almost actual code, and you're just looking for the few pieces of Fox syntax to make it work? I wasn't sure what was the question you were asking when I was done reading it. Here are some I see that MAY be of interest to you.
>>>>>
>>>>>1) It looks like your date format must be dd/mm/yyyy, right? Check out the GOMONTH() function to quickly move 'n' months in one direction or another.
>>>>>
>>>>>2) Consider making a case statement instead of multiple 'ifs'. There was a discussion on universal thread not that long ago about using if vs iif vs case. Some people were hard on one side of the fence or the other, but this looks like a good place to use CASE. The reason being, only 1 of those conditions can ever be true, so there is no need to process ALL of the ifs. With a CASE, once a matching condition is met, the rest of the cases are ignored.
>>>>>
>>>>>After the CASE, put that repeated query just once at the very bottom.
>>>>>
>>>>>Is this the type of feedback you were looking for?
>>>>>
>>>>>>hi all,
>>>>>>
>>>>>>any help idea.
>>>>>>
>>>>>>i need to delete customer client_no from mynewtable(allres) where found this records at old table (allresdintial) via condition ...ex
>>>>>>
>>>>>>
>>>>>>i have text1 as date and text2 as number got it from combobox have numbers as 3,6,9,12, and field name at newtable and old table is dat.
>>>>>>
>>>>>>
>>>>>> thisform.text1.value=05/06/2006
>>>>>>if thisform.text2.value=3
>>>>>>    thisform.text3.value=thisform.text1.value-3 months  && result as 05/03/2006
>>>>>>
>>>>>>DELETE FROM allres  WHERE EXISTS(SELECT * FROM allresdintial WHERE clint_no=allres.clint_no and allresdintial.dat>=thisform.text3.value)
>>>>>>
>>>>>>
>>>>>>if thisform.text2.value=6
>>>>>>    thisform.text3.value=thisform.text1.value-6 months  && result as
>>>>>>DELETE FROM allres  WHERE EXISTS(SELECT * FROM allresdintial WHERE clint_no=allres.clint_no and allresdintial.dat>=thisform.text3.value)
>>>>>>
>>>>>>
>>>>>>if thisform.text2.value=9
>>>>>>    thisform.text3.value=thisform.text1.value-9 months  && result as
>>>>>>DELETE FROM allres  WHERE EXISTS(SELECT * FROM allresdintial WHERE clint_no=allres.clint_no and allresdintial.dat>=thisform.text3.value)
>>>>>>
>>>>>>if thisform.text2.value=12
>>>>>> thisform.text3.value=thisform.text1.value-12 months  && result as
>>>>>>
>>>>>>DELETE FROM allres  WHERE EXISTS(SELECT * FROM allresdintial WHERE clint_no=allres.clint_no and allresdintial.dat>=thisform.text3.value)
>>>>>>
>>>>>>
>>>>>>thanks .
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform