Dynamic Calls in Smart Devices

Official Content

Call command is supported in Smart Device Events. The objects to be called can be defined at design time or in execution time. We call the latter dynamic or variable calls.

The supported syntax is:

Call( {'pgm '&var  | ATT:att } [ {, parm} …] )

Other supported ways are stated in Calls to Elements in Work Withs from Smart Device Events.

Dynamic Calls

Syntax

Call( {&var | ATT:att}  [ {, parm} …] )

The format of &var or att  is <type>:<name>[?<parameter>[{, parm} …]

The supported types are:

sd         Dashboard, WorkWith for Smart Devices pattern instance, Panel for Smart Devices
prc REST Procedure
wpb Web Object
eo External Object
   
<name>   Stands for the object name

Note:
Since GeneXus X Evolution 3 adds optimizations in build mechanisms, only the necessary metadata is generated for each main object and therefore you must also include dummy calls to the objects that are called dynamically and are not in the call tree of the main.  

Examples

1. Dispatcher with fixed parameter

Event 'ViewPerson'
    Composite
        &Object = GetPersonDetailLayout(PersonType)
        call(&Object,PersonId)
    EndComposite
EndEvent
procedure: GetPersonDetailLayout

Parm(in:&PersonType,out:&Object);

if &PersonType = Type.Person
   &Object = "sd:WorkWithDevicesPerson.Person.Detail"
else
   &Object = "sd:WorkWithDevicesDean.Dean.Detail"
endif
2. Dispatcher with dynamic parameter assignment
Event 'ViewPerson'
    Composite
        &Object = GetPersonDetailLayout(PersonType,PersonId)
        call(&Object)
    EndComposite
EndEvent 
procedure: GetPersonDetailLayout

Parm(in:&PersonType,in:&PersonId,out:&Object);

if &PersonType = Type.Person
   &Object = "sd:WorkWithDevicesPerson.Person.Detail?"+&PersonId.ToString().Trim()
else
   &Object = "sd:WorkWithDevicesDean.Dean.Detail?"+&PersonId.ToString().Trim()
endif
//and in some place of your main or object included in the main's call tree:
if 1 = 0
   WorkWithDevicesPerson.Person.Detail("1")
   WorkWithDevicesDean.Dean.Detail("1")
endif

Note

If the variable &Object is empty, the dynamic call ignores it.
 

 






Was this page helpful?
What Is This?
Your feedback about this content is important. Let us know what you think.