ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

This content has been translated automatically.  Click here  to view the French version.
Help / WLanguage / WLanguage syntax / Structured statements
  • parameter
  • Limitations and remarks
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
Compilation instruction: IF TargetExecution
In french: SI CibleExécution
The <IF ExecutionTarget> compile statement allows you to compile or not compile a WLanguage code depending on the execution target.
This statement is mainly used to easily get a multi-configuration code, without displaying any compilation errors.
Note: As a general rule, <COMPILE IF> compilation conditions should be used as much as possible to manage differences between different platforms.. However, when any of the configurations that use the code needs to adapt to multiple execution targets, it is necessary to use <IF ExecutionTarget>.
Example
<IF CibleExécution=ApplicationWindows OR CibleExécution=Java>
	Open(FEN_Menu)
<END>
<IF CibleExécution=Android OR CibleExécution=iOS>
	OpenMobileWindow(FEN_Menu)
<END>
<IF CibleExécution=Site>
	PageDisplay(PAGE_Login)
<END>
Syntax

Simple execution target

<IF <ExecutionTarget=<Target name>>
... // Code if the condition is true
<END>

Combination of conditions

<IF <ExecutionTarget=<Target name> OR <ExecutionTarget=<Target name2>>
... // Code if the condition is true
<END>

Using the <> operator

<IF <ExecutionTarget <> <Target name>>
... // Code if the condition is true
<END>

Using an ELSE block

<IF <ExecutionTarget <> <Target name>>
... // Code if the condition is true
<ELSE>
... // Code if the condition is false
<END>
Remarks

<Target name> parameter

The different targets are as follows:
  • Android
  • AppleWatch
  • DotNetApplication
  • LinuxApplication
  • WindowsApplication
  • DotNetAssembly
  • Library
  • ExternalComponent
  • iOS
  • iOSWidget
  • Java
  • Linux
  • MacCatalyst
  • RADPattern
  • ActionPlan
  • WebSocketServer
  • WebSocketServerLinux
  • WebSocketServerWindows
  • LinuxService
  • WindowsService
  • Site
  • SiteLinux
  • PHPSite
  • SiteWindows
  • UniversalWindowsApp
  • Web service
  • WebserviceLinux
  • WebserviceWindows
  • Windows
Limitations and remarks
  • You cannot declare global variables in an <IF ExecutionTarget> statement.
  • Local variables must have unique names for all execution targets.
Behavior change: Starting with version 28 Update 1, when GOing Linux applications, the runtime target taken into account will be "Linux" (and not "Windows" as in previous versions)..
Minimum version required
  • Version 25
This page is also available for…
Comments
Exemplo
<COMPILE IF ConfigurationType = Android>


ThreadExecute("ProcessarGpsMovimento", threadGlobalContext, _TempoReal)

Notif is Notification
Notif.Title = "Localizando..."

ThreadPersistent("ProcessarGpsMovimento", Notif)

<END>
Boller
23 May 2023
Exemplo
<COMPILE IF Configuration="Android application">


fDelete(fDataDir() + fsep() +"tab_pessoa.fic")
fDelete(fDataDir() + fsep() +"tab_pessoa. ndx")
fDelete(fDataDir() + fsep() +"tab_pessoa.mmo")
HModifyStructure("*", hmsBackgroundTask)
HCreationIfNotFound("*","senha@1")

<END>

<COMPILE IF Configuration="iOS application">

fDelete(fDataDir() + fsep() +"tab_pessoa.fic")
fDelete(fDataDir() + fsep() +"tab_pessoa. ndx")
fDelete(fDataDir() + fsep() +"tab_pessoa.mmo")
HModifyStructure("*", hmsBackgroundTask)
HCreationIfNotFound("*","senha@1")

<END>
Boller
23 May 2023

Last update: 09/20/2024

Send a report | Local help