ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage syntax / Structured statements
  • parameter
  • Limitations and remarks
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
Compilation statement: IF ExecutionTarget
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.
Remark: In general, <COMPILE IF> compilation conditions should be used as much as possible to manage the 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 ExecutionTarget=WindowsApplication OR ExecutionTarget=Java>
Open(WIN_Menu)
<END>
<IF ExecutionTarget=Android OR ExecutionTarget=iOS>
OpenMobileWindow(WIN_Menu)
<END>
<IF ExecutionTarget=Site>
PageDisplay(PAGE_Login)
<END>
Syntax

Single 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
  • Webservice
  • 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.
New behavior: Starting with version 28 Update 1, when testing Linux applications (Go icon), the execution platform 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: 03/21/2023

Send a report | Local help