ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Standard functions / Windows functions / Miscellaneous WINDEV functions
  • Example: Dynamic compilation
  • Creating table columns through programming
Example: Dynamic compilation
WINDEVUser code (UMC)
The following example is used to dynamically create a procedure according to the choices made by the user. This example is used to enter two digits in two edit controls (EDT_Value1 and EDT_Value2) and to perform a calculation according to the option checked in the radio button.
// Example: operation selected in the RADIO_Operation radio button
Res is string
CodeToCompile is string = "Result1 is int" + CR + ...
"Edit2 is int" + CR
SWITCH RADIO_Operation
CASE 1: // Addition
CodeToCompile = CodeToCompile + ...
"Result1 = EDT_Value1+EDT_Value2" + CR + ...
"Edit2 = EDT_Value1 + EDT_Value2"
CASE 2: // Subtraction
CodeToCompile = CodeToCompile + ...
"Result1 = EDT_Value1-EDT_Value2" + CR + ...
"Edit2 = EDT_Value1-EDT_Value2"
CASE 3: // Multiplication
CodeToCompile = CodeToCompile + ...
"Result1 = EDT_Value1*EDT_Value2" + CR + ...
"Edit2 = EDT_Value1*EDT_Value2"
CASE 4: // Division
CodeToCompile = CodeToCompile + ...
"Result1 = EDT_Value1/EDT_Value2" + CR + ...
"Edit2 = EDT_Value1/EDT_Value2"
OTHER CASE:
CodeToCompile = ""
END
IF CodeToCompile <> "" THEN
CodeToCompile = CodeToCompile + CR + ...
"Info(""Result1 = "" + Result1, ""Edit2 = "" + Edit2)"
Res = Compile("Calculate", CodeToCompile)
IF Res = "" THEN
ExecuteProcess("Calculate", trtProcedure)
ELSE
Error("Error dynamic compilation", Res)
END
ELSE
Error("No function to compile")
END
Creating table columns through programming
WINDEVWEBDEV - Server codeReports and QueriesWindowsUser code (UMC)
MyString is string
 
HReadFirst(ZIPCODES, ZipCode)
FOR I = 1 TO 5
MyString = MyString + CR +  ...
"ControlClone(Column2, """ +  ZIPCODES.City + """)"
MyString = MyString + CR +  ...
"{""Table1." + ZIPCODES.City + ...
"""}..Caption = """ + ZIPCODES.City + """"
HReadNext(ZIPCODES)
END
 
Compile("ColumnCreation", MyString)
ExecuteProcess("ColumnCreation", trtProcedure)
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 05/26/2022

Send a report | Local help