AYUDA EN LÍNEA
 WINDEVWEBDEV Y WINDEV MOBILE

Este contenido se ha traducido automáticamente.  Haga clic aquí  para ver la versión en inglés.
Ayuda / WLanguage / Funciones WLanguage / Funciones estándar / Funciones de Windows / Funciones varias de WINDEV
  • Local variables
  • Compiling the expression
  • Using a procedure of the external component
  • Dynamic code
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReportes y ConsultasCódigo de Usuario (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Código Navegador
WINDEV Mobile
AndroidWidget Android iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Otros
Procedimientos almacenados
Evaluates the value of an expression built in a character string.
Ejemplo
// Evaluation d'une formule
x,y are reals
x = 1.5
y = 5
Trace(EvaluateExpression("cos(x)+sin(y)"))
Sintaxis
<Result> = EvaluateExpression(<Expression> [, <Parameters>])
<Result>: Any type
  • If the expression compiles without any errors, result of the expression.
  • If the expression fails to compile, if it does not return a value or if an error occurs during the evaluation, it triggers a fatal error.
<Expression>: Character string
Expression to evaluate.
<Parameters>: Optional variable of type WLangageCodeCompiling
Novedad versión 2024
WINDEVWEBDEV - Código Servidor Name of Variable type WLangageCodeCompiling used to define compilation parameters (WLanguage functions allowed, forbidden, etc.)..
If this parameter is not specified, all WLanguage functions are allowed..
Observaciones

Local variables

The local variables of the current process can be used directly in the expression.

Compiling the expression

The code is recompiled whenever EvaluateExpression is called.
To avoid the compilation step, you can use Compile and Execute to build the code of a procedure, compile it once and run it several times. In this case, you will lose the ability to directly use local variables of the current process which will need to be replaced by parameters in the procedure.

Using a procedure of the external component

The code is recompiled whenever EvaluateExpression is called.
The call to a procedure of the external component must name this procedure with its full name.
EvaluateExpression("MonComposant.MaCollection.MaProcédure()"))

Dynamic code

Constants cannot be used in dynamic code (defined with the CONSTANT keyword).
When using constants in a code, all the occurrences of the constants are replaced with their value during the compilation in the editor but the correspondence between the name of constants and their value is not "embedded" in the application. Therefore, the dynamic compilation cannot use the constants.
Let's see two alternatives:
1 - Use variables instead of constants:
CONSTANT
CST_Nom = 1
END
becomes for example
CST_Nom is int = 1
ou
2 - In the string containing the code that must be compiled dynamically, replace the name of the constant by its value:
sCode is string
// Dans la chaîne qui contient le code que l'on va compiler dynamiquement
// au lieu de laisser le nom de la constante comme ici:
sCode=[
Info(CST_Nom)
]
// On remplace le nom de la constante par sa valeur
sCode = Replace(sCode,"CST_Nom", CST_Nom, WholeWord + IgnoreCase)
// Il est ensuite possible de compiler le code
IF Compile("ProcDyn", sCode) <> "" THEN
Error("Erreur de compilation de la procédure dynamique: ", ...
ErrorInfo())
ELSE
// Puis de l'exécuter
WHEN EXCEPTION IN 
ExecuteProcess("ProcDyn", trtProcedure)
DO
Error("Erreur d'exécution de la procédure dynamique: ", ...
ExceptionInfo())
END
END
Componente: wd290vm.dll
Versión mínima requerida
  • Versión 17
Esta página también está disponible para…
Comentarios
Haga clic en [Agregar] para publicar un comentario

Última modificación: 02/02/2024

Señalar un error o enviar una sugerencia | Ayuda local