Calls to Elements in Work Withs from Smart Device Events

Official Content
This documentation is valid for:

Client events in Smart Devices, that is, the events executed on the device (as opposed to those executed in the server side) have a slightly different grammar than server events. Mostly it is a subset of the grammar of GeneXus events (for example, that of the Web panels).

But it has to include a way to call the elements of the Work With itself. The syntax for every case (calling List, Detail in order to view information, Detail in order to edit -insert/update/delete-) is as follows (below you will have each case examined with an example):

Syntax

WorkWithDevicesObject.levelname.List( [parm1, ..., parmN ] )

WorkWithDevicesObject.levelname.Detail( [parm1, ..., parmN  ])

WorkWithDevicesObject.levelname.Detail.Insert( [&BC ] )

WorkWithDevicesObject.levelname.Detail.Update( pk_parameters )

WorkWithDevicesObject.levelname.Detail.Delete( pk_parameters )

Where (Syntax conventions)

WorkWithDevicesObject

Name of the Work With object. When it corresponds to the Work With for Smart Devices object pattern applied to a Transaction, it is made up of WorkWithDevices + TransactionName. (If the Work with object was created from scratch, as an object that is not related to any transaction, it is the name the user gave to it).

levelname

Name of the Level where the List or Detail is being called.

parmi

(For each i between 1 and n), variable or attribute whose value is sent to the List or Detail invoked, in i-th place. The data type must be compatible with the declared i-th parameter in the List/Detail node parm rule.

BC

(Optional) It is a variable based on the Business Component associated to the transaction whose Work With Detail is being called in order to insert a new information record on the database. The values of the BC variable are taken as a way of initializing the Detail attributes displayed when the call is performed. After the user actually inserts the information in the system, that variable will be returned loaded with those values. So, it is an inout parameter. If it is not sent, the Detail will be opened with the default values. If the level to which Insert is called is not the first in the BC, we must pass the primary key of the parent level, and optionally the BCLevel with the initialization values.

pk_parameters

When calling Update or Delete, we have to identify the corresponding record. To do so, we have to send the parameters that constitute the primary key.

Note: For Insert, Update and Delete, we use the Edit layouts. In the Detail Edit layout we can include the sections we want to view for this.

Calling the List

Syntax

WorkWithDevicesObject.levelname.List( [parm1, ..., parmN ] )

Supposing that from the List of WorkWithDevicesInputMeasures (based on the InputMeasures transaction) we want to reach the List of Work With for Smart Devices associated with the Urgent transaction, we will have to start with a button (for example in the Application Bar of the first Work With). We will call the action associated to button UrgentCall.

Level Urgent

Event 'UrgentCall'
    WorkWithDevicesUrgent.Urgent.List()
EndEvent

In the following example, and with the pattern shown, if we wanted to access the second List from any other Smart Devices object, we would code the following:

Event 'WithoutAbout'
    WorkWithDevicesAirport.AirportWithoutAbout.List()
EndEvent

Usually Lists don't need parameters, but this is not a general rule.

Calling Detail

To view information

Syntax

WorkWithDevicesObject.levelname.Detail( [parm1, ..., parmN ] )

In this example, from the Section(General) of the Airport Work With we will have to navigate to the AirportDetails Work With (which has no associated BCs, that is, it was not created from a Transaction but from scratch) showing ancillary data of an airport. So, in the events of the first one we will write the following code:

Level AirportDetails Section

Event 'MoreDetails'

AirportDetails.AirportDetails.Detail(AirportOACI) EndEvent

In this case, the parameter sent is the primary key of the Airport transaction. Therefore, the object called AirportDetails will have to have it stated in the Rules of the Section(General) node (not in the Detail Rules):

parm(AirportOACI);

In this case, because we want GeneXus to infer the record directly, we receive it in the primary key attribute of the transaction.

Note:This example is also applicable to a Detail with an associated BC (that is, associated to a transaction object), in which case it would be called in View mode.

To edit information

Syntax

WorkWithDevicesObject.levelname.Detail.Insert( &BC )

WorkWithDevicesObject.levelname.Detail.Update( pk_parameters )

WorkWithDevicesObject.levelname.Detail.Delete( pk_parameters )

Example

Calling the Detail of a WorkWith with an associated BC may only imply performing one of the three actions shown in the syntax (Insert, Update and Delete).

Event 'InsertCompany'
    WorkWithDevicesCompanies.Companies.Detail.Insert(&Companies)
EndEvent

 

Videos

Start Video Work With for Smart Devices – Behavior through Events
Start Video Events in Smart Devices


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