News

How to ‘simulate’ a ‘call variable’ in VB and C/SQL ?

In these languages, the possibility of doing ‘call variables’ (example: call(&Program)) does not exist as in FoxPro and Visual Fox. The way to program it is substituting the call(&program) by programs or routines that implement the DO CASE ...

In these languages, the possibility of doing ‘call variables’ (example: call(&Program)) does not exist as in FoxPro and Visual Fox.

The way to program it is substituting the call(&program) by programs or routines that implement the DO CASE (‘feature’ available since GeneXus 6.1).

For example

DO CASE
CASE &Program = ‘pgmname1’
   Call( pgmname1, ...)
CASE &Program = ‘pgmname2’
   Call( pgmname2, ...)
...
OTHERWISE
   Msg(‘Program does not exist’)
ENDCASE

It depends on what you need to develop, but it is probable that the ‘calls’ logic is programmed in objects that represent the calls’ domains. This is to say, it is not recommendable to program the calls in each ‘caller’ object because the maintenance of this is very expensive. What can be done, is a procedure that ‘encapsulates’ the call and passes it the necessary parameters.

In all cases it is necessary to know the domain the variable &program can take. This is also necessary in the case of Fox/VFP because the programs to be called must be included in the EXE.