Article ID: 131549
Article Last Modified on 3/3/2005
*** BEGINNING OF SAMPLE CODE ***
***************************************************************** * FOXTEST.PRG * * Demonstrates How Visual FoxPro Allows Passing Blank Values * * For Parameters Anywhere In the Parameter List * * * *****************************************************************
SomeDate = mydate(3,4,95) && Pass values for all parameters WAIT WINDOW SomeDate
SomeDate = mydate(4,,94) && Pass blank values for 2nd parameter WAIT WINDOW SomeDate
SomeDate = mydate(,4,) && Pass blank values for 1st and 3rd WAIT WINDOW SomeDate && parameters
SomeDate = mydate(,,94) && Pass blank values for 1st and 2nd WAIT WINDOW SomeDate && parameters
SomeDate = mydate(4,,) && Pass blank values for 2nd and 3rd WAIT WINDOW SomeDate && parameters (This is the only way FoxPro
&& 2.x allowed blank values to be passed, && at the end of the parameter list only.)
PROCEDURE MyDate PARAMETERS Month,Day,Year
* Give each variable a default value for the missing parameters.
DO CASE
CASE TYPE("Day")="L" lcday="01" CASE TYPE("Day")="N" lcday=ALLTRIM(STR(DAY))
ENDCASE
DO CASE
CASE TYPE("Year")="L" lcyear="95" CASE TYPE("Year")="N" lcyear=ALLTRIM(STR(Year))
ENDCASE
DO CASE
CASE TYPE("Month")="L" lcmonth="01" CASE TYPE("Month")="N" lcmonth=ALLTRIM(STR(Month))
ENDCASE
RETURN lcmonth+"/"+lcday+"/"+lcyear
*** End Of Sample Code ***
Additional query words: VFoxWin
Keywords: kbinfo kbcode KB131549