meta data for this page
  •  

Accessing the input and return parameters when executing in a batch file

For example, you wish to create a difference script, executing from your application using the ibec_CompareMetadata() function and the names of the database files as input parameter.

There is no built-in way to request IBEBlock input parameters. You can however create your own input form and after this compose an IBEBlock with a set of ibec_GetGlobalVar functions that should be executed before the main script:

 execute ibeblock  
 as 
 begin 
  ibec_SetGlobalVar('MyIntValue', 123); 
  ibec_SetGlobalVar('MyStrValue', 'bla-bla'); 
  ... 
 end; 

Your main IBEBlock should initialize variables using the ibec_GetGlobalVar function:

 execute ibeblock 
 as 
 begin 
  Var1 = ibec_GetGlobalVar('MyIntValue', 0); 
  Var2 = ibec_GetGlobalVar('MyStrValue', ''); 
  ... 
 end; 

Regarding output parameters… the only way to pass a value from IBEBlock into your application is to use the ibec_Progress function. Also you have to use the ExecScriptText2/ExecScriptFile2 functions of IBEScript.dll instead of ExecScriptText/ExecScriptFile:

 procedure ExecScriptFile2(AScriptFile : PChar; 
                       AErrorCallbackFunc : TScriptErrorCallbackFunc; 
                       ABeforeCallbackFunc : TScriptBeforeExecStatementFunc; 
                       AAfterCallbackFunc : TScriptAfterExecStatementFunc; 
                       AIBEBlockProgressFunc : TScriptIBEBlockProgressFunc); 
 
 procedure ExecScriptText2(AScriptText : PChar; 
                       AErrorCallbackFunc : TScriptErrorCallbackFunc; 
                       ABeforeCallbackFunc : TScriptBeforeExecStatementFunc; 
                       AAfterCallbackFunc : TScriptAfterExecStatementFunc; 
                       AIBEBlockProgressFunc : TScriptIBEBlockProgressFunc); 

TScriptIBEBlockProgressFunc = function (AProgressMessage : PChar) : integer; You have to call ibec_Progress function from within your IBEBlock and pass a string representation of any value including necessary additional data. In your application you should catch this string using an IBEBlock progress function and do what you need.