Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Condition help
Message
 
 
À
08/02/2006 15:40:29
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
01094773
Message ID:
01094783
Vues:
13
From my SearchDateRange class:
*---------------------- Location Section ------------------------
*   Library: 	Asearchcontrols.vcx
*   Class: 		Cntsearchdaterange
*   Method: 	Getwhereexpression()
*----------------------- Usage Section --------------------------
*)  Description:
*)

*   Scope:      Public
*   Parameters:
*$  Usage:
*$
*   Returns:
*--------------------- Maintenance Section ----------------------
*   Change Log:
*       CREATED 	08/12/2005 - NN
*		MODIFIED
*----------------------------------------------------------------
local lcRetVal, loControl, lcDateFrom, lcDateTo
lcRetVal = "##ALIAS##." + strextract(this.cSeparator + this.cFldName + this.cSeparator, ;
	this.cSeparator, this.cSeparator,1)

do case

case not empty(this.txtDateFrom.value) and not empty(this.txtDateTo.value)
	lcRetVal = "(" + m.lcRetVal + ">=" + this.ValToStr(this.txtDateFrom.value) + ;
		" AND " + m.lcRetVal + "<" + this.ValToStr(this.txtDateTo.value + 1) + ")"

case not empty(this.txtDateFrom.value)
	lcRetVal = m.lcRetVal + ">=" + this.ValToStr(this.txtDateFrom.value)

case not empty(this.txtDateTo.value)
	lcRetVal = m.lcRetVal + "<" + this.ValToStr(this.txtDateTo.value + 1)

otherwise
	lcRetVal = ""
endcase

this.cWhereExp = strtran(m.lcRetVal,"##ALIAS##", this.cAliasName)

return m.lcRetVal
>Hi all,
>
>Anybody can help me out how to split the below codes to meet the following
>criteria :
>
>If [startdate] is blank, considers the [enddate] as final filter means from [enddate] backward to any [startdate]
>
>If both ( [Startdate] & [Enddate] ) are blank, take everything
>
>If [Enddate] is blank, considers the [startdate] as beginning filter up until
>to any date no limit for [Enddate].
>
>Thank in advance,
>
>
>
>local lcSql,lcWhere
>
>lcSql = ""
>lcWhere = ""
>
>lcSql = " select * from client  "
>
>Local lcTxtDueDate,lcTxtDelDate
>
>lcTxtDueDate = "DueDate>='[StartDate]' And DueDate<='[EndDate]'"
>lcTxtDueDate= Strtran( lcTxtDueDate, "[StartDate]", Dtoc(date())
>lcTxtDueDate= Strtran( lcTxtDueDate, "[EndDate]", Dtoc(date())
>		
>lcTxtDelDate = "DeliveryDate>='[StartDate]' And DeliveryDate<='[EndDate]'"
>lcTxtDelDate= Strtran( lcTxtDelDate, "[StartDate]", Dtoc(date())
>lcTxtDelDate= Strtran( lcTxtDelDate, "[EndDate]", Dtoc(date())
>
>lcWhere = " where " + lcTxtDueDate + " and " + lcTxtDelDate
>
>lcSql = lcSql + lcWhere
>
>
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform