Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Need to specify additional parameter
Message
De
24/01/2001 22:57:03
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Problèmes
Divers
Thread ID:
00468310
Message ID:
00468316
Vues:
11
>Hi everybody,
>
>Quite recently I changed one of UDF, which is used in several our applications. I added couple new parameters, made it more robust, etc. However, sometimes I get a message: "Need to specify additional parameter" and when I try to debug, I see "Source not available" Error. Does it mean, I have to recompile all applications? Some of them are not mine...
>
>Thanks in advance.

If you're adding new parameters, add them at the END of the LPARAMETERS list and do NOT change the order of the parameters that were there originally. For example:
* Original code:
LPARAMETERS ;
  tcParameter1, ;
  tlParameter2, ;
  tdParameter3

* Change to:
LPARAMETERS ;
  tcParameter1, ;
  tlParameter2, ;
  tdParameter3, ;
  tcNewParameter1, ;
  ttNewParameter2, ;
  ...
If a routine calls the UDF with fewer parameters than are in the LPARAMETERS statement, the extra ones (at the end) simply get initialized to .F. without error. If your modified routine depends on these values, you will need to set your own default values using something like this:
LPARAMETERS ;
  tcParameter1, ;
  tlParameter2, ;
  tdParameter3, ;
  tcNewParameter1, ;
  ttNewParameter2

LOCAL ;
  lnParameterCount

lnParameterCount = PCOUNT()

IF lnParameterCount < 5
  ttNewParamter2 = <i>SomeDefaultDateTimeValue</i>

ENDIF

IF lnParameterCount < 4
  tcNewParamter1 = <i>SomeDefaultCharacterString</i>

ENDIF

* Using the reverse order as shown above, lets the calling function
* specify 3, 4, or 5 parameters.
Regards. Al

"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov

Neither a despot, nor a doormat, be

Every app wants to be a database app when it grows up
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform