This chapter provides an overview of the Mobile classes and discusses the following topics:
Mobile classes overview
Mobile terms
Mobile hierarchy
HTML areas used in mobile
Debugging in mobile
Error handling
Data types for mobile
Scope of a mobile object
Mobile reference
See Also
Enterprise PeopleTools 8.46 PeopleBook: PeopleSoft Mobile Agent
Understanding Mobile Pages and Classes
PeopleSoft Mobile Agent extends the functionality of PeopleSoft Pure Internet Architecture to disconnected mobile devices, allowing users to continue working with their PeopleSoft applications on a laptop computer or personal digital assistant (PDA) while disconnected from the Internet or a local network.
When you create mobile pages for display on a mobile device (a laptop or PDA), you create the following in PeopleSoft Application Designer:
synchronizable Component Interfaces.
mobile pages based on your synchronizable Component Interfaces.
In addition, you may create PeopleCode programs that manipulate the data. You use the Mobile Classes in a mobile application to work with the data on a mobile device.
This document provides an overview of using the Mobile Classes, including:
Understanding the Mobile Device and the Component Interface
Understanding differences between Mobile and PIA
See Also
When the synchronization server and the mobile device are synchronized, the following items are downloaded to the mobile device:
instances of synchronizable Component Interfaces.
mobile pages.
associated mobile PeopleCode programs.
When a user of Mobile Agent synchronizes with the synchronization server the first time, the relevant data for the synchronizable Component Interface is loaded to the mobile device.
During subsequent synchronizations, the data on the mobile device is synchronized with the database on the synchronization server.
This section discusses the items that are downloaded to the mobile device. For more information about the synchronization process, see the Synchronization Server documentation.
See SyncServer Class.
Synchronizable Component Interface
A synchronizable Component Interface is a Component Interface that is created specifically for use with a mobile device. This means that the Component Interface definition has been specified as synchronizable on the Component Interface properties page.
See Enterprise PeopleTools 8.46 PeopleBook: PeopleSoft Mobile Agent.
The following shows a synchronizable Component Interface.
Level zero of the synchronizable component interface, as well as the data in the collections, are known as mobile objects, and are described in the following sections.
The Mobile Page enables a mobile device user to change data in the synchronizable Component Interface that underlies the Mobile Page. The changes to the Component Interface data are sent back to the PeopleSoft database when the mobile device is synchronized.
Mobile pages have list views and detail views.
List view pages are created from the top level of a component interface (the level zero), or a collection in a component interface. A list view can also be thought of as a search page.
Detail view pages are created from the content properties (fields) in a mobile page. Where and how a property displays on a page is determined by the content properties page for that property (field).
The following is the list view for a mobile page, generated by the level zero of the synchronizable component interface.
The following is a list view generated by a collection in a synchronizable component interface.
The following is the detail view generated by the properties (fields) of the synchronizable component interface.
Associated Mobile PeopleCode Programs
Access PeopleCode associated with a Component Interface by right clicking on an open synchronizable Component Interface in PeopleSoft Application Designer and selecting ViewPeopleCode.
The following is a PeopleCode program associated with the OnChange Mobile Component Interface event on a synchronizable Component Interface. The OnChange event is associated with a property on the page. The PeopleCode program uses a mobile object to access the QE_MB_EMPLID property on level zero on the synchronizable Component Interface that has been downloaded to the mobile device. The mobile object represents the PIA equivalent of a row of data, and can be used at any level in the data hierarchy, level zero, level one, level two, and so on. It is what is displayed in the Detail View of a Mobile Page.
When a mobile event occurs on a mobile object, such as a mobile object property being changed (the OnChange event) or a mobile object being loaded into the working set (the OnInit event), the mobile object is then available in the event's PeopleCode program using the %ThisMobileObject system variable.
If %ThisMobileObject.IsNew() Then /* do further check before save */ End-if;
Considerations Using the Mobile Object
A mobile object is the means in PeopleCode to access the synchronizable Component Interface. Mobile objects exist in relationship to each other in a hierarchy, which has a Component Buffer-like structure. A mobile object is just one row. A Data Collection is a collection of rows, each row being a mobile object.
The mobile object hierarchy has the equivalent of rowsets as data collections, rows as mobile objects, records and fields as properties. The topmost mobile object for a Component Interface is the equivalent of level zero on the underlying Component Interface. A Component Interface can also contain levels, which map to mobile object data collections. (These levels, in PIA, map to scrolls on a page, or in the Component Buffer, to rowsets.)
In the example in this section, the hierarchy of the mobile objects is:
QE_MB_COMPANY QE_MB_DEPARTMNT QE_MB_EMPLOYEE
QE_MB_COMPANY — level zero.
QE_MB_DEPARTMNT — level one. This is a collection of mobile data objects.
QE_MB_EMPLOYEE — level two. This is a collection of mobile data objects.
Mobile objects exist in relationship to each other in a hierarchy. The following diagram shows the different classes, and how one class can be returned from a method or a property in another class.
The following presents the mobile object hierarchy in a class diagram:
Mobile classes hierarchy
Mobile Class hierarchy — class diagram 1 of 2
Mobile class hierarchy — class diagram 2 of 2
The following is a list of the various classes, with a brief description of each.
Mobile Class |
Description |
Represents the PIA equivalent of a row of data, and can be used at any level in the data hierarchy, level zero, level one, level two, and so on. It is what is displayed in the Detail View of a mobile page. |
|
Contains a collection of empty mobile objects. |
|
Used to access a level on a mobile page, such as level one, level two, and so on. |
|
Used to access the display attributes for a list view. |
|
Used to access the default display attributes for a peer reference. |
|
Used to access the display attributes for a property. |
|
Used to access the attributes of a property (field) on a mobile page. |
|
Contains a collection of PropertyInfo objects. Used when a property on a mobile page is actually a collection (such as a reference to level one, level two, and so on.) |
The psmobile.ini file contains debug settings for mobile PeopleCode.
For a laptop, you can edit the psmobile.ini file on the mobile device. This file is either in the C:\Windows or C:\WinNT directory.
For a PDA, you must copy the psmobile.ini file to the laptop or desktop using ActiveSync, edit it there, then copy it back.
Use the DebugEnabled value in the psmobile.ini file to control whether debugging is enabled for your application. If you specify a 1 for this value, you can use the PeopleCode debugger with your mobile application for debugging.
In addition, you can use the TracePC value in the psmobile.ini file to specify that a trace is to be run, as well as what type of operations in the application should be traced.
The following is an example of the psmobile.ini file.
[PSMOBILE] Language=ENG Port=8080 HomeDirectory=C:\Program Files\PeopleSoft\PeopleSoft Mobile Agent MaxCachedStatements=100 MaxCachedObjects=100 debug=1 [SYNC] SyncGateway=http://fsampson040502.corp.peoplesoft.com:80/SyncServer SyncLogVerbose=0 [PCDEBUG] DebugEnabled=0 DebugDatabase=Your Database Name DebugOprid=Your OPRID DebugIPAddress=nnn.nnn.nnn.nnn DebugPort=9500 [Trace] ;------------------------------------------------------------- ; PeopleCode Tracing Bitfield ; ; Bit Type of tracing ; --- --------------- ; 1 - Trace instructions ; 2 - List the program ; 4 - Show assignments to variables ; 8 - Show fetched values ; 16 - Show stack ; 64 - Trace start of programs ; 128 - Trace external function calls ; 256 - Trace internal function calls ; 512 - Show parameter values ; 1024 - Show function return value ; 2048 - Trace each statement in program ; Dynamic change allowed for TracePC and TracePCMask TracePC=0
The following are the debug settings you can set in the psmobile.ini file.
DebugEnabled |
Specify whether debugging is enabled or not. Use a 0 to turn off debug mode, a 1 to turn on debug mode. |
DebugDatabase |
Specify the actual database (not the domain) that application server uses with the PeopleTools PeopleCode debugger (this should be the database that is used for synchronizing). |
DebugOprid |
Specify the userId you use to log onto the PeopleTools PeopleCode debugger. |
DebugIPAddress |
Specify the IP address or machine name of the application server. |
DebugPort |
Specify the port number that the application server (PSDBGSRV) has been configured to use. |
Use the TracePC value in the psmobile.ini file to specify that a trace is to be run, as well as what type of operations in the application should be traced.
All trace information is written to a file named psmobile.log, located in the directory defined by %temp%.
Note. Be aware that tracing logs can grow to a large size. Only specify tracing when necessary, and only trace critical operations.
The following are the trace settings you can specify using TracePC. You can specify more than one trace by adding the numbers together.
0 |
Turn all tracing off. |
1 |
Trace all instructions. |
2 |
List the program being traced. |
4 |
Show all assignments to all variables. |
8 |
Show all fetched values. |
16 |
Show stack. |
64 |
Trace start of programs. |
128 |
Trace external function calls. |
256 |
Trace internal function calls. |
512 |
Show all parameter values. |
1024 |
Show function return value. |
2048 |
Trace each statement in program. |
For initial error handling, check the return values of methods and functions as they are used. When you want to check for errors depends on your application. However, if you check for errors after every assignment, you may see a performance degradation.
Mobile does not use collections of errors or messages (PSMESSAGES), as is the case with PeopleSoft Pure Internet Architecture. However, you can specify a message set and number for use with a mobile page and with mobile properties. This is done in PeopleSoft Application Designer, to ensure that the correct messages get downloaded to the mobile device.
Once the messages have been distributed to the mobile device, you can access them using PeopleCode the same way you would access any message in the message catalog, using the following functions:
MessageBox
MsgGet
MsgGetText
MsgGetExplainText
In the following example, the program checks for an invalid value for a field, and issues a message if the value is incorrect. This code would be in an OnChangeEdit event associated with a property.
&Value = %ThisMobileObject.EmailID; If Not(Find("@", &Value)) Then /* invalid email address probably */ MessageBox(0, "", 525, 2, "Message Not Found"); &PropAttrs = %ThisMobileProperty.GetPropertyAttrsByName("EmailID"); &PropAttrs.InError = True End-If;
See Also
Creating Synchronizable Component Interfaces
All mobile objects are declared as type ApiObject. For example:
Local ApiObject &MyMobileCollection; Local ApiObject &MyMobileObject = %ThisMobileObject;
Note. Mobile objects can be declared only as Local.
A mobile object can be instantiated from PeopleCode. In addition, it can only be instantiated within the mobile events.
Local variables are the only type of PeopleCode variables supported in mobile.
The following is the Session class method used with Mobile.
See Also
Syntax
GetCompIntfc([COMPINTFC.]ComponentName)
Description
The GetCompIntfc method returns a reference to an empty mobile object. Mobile objects are the means of accessing the synchronizable Component Interface in PeopleCode, so this is similar to creating an empty Component Interface in PIA.ComponentName, when used by itself, takes a string value. If you use COMPINTFC.ComponentName it is not a string value; it is a constant that automatically is renamed in your code if the Component Interface definition is ever renamed.
Parameters
ComponentName |
Specify the name of the synchronizable Component Interface. You can either use ComponentName by itself or prefaced with the keyword COMPINTFC. |
Returns
This method returns an empty mobile object if successful, or Null on error (such as ComponentName specifies a nonexistent synchronizable Component Interface).
Example
Local ApiObject &SaveCustomer, &Customer; &SaveCustomer = %ThisMobileObject.MyFavoriteCustomer; &Customer = %Session.GetCompIntfc(COMPINTFC.CUSTOMER); &Customer.Name="Acme Applicances"; if (&Customer.Get() <> true) then; if (&Customer.Create() <> true) then; ErrorHandler(); Else &Customer.Save(); End-If; End-if; %ThisMobileObject.MyFavoriteCustomer = &Customer;
The mobile object represents the PIA equivalent of a row of data. It is what is displayed in the Detail View of a Mobile Page.
The mobile object is accessed using the %ThisMobileObject system variable.
The following are the mobile class methods, in alphabetical order.
Note. With the mobile class methods, and unlike the Component Interface class methods, all properties that have been set are used in the search. This provides more flexibility, and does not require setting up specific Get, Create, or Find keys.
Syntax
Create()
Description
The Create method associates the mobile object with a new, open mobile object. It is available only on an empty mobile object that is returned by the GetCompIntfc session method.
Parameters
None.
Returns
A Boolean value: True if object was successfully created, False otherwise.
Example
Local ApiObject &SaveCustomer, &Customer; &SaveCustomer = %ThisMobileObject.MyFavoriteCustomer; &Customer = %Session.GetCompIntfc(COMPINTFC.CUSTOMER); &Customer.Name="Acme Applicances"; if (&Customer.Get() <> true) then; if (&Customer.Create() <> true) then; ErrorHandler(); Else &Customer.Save(); End-If; End-if; %ThisMobileObject.MyFavoriteCustomer = &Customer;
See Also
Syntax
Find()
Description
The Find method returns a reference to a CI collection that is populated with a collection of empty mobile objects. The properties that the application developer sets within the empty mobile object are used as the Find keys. This method is available only on an empty mobile object that is returned by the GetCompIntfc session method. Using it on a non-empty mobile object causes an error.
This collection may have zero elements in it if no items matching the key values you set were found. If you set no keys, all of the mobile objects of the type specified by GetCompIntfc are returned.
While the PIA Component Interface Find method limits the number of returned instances to 300, the mobile Find method has no limit.
The Find method returns only the topmost parent mobile objects. You do not have to set values for all the key values. After you have a collection, you can use the CI Collection method Item to return the empty mobile object, and then use Get on the mobile object to instantiate it.
Note. Wildcards are not implemented for this release.
Parameters
None.
Returns
A CICollection collection of mobile objects. You must use the Get method on these mobile objects before you can use them.
Example
/* Error checking left out for clarity */ &MyCI = %Session.GetCompIntfc(CompIntfc.QE_MB_COMPANY_CI); &MyCI.QE_MB_COMPANY = "Acme Appliances"; &MyCIFindCollection = &MyCI.Find(); &Acme = &MyCIFindCollection.Item(1); &Acme.Get();
Syntax
Get()
Description
The Get method associates a mobile object with the user-defined properties that have been explicitly set on the object.
Parameters
None.
Returns
A Boolean value: True if mobile object was successfully retrieved, False otherwise.
Example
Local ApiObject &SaveCustomer, &Customer; &SaveCustomer = %ThisMobileObject.MyFavoriteCustomer; &Customer = %Session.GetCompIntfc(COMPINTFC.CUSTOMER); &Customer.Name="Acme Applicances"; if (&Customer.Get() <> true) then; if (&Customer.Create() <> true) then; ErrorHandler(); Else &Customer.Save(); End-If; End-if; %ThisMobileObject.MyFavoriteCustomer = &Customer;
Syntax
GetName()
Description
The GetName method returns the class name of the mobile object.
Parameters
None.
Returns
The class name of the mobile object as a string. This is the name of the synchronizable Component Interface, or one of the levels.
Example
&GetName = &qe_mb_obj_setup.GetName(); /* Write the name of the Object to the Results field */ &qe_mb_obj.QE_MB_RESULTS = "The name of this Mobile Object is: " | &GetName;
Syntax
GetParent()
Description
The GetParent method returns a mobile object that is the parent of the Mobile object that is executing the method. If you are at the top level (level zero), it returns itself.
Parameters
None.
Returns
The parent mobile object.
Example
/* This loop will continue getting parent level, until level 0 is reached. */ &obj = %ThisMobileObject; Repeat &obj = &obj.getparent(); /* Do some processing */ until (&obj.IsSameAs(%ThisMobileObject.gettopparent()));
Syntax
GetPeerDefaultAttributesByName(Reference, Property)
Description
When a peer reference does not have a value associated with it, the display attributes can only be accessed using the PeerDefaultAttributes class. After a peer reference has values, it can be accessed using the ListViewAttrs class.
Use the GetPeerDefaultAttributesByName method to access the default peer reference attributes for the specified property on the peer reference.
Parameters
Reference |
Specify the name of a peer reference, as a string. |
Property |
Specify a property on the peer reference, as a string. |
Returns
A reference to a PeerDefaultAttributes class.
Example
%ThisMobileObject.GetPeerDefaultAttributesByName("CI_CUSTOMER_MB", "ADDRESS").Visible = True;
See Also
Syntax
GetPropertyAttrsByName(propertyname)
Description
The GetPropertyAttrsByName method returns a reference to a PropertyAttrs object, used to modify display attributes of properties.
Parameters
propertyname |
The name of the property. |
None.
Returns
A PropertyAttrs object, used to modify display attributes of properties.
Example
%ThisMobileObject.GetPropertyAttrsByName("QE_MB_SET_DATE").Visible = False;
See Also
Syntax
GetPropertyByName(Name)
Description
The GetPropertyByName method returns the value of a property. Generally this function is used only in applications that cannot get the names of the mobile object user-defined properties until runtime.
Parameters
Name |
Specify the name of the property you want to access. The PeopleCode program terminates if this property does not exist. |
Returns
The value of the property specified by Name. For a collection, it returns a reference to the collection.
Example
&GetPropertyByName_Char = &qe_mb_obj_setup.GetPropertyByName(&CharacterPropertyName); /*Write the results of the GetPropertyByName method to the results Field */ &qe_mb_obj.QE_MB_RESULTS = "The value of the Character Field: " | &GetPropertyByName_Char | "
Syntax
GetPropertyInfoByName(propertyname)
Description
The GetPropertyInfoByName method returns a reference to a PropertyInfo object.
Parameters
propertyname |
The name of the property. |
Returns
A PropertyInfo object.
Example
&pinfo = %ThisMobileObject.GetPropertyInfoByName("QE_MB_SET_DATE"); if &pinfo.HasDefaultValue = True then %ThisMobileObject.QE_MB_SET_DATE = &pinfo.DefaultValue; end-if;
See Also
Syntax
GetTopParent()
Description
The GetTopParent method returns a mobile object that is the topmost parent of the Mobile object.
Parameters
None.
Returns
A reference to the topmost parent mobile object as a mobile object. If the current mobile object is the topmost object, this method returns a reference to the current mobile object.
Example
/* Check if the created Mobile Object is at Level 0 */ If (&qe_mb_obj_setup.IsSameAs(&qe_mb_obj_setup.GetTopParent())) Then /* Set the Parent Level variable to 0. Results for this get set below the looping statement */ &Parent_Level = 0; End-If;
Syntax
IsNew()
Description
The IsNew method indicates if this object has never been synchronized.
Parameters
None.
Returns
A Boolean value: True if this object was created on the device and never synchronized, False if this object has been synchronized.
Example
&IsNew = &qe_mb_obj_setup.IsNew(); /*Write the results of the IsNew to the results Field */ &qe_mb_obj.QE_MB_RESULTS = "The following is " | &IsNew | ": The Mobile Object is new, and has never been synced.";
Syntax
IsNewAndNeverSaved()
Description
The IsNewAndNeverSaved method indicates if this object was created on the device and has not yet been saved.
Parameters
None.
Returns
A Boolean value: True if this object was created on the device and has not yet been saved, False otherwise.
Example
&IsNewAndNeverSaved = &qe_mb_obj_setup.IsNewAndNeverSaved(); /*Write the results of the IsNewAndNeverSaved method to the results Field */ &qe_mb_obj.QE_MB_RESULTS = "The following is " | &IsNewAndNeverSaved | ": This Mobile Object is new, and has never been saved. "
Syntax
IsSameAs(MObject)
Description
The IsSameAs method determines if one mobile object is the same as another. This is useful when you are trying to determine if the %ThisMobileObject is the topmost mobile object.
Parameters
MObject |
Specify the mobile object to which this mobile object is being compared. |
Returns
A Boolean value: True if this mobile object is the same as the mobile object, False otherwise.
Example
/*Check if the created Mobile Object is at Level 0 */ If (&qe_mb_obj_setup.IsSameAs(&qe_mb_obj_setup.GetTopParent())) Then /* Set the Parent Level variable to 0. Results for this get set below the looping statement */ &Parent_Level = 0; EndIf;
Syntax
ReadBlobFromFile(blobpropertyname, filename)
Description
The ReadBlobFromFile method reads a file on your mobile device and writes it into the attachment property. The attachment property is a reference property on the synchronizable Component Interface; its purpose is to contain attachment data.
When the mobile user synchronizes from the mobile page, the attachment file data contained in the property is sent to the synchronization server. The size of the attachment on the synchronization server is updated to reflect the new contents.
If you use this method, your synchronized Component Interface must use an attachment: the synchronization server must use its attachment events, and must run the attachment method PutAttachment.
You can specify either an absolute or a relative path for filename .
If you specify a relative path, the path that is appended is the working directory for the PSMobile.exe file. The exact path depends on the installation of Mobile on the device.
For example, if you specified \files\MyFile.ext for filename, the actual path might be something like c:\Program Files\PeopleSoft\PeopleSoft Mobile Agent\files\Myfile.ext.
Parameters
blobpropertyname |
A string specifying the name of the reference property used for the attachment. |
FileName |
This parameter is a string specifying the path and filename of the file that you use as an attachment. |
Returns
This is a Boolean value: True if the attachment was read successfully; False otherwise.
Example
%ThisMobileObject.ReadBlobFromFile("Attachment", %ThisMobileObject.QE_MB_READ_WRITE | %ThisMobileObject.ATTACHUSERFILE);
Syntax
Save()
Description
The Save method saves the entire mobile object hierarchy in which the mobile object is contained.
You do not generally call the Save method on %ThisMobileObject; that saving is done when the user clicks on the Save button.
Using this method does not save associated peer references; you must use the Save method on each peer references separately.
The standard PeopleSoft save business rules (that is, any PeopleCode programs associated with OnSaveEdit, OnSavePreChange, and so on) are executed after you execute this method.
If you instantiate another mobile object with PeopleCode (using Get, Create) these objects are not automatically saved when the end user clicks the Save button. You must use the Save method with these instances separately.
Using the Save method on developer-instantiated mobile objects does not guarantee they will be saved. The save does not take effect until the end user clicks the Save button.
If you make changes to a developer-instantiated mobile object, the end user is not automatically prompted to save when trying to leave the page because it is not part of the current component.
Note. If a developer uses the Save method with a developer-instantiated component interface, and if the end user did not make any other changes to data in the current component interface, when the user leaves the current unit of work, they are not prompted to save their data.
To ensure that the data actually gets committed to the database, the developer can force a prompt to occur. This can be done using the following code:
%ThisMobileObject.SetModified(True);
See Also
Mobile Component Transaction Model
Parameters
None.
Returns
A Boolean value: True if component was successfully saved, False otherwise.
Example
Local ApiObject &SaveCustomer, &Customer; &SaveCustomer = %ThisMobileObject.MyFavoriteCustomer; &Customer = %Session.GetCompIntfc(COMPINTFC.CUSTOMER); &Customer.Name="Acme Applicances"; if (&Customer.Get() <> true) then; if (&Customer.Create() <> true) then; ErrorHandler(); Else %ThisMobileObject.SetModified(True) &Customer.Save(); End-If; End-if; %ThisMobileObject.MyFavoriteCustomer = &Customer;
Syntax
SetModified(IsModified)
Description
The SetModified method forces the mobile object to have the specified modified value of True or False.
Note. Not only does using this method change the overall modified state of the object, but when changing the modified state to False it also clears the modified flag on any properties that had been modified.
Parameters
IsModified |
Specify whether this mobile object has been modified. This parameter takes a Boolean value: True, the mobile object has been modified, False, the object has not been modified. |
Returns
The current setting of this mobile object before being modified by this method: True for modified before this setting, False for not modified before this setting.
Example
/* Get the value of the TrueFalse check box, to see how to set the modified setting. */ If &qe_mb_obj.QE_MB_TRUE_FALSE = True Then &True_or_False = True; &SetModified = &qe_mb_obj_setup.SetModified(True); Else &True_or_False = False; &SetModified = &qe_mb_obj_setup.SetModified( False); End-If;
Syntax
SetPropertyByName(propertyname, value)
Description
The SetPropertyByName method sets the value of a property. Generally this function is used only in applications that cannot set the names of the component interface properties until runtime.
Parameters
propertyname |
The name of the property. |
value |
This is the value to which the property is set. |
Returns
None. The PeopleCode program terminates if there is an error.
Example
%ThisMobileObject.SetPropertyByName("QE_MB_NUMBER", 77777);
Syntax
ValidateEnum(propertyname)
Description
The ValidateEnum method verifies if the value of a property is a valid enumeration value. Enumeration values are originally set in PeopleSoft Application Designer, when the original records for the synchronizable Component Interface are designed.
Parameters
propertyname |
Specify the name of the property as a string. |
Returns
A Boolean value: True if the value is a valid dynamic enumeration, False otherwise.
Example
/* Validate if the value entered into Results field is a valid dynamic enumeration */ &ob = %ThisMobileObject; &Validate_DE = &ob.ValidateEnum(&ob.QE_MB_RESULTS); /*Enter Results into Results Field */ &ob.QE_MB_RESULTS = "The following statement is " | &Validate_DE | ": The Property " | &ob.QE_MB_RESULTS | " is a valid Dynamic Enumeration.";
Syntax
ValuesDifferFromLastSync()
Description
The ValuesDifferFromLastSync method indicates if at least one property has a value that differs from its value since the last synchronization.
If this object has been created on the mobile device, that is, when there is no previous sync value, the first saved values are used as the comparison values for this property.
This is a true member by member comparison of data values, not modified flags. The SetModified method has no effect on this method.
Parameters
None.
Returns
A Boolean value: True if at least one property in this object has a value that differs from its original value, False otherwise.
Example
&ValuesDifferFromLastSync = &qe_mb_obj_setup.ValuesDifferFromLastSync(); /*Write the results of the ValuesDifferFromLast Sync method to the results Field*/ &qe_mb_obj.QE_MB_RESULTS = "The following is " | &ValuesDifferFromLastSync | ": At least one property has a value that differs from the values last synced."
Syntax
WasSaved()
Description
The WasSaved method indicates if this object has been saved since it was created or last synchronized.
Parameters
None.
Returns
A Boolean value: True if this object has been saved since it was created or last synchronized, False otherwise.
Example
&WasSaved = &qe_mb_obj_setup.WasSaved(); /*Write the results of the WasSaved method to the results Field */ &qe_mb_obj.QE_MB_RESULTS = "The following is " | &WasSaved | ": This Mobile Object has been saved since it was last synced, or created. "
Syntax
WriteBlobToFile(blobpropertyname, filename)
Description
The WriteBlobToFile method reads the attachment property and writes it into a file on your mobile device. The attachment property is a reference property on the synchronizable Component Interface; its purpose is to contain attachment data.
When the mobile user synchronizes from the mobile page, this attachment file data contained in the property is received from the synchronization server.
If you use this method, your synchronized Component Interface must use an attachment: the synchronization server must use its attachment events, and must run the attachment method GetAttachment.
You can specify either an absolute or a relative path for filename .
If you specify a relative path, the path that is appended is the working directory for the PSMobile.exe file. The exact path depends on the installation of Mobile on the device.
For example, if you specified \files\MyFile.ext for filename, the actual path might be something like c:\Program Files\PeopleSoft\PeopleSoft Mobile Agent\files\Myfile.ext.
Parameters
blobpropertyname |
A string specifying the name of the reference property that is used for the attachment. |
FileName |
A string specifying the path and filename of the attachment file. This parameter takes a string value. |
Returns
This is a Boolean value: True if the attachment was written successfully; False otherwise.
Example
%ThisMobileObject.WriteBlobToFile("Attachment", %ThisMobileObject.QE_MB_READ_WRITE | %ThisMobileObject.ATTACHUSERFILE);
The following is the Mobile Class property.
Note. Normally, properties for mobile objects are the equivalent of the user-define properties on the synchronizable Component Interface. The properties described here should not be used for user-defined properties when one designs a synchronizable Component Interface in the PeopleSoft Application Designer.
Description
The PropertyInfoCollection property returns a reference to a collection of PropertyInfo objects that describe the shape of the mobile object.
This property is read-only.
See Also
The PropertyInfoCollection objects contains a collection of PropertyInfo objects.
A PropertyInfoCollection is returned from the following:
a mobile object
a PropertyInfo object
See Also
The following is the method for the PropertyInfoCollection property.
Syntax
Item(number)
Description
The Item method returns a PropertyInfo object that exists at the number position in the PropertyInfoCollection.
Parameters
number |
A position in the PropertyInfoCollection collection. The first position is 1. |
Returns
A reference to the PropertyInfo object that exists at the number position in the PropertyInfoCollection collection. If the specified item is a collection, the returned PropertyInfo object is invalid and is set to NULL.
Example
/* Copy all like properties from &Item to &TargetItem */ for &i = 1 to &Item.PropertyInfoCollection.Count if &Item.PropertyInfoCollection.Item(&i).IsSimpleApplicationProperty then try &TargetItem.SetPropertyByName(&Item.PropertyInfoCollection.Item(&i).Name, &Item.GetPropertyByName(&Item.PropertyInfoCollection.Item(&i).Name)) catch Exception &xException; end-try; end-if; end-for;
The following is the property for the PropertyInfoCollection property.
Description
This property returns the number of PropertyInfo objects in the PropertyInfoCollection .
This property is read-only.
Example
/* Copy all like properties from &Item to &TargetItem */ for &i = 1 to &Item.PropertyInfoCollection.Count if &Item.PropertyInfoCollection.Item(&i).IsSimpleApplicationProperty then try &TargetItem.SetPropertyByName(&Item.PropertyInfoCollection.Item(&i).Name, &Item.GetPropertyByName(&Item.PropertyInfoCollection.Item(&i).Name)) catch Exception &xException; end-try; end-if; end-for;
The PropertyInfo class objects are returned by the following:
the Item method of a PropertyInfo collection
the GetPropertyInfoByName of a mobile object
The following are the properties for the PropertyInfo object.
Description
This property returns the default value for this mobile object property.
This property is read-only.
Note. Definitional defaults are applied only when an Object is Created, just before the OnInit PeopleCode is run.
Example
&pinfo = %ThisMobileObject.GetPropertyInfoByName("QE_MB_SET_DATE"); if &pinfo.HasDefaultValue = True then %ThisMobileObject.QE_MB_SET_DATE = &pinfo.DefaultValue; end-if;
Description
This property returns a Boolean value: True if this mobile object property has a default value; False otherwise.
This property is read-only.
Note. Definitional defaults are applied only when an object is created, just before the OnInit PeopleCode is run.
Example
&pinfo = %ThisMobileObject.GetPropertyAttrsByName("Text"); if &pinfo.HasDefaultValue = True then; %ThisMobileObject.Text = &pinfo.DefaultValue; end-if;
Description
This property returns True if the property that the PropertyInfo object is describing is a Data Collection, False otherwise. If IsCollection is False, the object represents a mobile object user-defined or system property.
This property is read-only.
Example
/* Use the PropertyInfoCollection Property of the mobile object class, and use the Item number field to determine the item method from the PropertyInfoCollection class. */ &PropertyInfo = &qe_mb_obj_setup.PropertyInfoCollection.item(&qe_mb_obj.QE_MB_PC_ITEM); /*Write the results to the results field */ &qe_mb_obj.QE_MB_RESULTS = "The following is " | &PropertyInfo.IsCollecton | ": This Property represents a collection";
Description
This property is True if this is a reference to this object's parent, False otherwise. A property that is RefToParent is also a System Property.
This property is read-only.
Example
/* Use the PropertyInfoCollection Property of the mobile object class, and use the Item number field to determine the item method from the PropertyInfoCollection class. */ &PropertyInfo = &qe_mb_obj_setup.PropertyInfoCollection.item(&qe_mb_obj.QE_MB_PC_ITEM); /* Write the results to the results field */ &qe_mb_obj.QE_MB_RESULTS = "The following is " | &PropertyInfo.IsRefToParent | ": This is a reference to this Object' Parent. "
Description
This property is True if this is a peer reference, False otherwise.
This property is read-only.
Description
This property is True is this is a simple, non-reference application-defined property; False otherwise. In other words, if True, it is not a system property, collection, nor peer reference; it is a property that was defined on the synchronized Component Interface in PeopleSoft Application Designer.
This property is read-only.
Example
/* Copy all like properties from &Item to &TargetItem */ for &i = 1 to &Item.PropertyInfoCollection.Count if &Item.PropertyInfoCollection.Item(&i).IsSimpleApplicationProperty then try &TargetItem.SetPropertyByName(&Item.PropertyInfoCollection.Item(&i).Name, &Item.GetPropertyByName(&Item.PropertyInfoCollection.Item(&i).Name)) catch Exception &xException; end-try; end-if; end-for;
Description
This property is True if this is a System Property; False otherwise. System properties include the OID and VERSION properties, and references to Parents.
This property is read-only.
Example
/* Use the PropertyInfoCollection Property of the mobile object class, and use the Item number field to determine the item method from the PropertyInfoCollection class. */ &PropertyInfo = &qe_mb_obj_setup.PropertyInfoCollection.item(&qe_mb_obj.QE_MB_PC_ITEM); /*Write the results to the results field */ &qe_mb_obj.QE_MB_RESULTS = "The following is " | &PropertyInfo.IsSystemProperty | ": This is a system property. "
Description
The name of the property.
This property is read-only.
Example
/* Use the PropertyInfoCollection Property of the mobile object class, and use the Item number field to determine the item method from the PropertyInfoCollection class. */ &PropertyInfo = &qe_mb_obj_setup.PropertyInfoCollection.item(&qe_mb_obj.QE_MB_PC_ITEM); /*Write the results to the results field */ &qe_mb_obj.QE_MB_RESULTS = "The name of the accessed Property is: " | &PropertyInfo.Name;
Description
This property returns a reference to another PropertyInfoCollection collection if the object executing the property is a collection.
This property is read-only.
Example
/* Use the PropertyInfoCollection Property of the mobile object class, and use the Item number field to determine the item method from the PropertyInfoCollection class. */ &PropertyInfo = &qe_mb_obj_setup.PropertyInfoCollection.item(&qe_mb_obj.QE_MB_PC_ITEM); /*Write the results to the results field. Since this property returns a CompIntfPropertyInfoCollect Object, use the Count porperty of the PropertyInfoCollection class, to test this.*/ &qe_mb_obj.QE_MB_RESULTS = "The property count of the CompIntfProperyInfoCollection returned by this property is: " | &PropertyInfo.PropertyInfoCollection.count;
A CI Collection is returned by the mobile object Find method. A CI Collection is a collection of empty mobile objects.
See Also
The following is the CI Collection method.
Syntax
Item(index)
Description
The Item method returns a Mobile Component Interface object. Once you've returned a reference, to instantiate it, use the Get method on the returned object.
Parameters
index |
A number value: the index number for the Component Interface to fetch. Indexes start at 1. |
Returns
An empty mobile object that was fetched. You must use the Get method to get the data for that object.
Example
/* Error checking left out for clarity */ &MyCI = %Session.GetCompIntfc(CompIntfc.QE_MB_COMPANY_CI); &MyCI.QE_MB_COMPANY = "Acme Appliances"; &MyCIFindCollection = &MyCI.Find(); &Acme = &MyCIFindCollection.Item(1); &Acme.Get();
The following is the CI Collection property.
Description
The number of Mobile Component Interface objects in the CI Collection collection. This property is read-only.
Example
/* Error checking left out for clarity */ &MyCI = %Session.GetCompIntfc(CompIntfc.QE_MB_COMPANY_CI); &total_in_collection = &MyCI.count;
A Data Collection object is created when you have a Mobile Page that is based upon a synchronizable Component Interface that contains levels. You do not directly instantiate the DataCollection object.
The synchronizable Component Interface upon which the following Mobile Page is based has the following levels:
level one: QE_MB_DEPARTMNT
level two: QE_MB_EMPLOYEE
level three: QE_MB_ROLE
Use the DataCollection methods and property to access the mobile objects that map to the rows on these levels.
Following are the methods for the DataCollection class.
Syntax
GetListViewAttrs(propertyname)
Description
This method returns the List View attributes for this property. These attributes describe display attributes for a column on a List View.
In the following screen shot, the columns include:
First Name
Last Name
Title
City
Postal code
List View columns
Using the GetListViewAttrs method, you can return a reference to one of these columns, then using the ListViewAttrs properties, you can change how the column displays.
Parameters
propertyname |
This is the name of the property for which the List View attributes are retrieved. |
Returns
A ListViewAttrs object containing information about the property column.
Example
/* Change the Label for the City Property which is a member of the objects in the QE_DEMO_SITE Collection to "Town"*/ &ListAttrs = %ThisMobileObject.QE_DEMO_SITE.GetListViewAttrs("City"); &ListAttrs.Label = "Town";
Syntax
Item(index)
Description
The Index method returns a reference to the mobile object referenced at index. This mobile object on the Mobile Page is the equivalent of one row on a level in the synchronizable Component Interface upon which the Mobile Page is based.
Parameters
index |
Specify the index number for the mobile object to return. Indexes start at 1. |
Returns
A reference to the mobile object that was returned.
Example
Local ApiObject &ob, &Session; Local ApiObject &PropertyInfo; &ob = %ThisMobileObject; /************************************************ * Insert some children * *************************************************/ &ChildCount = &ob.MyChild1.Count; &ob.MyChild1.InsertItem(&ChildCount); &ChildObject = &ob.MyChild1.Item(&ChildCount + 1); /************************************************ * Manipulate Collections * *************************************************/ &ob.MyChild1.InsertItem(0); &ChildObject = &ob.MyChild1.Item(1); &ChildCount = &ob.MyChild1.Count; If (&ChildCount > 0) Then; For &index = 1 To &ChildCount &ChildObject = &ob.MyChild1.Item(&index); &PropertyInfo = &ChildObject.GetPropertyInfoByName("version"); &PropertyInfo.Label = "Version: "; &ob.MyChild1.Item(&index).version = &index + 100; &ob.MyChild1.Item(&index).GetPropertyInfoByName("version").visible = True; End-For; End-If;
Syntax
DeleteItem(location)
Description
The DeleteItem method removes the specified item from the collection and deletes the mobile object. This mobile object on the Mobile Page is the equivalent of one row on a level in the synchronizable Component Interface upon which the Mobile Page is based.
Note. Once you delete an item, it is deleted immediately. You no longer have access to it.
Parameters
location |
Specify the location within the collection of the mobile object to delete. This parameter takes a numeric value. |
Returns
A Boolean value: True if the mobile object was successfully deleted, False otherwise.
Example
Local ApiObject &ob, &Session; Local ApiObject &PropertyInfo; &ob = %ThisMobileObject; /************************************************ * Insert some children * *************************************************/ &ChildCount = &ob.MyChild1.Count; &ob.MyChild1.InsertItem(&ChildCount); &ChildObject = &ob.MyChild1.Item(&ChildCount + 1); /************************************************ * Manipulate Collections * *************************************************/ &ob.MyChild1.DeleteItem(1); &ChildObject = &ob.MyChild1.Item(1); &ChildCount = &ob.MyChild1.Count;
Syntax
InsertItem(location)
Description
The InsertItem method inserts a new mobile object item at the specified location, plus 1. This mobile object on the Mobile Page is the equivalent of one row on a level in the synchronizable Component Interface upon which the Mobile Page is based.
Parameters
location |
Specify the location of the new item. The mobile object is inserted at one past the number specified with location. For example, InsertItem(0) places the item in the first location, which is 1. InsertItem(count) places the new item in the last location: count + 1. |
Returns
A Boolean value: True if the mobile object was successfully inserted, False otherwise.
Example
Local ApiObject &ob; &ob = %ThisMobileObject; If &MobileObjectValueExists = False Then &qe_mb_empl.create(); /*Populate Level 1 data. */ &NewCICounter_LV1 = 0; &ob_top_parent = &ob.gettopparent(); While &NewCICounter_LV1 <> &ob_top_parent.QE_MB_DEPARTMNT.count; /*Insert Level 1 Row */ &qe_mb_empl.QE_MB_DEPARTMNT.InsertItem(&NewCICounter_LV1 + 1); &qe_mb_empl.QE_MB_DEPARTMNT.Item(&NewCICounter_LV1 + 1).QE_MB_DEPARTMENT = &ob_top_parent.QE_MB_DEPARTMNT.Item(&NewCICounter + 1).QE_MB_DEPARTMENT_LV1; &qe_mb_empl.QE_MB_DEPARTMNT.Item(&NewCICounter_LV1 + 1).QE_MB_DEPT_DESCR = &ob_top_parent.QE_MB_DEPARTMNT.Item(&NewCICounter_LV1 + 1).QE_MB_DEPT_DESCR; &NewCICounter_LV2 = 0; End-While; End-If;
Following is the property for DataCollection.
Description
The number of mobile objects in the collection. This is the equivalent of the number of rows on a level in the synchronizable Component Interface upon which the Mobile Page is based.
This property is read-only.
Example
Local ApiObject &ob, &Session; Local ApiObject &PropertyInfo; &ob = %ThisMobileObject; /************************************************ * Insert some children * *************************************************/ &ChildCount = &ob.MyChild1.Count; &ob.MyChild1.InsertItem(&ChildCount + 1); &ChildObject = &ob.MyChild1.Item(&ChildCount + 1); &ob.MyChild1.InsertItem(1); &ChildObject = &ob.MyChild1.Item(1); &ChildCount = &ob.MyChild1.Count;
The ListViewAttrs class objects are returned from the GetListViewAttrs data collection method.
The ListViewAttrs class has methods and properties that provide information about the properties for the synchronizable Component Interface upon which the Mobile Page is based.
Following is the ListViewAttrs method.
Syntax
IsSet(attribute)
Description
The IsSet method indicates if the given attribute had been explicitly set from PeopleCode, or if it is in an un-initialized state.
Parameters
attribute |
Specify one of the ListViewAttrs properties, which contains display information about a mobile property column in a List View. |
Returns
This method returns a Boolean value: True if this attribute has been set, False otherwise.
Example
/* Write the results to the results string */ &results_string = "The following is " | &ThisMobileObject.QE_DEMO_SITE("City").IsSet("Visible") | ": City is visible. "
Following are the ListViewAttrs properties.
Description
Use this property to change the label shown at the top of a Mobile Page Detail View. DetailViewLabel is only available to a ListViewAttrs object that has been fetched with an empty string.
This property is read-write.
Example
Note that in this example, GetListViewAttrs uses an empty string as input. This is how to call GetListViewAttrs for use with DetailViewLabel.
/* Pass empty string */ &ListAttrs = %ThisMobileObject.QE_DEMO_SITE.Item(1).QE_DEMO_SITE_H.GetListViewAttrs(""); &ListAttrs.DetailViewLabel = "My Site Details";
Description
Use this property to change the label shown at the top of a column in a List View; it is the label for a property for mobile objects in a Data Collection.
This property is read-write.
In the following example, there are five columns, hence five labels: First Name, Last Name, Title, City and Postal.
List View columns
Example
/* Change the Label for the City Property which is a member of the objects in the QE_DEMO_SITE Collection to "Town"*/ &ListAttrs = %ThisMobileObject.QE_DEMO_SITE.GetListViewAttrs("City"); &ListAttrs.Label = "Town";
Description
Use this property to change the tab label. The tab label is indirectly exposed through PeopleCode; it overwrites the List View Label, which is the default if no tab label is defined. However, if the ListViewLabel property is set for a property that has a tab label, the tab label is overridden with the PeopleCode ListViewLabel value.
ListViewLabel is only available to a ListViewAttrs object that has been fetched with an empty string.
This property is read-write.
Example
Note that in this example, GetListViewAttrs uses an empty string as input. This is how to call GetListViewAttrs for use with ListViewLabel.
/* Pass empty string */ &ListAttrs = %ThisMobileObject.QE_DEMO_SITE.Item(1).QE_DEMO_SITE_H.GetListViewAttrs(""); &ListAttrs.ListViewLabel = "My Sites";
Description
This property is True if this column for a property in a List View is visible. Setting this property to False hides the column.
Note. Even if a property has been marked as Invisible on the mobile page definition in PeopleSoft Application Designer, you can still override this property using PeopleCode.
This property is read-write.
Example
/* Make invisible the City property column which is a member of the objects in the QE_DEMO_SITE Collection */ &ListAttrs = %ThisMobileObject.QE_DEMO_SITE.GetListViewAttrs("City"); &ListAttrs.Visible = False;
The PropertyAttrs class objects are returned from the GetPropertyAttrsByName method. This class has methods and properties that provide information about the properties for the synchronizable Component Interface upon which the Mobile Page is based.
For example, to hide the QE_MB_ADDRESS property on the synchronizable Component Interface upon which the current Mobile Page and its mobile objects are based, you can use the following PeopleCode on an OnChange event.
%ThisMobileObject.GetPropertyAttrsByName("QE_MB_ADDRESS").Visible = False;
Following is the PropertyAttrs method.
Syntax
IsSet(attribute)
Description
The IsSet method indicates if the given attribute had been explicitly set, or if it is in an un-initialized state.
Parameters
attribute |
Specify one of the PropertyAttrs properties, which contains display information about a mobile property. |
Returns
This method returns a Boolean: True if this attribute has been set, False otherwise.
Example
/*Write the results to the results field */ &qe_mb_obj.QE_MB_RESULTS = "The following is " | &qe_mb_obj_setup.GetPropertyAttrsByName(&CharacterPropertyName).IsSet("Visible") | ": " | GetPropertyAttrsByName(&CharacterPropertyName) | "is visible. ";
Following are the PropertyAttrs properties.
Description
This property is True if the mobile property is display only; False otherwise. This only affects the Mobile Page; this value is not saved to the mobile database and is not synchronized.
Note. If a property has been marked as Display Only on the mobile page definition in PeopleSoft Application Designer, you can override this property using PeopleCode. If a property has been marked as Display Only on the Component Interface, you can not override this property using PeopleCode.
If you use this property to make a collection display only, all the fields will be display only, except for those that are displayed as pushbuttons. To make a pushbutton display only, you must set the pushbutton property specifically to be display only, either in Application Designer or with PeopleCode. You must set the pushbutton property for every row to be display only.
This property is read-write.
Example
Declare Function Hide_or_Unhide_WorkingSetProps_SetValues PeopleCode QE_MB_PC_DER.QE_MB_GET FieldFormula; /*If Get() checkbox is selected, unhide Set Value Properties, and grey Create Check Box. Also maske sure Get() check box is ungrayed. */ If %ThisMobileObject.QE_MB_GET = True Then /*Make sure Create() Checkbox now has value "N" */ %ThisMobileObject.QE_MB_CREATE = False; Hide_or_Unhide_WorkingSetProps_SetValues( True); %ThisMobileObject.GetPropertyAttrsByName("QE_MB_CREATE").DisplayOnly = True; Else /* If Get() checkbox is unselected, hide Set Value Properties, and ungrey Create Check Box. */ If %ThisMobileObject.QE_MB_GET = False Then Hide_or_Unhide_WorkingSetProps_SetValues( False); %ThisMobileObject.GetPropertyAttrsByName("QE_MB_CREATE").DisplayOnly = False; End-If; End-If;
Description
Set this property within an OnSaveEdit event to cause any field on a Detail View that contains incorrect information to be displayed as red. This alerts the user to correct the data in that field.
This field is automatically reset. The developer does not have to reset this field.
This only affects the Mobile Page; this value is not saved to the mobile database and is not synchronized.
This property is read-write.
Example
%ThisMobileObject.GetPropertyAttrsByName("QE_MB_ADDRESS").InError = True;
Description
Use this property to manipulate the label for this mobile property. This only affects the Mobile Page; this value is not saved to the mobile database and is not synchronized.
This property is read-write.
Example
&ob = %ThisMobileObject; &PropertyInfo = &ob.GetPropertyAttrsByName("text"); &PropertyInfo.Label = "This is text";
Description
An asterisk (*) is displayed beside fields that are defined as Required in PeopleSoft Application Designer. You can use this property to specify whether this asterisk, also called the required field cue, is displayed for a particular field.
This property is True if the mobile property displays the RequiredCue; False otherwise. This only affects the Mobile Page; this is not saved to the mobile database and is not synchronized.
Use this to make a field be required that was not specified as being required when the synchronized Component Interface was created in the PeopleSoft Application Designer. (You cannot make a required field be not required.)
For example, many fields are made required through PeopleCode. This means they aren't defined as Required in PeopleSoft Application Designer, and the end user may be confused. For these fields, you can use this property.
Note. This property affects only fields where a required field cue is otherwise permissible. That is, regardless of the setting of the property, no cue is ever shown on a push button, a display-only field, and so on.
This property is read-write.
Example
&ob = %ThisMobileObject; &PropertyInfo = &ob.GetPropertyAttrsByName("text"); &PropertyInfo.ShowRequiredCue = True;
Description
This property is True if this field is visible in the Mobile Page Detail View displaying it. Setting this property to False hides the field.
This only affects the Mobile Page; this value is not saved to the mobile database and is not synchronized.
Note. Even if a property has been marked as Invisible on the mobile page definition in PeopleSoft Application Designer, you can still override this property using PeopleCode.
If you set this value to False for a collection property, the collection is no longer visible.
Note. You can only make collections invisible using PeopleCode. You cannot set a collection to be invisible in Application Designer.
This property is read-write.
Example
If %ThisMobileObject.QE_MB_PROP_METH = "Visible" Or %ThisMobileObject.QE_MB_PROP_METH = "DisplayOnly" Or %ThisMobileObject.QE_MB_PROP_METH = "ShowRequiredCue" Or %ThisMobileObject.QE_MB_PROP_METH = "SetModified" Then %ThisMobileObject.getpropertyattrsbyname("QE_MB_TRUE_FALSE").Visible = True; End-If; If %ThisMobileObject.QE_MB_PROP_METH = "Item" Or %ThisMobileObject.QE_MB_PROP_METH = "DeleteItem" Or %ThisMobileObject.QE_MB_PROP_METH = "InsertItem" Then %ThisMobileObject.getpropertyattrsbyname("QE_MB_PC_ITEM").Visible = True; End-If;
PeerDefaultAttributes are returned by the GetPeerDefaultAttributesByName method of a mobile object.
When a peer reference does not have a value associated with it, the display attributes can only be accessed using the PeerDefaultAttributes class. After a peer reference has values, it can access using the ListViewAttrs class.
The following is the PeerDefaultAttributes class method.
Syntax
IsSet(Attribute)
Description
The IsSet method indicates if the given attribute had been explicitly set, or if it is in an un-initialized state.
Parameters
Attribute |
Specify one of the PeerDefaultAttributes properties. |
Returns
A Boolean value: True if the attribute has been explicitly set, False otherwise.
Example
&PeerAtt = %ThisMobileObject.GetPeerDefaultAttributesByName("CI_CUSTOMER_MB", "ADDRESS"); If &PeerAtt.IsSet(Visible) Then /* some code */ End-if;
This section discusses the PeerDefaultAttributes properties in alphabetical order.
Description
This property is True if the peer reference is display only; False otherwise. This only affects the Mobile Page; this value is not saved to the mobile database and is not synchronized.
Note. If a property has been marked as Display Only on the mobile page definition in PeopleSoft Application Designer, you can override this property using PeopleCode. If a property has been marked as Display Only on the Component Interface, you can not override this property using PeopleCode.
This property is read-write.
Example
&IsVisible = %ThisMobileObject.GetPeerDefaultAttributesByName("CI_CUSTOMER_MB", "ADDRESS").DisplayOnly; If &DisplayOnly Then /* some code */ Else /* some other code */ End-if;
Description
Use this property to manipulate the label for this peer reference. This only affects the Mobile Page; this value is not saved to the mobile database and is not synchronized.
This property is read-write.
Example
%ThisMobileObject.GetPeerDefaultAttributesByName("CI_CUSTOMER_MB", "ADDRESS").Label = &Label;
Description
This property is True if this peer reference is visible in the Mobile Page Detail View displaying it. Setting this property to False hides the peer reference.
This only affects the Mobile Page; this value is not saved to the mobile database and is not synchronized.
This property is read-write.
Example
%ThisMobileObject.GetPeerDefaultAttributesByName("CI_CUSTOMER_MB", "ADDRESS").Visible = True;
Mobile uses a subset of the classes, functions, and system variables used in PIA. Here is a list of those used in mobile.
The following is a list of the PeopleCode classes used in mobile.
Application Package
Array
Component Interface
Exception
Request (part of iScript)
Considerations Using the Request Class
Only the following request class method (%Request) is supported for mobile:
GetParameter
Only the following request class properties (%Request) are supported for mobile:
BrowserType
BrowserVersion
HTTPMethod
Protocol
Note. Other request class methods and properties may not return an error when used in mobile, but do return a blank value, an empty array, False, and so on, according to the datatype of the value returned.
The following is a list of the system variables used in mobile, by category.
APIs: %Session, %Super, %This, %CompIntfcName
Data and Time: %Date, %DateTime, %Request, %Time
Mobile specific: %DeviceType, %MobilePage, %ThisMobileObject
Considerations Using Default Values
For a record field, you can specify constants for a default, such as %Date. Mobile only supports the following for record field defaults. In addition, these are only supported for date, datetime, and time type fields (as appropriate):
%ClientDate
%Date
%DateTime
%Time
See Also
The following is a list of the built-in functions used in mobile, by category.
Arrays: CreateArray, CreateArrayAny, CreateArrayRept, Split
Conversion: Char, Code, String, Value
Date and Time: AddToDate, AddToDateTime, AddToTome, Date, Date3, DatePart, DateTime6, DateTimeValue, DateValue, Day, Days, Days360, Days365, Hour, Minute, Month, Second, Time, Time3, TimePart, TimeValue, Weekday, Year
Internet: GetHTMLText
Language Constructs: Break, Declare Function, Evaluate, Exit, For, Function, If, Local, Repeat, Return, While
Math: Abs, Acos, Asin, Atan, Cos, Cot, Degrees, Exp, Fact, Int, Integer, Ln, Log10, Nod, Product, Radians, Rand, Round, Sign, Sin, Sqrt, Tan, Truncate
Message Catalog and Message Display: MessageBox, MsgGet, MsgGetExplainText, MsgGetText
Mobile: TransferMobilePage, GenerateMobileTree
OLE: CreateObject, ObjectDoMethod, ObjectGetProperty, ObjectSetProperty
Saving: DoSave
Note. DoSave can only be used in the OnChange and OnChangeEdit events.
String: Clean, Code, Exact, Find, Left, Len, Lower, LTrim, Replace, Rept, Right, Rtrim, String, Substitute, Substring, Upper
Validation: Error
Workflow: Warning
The DoSave built-in function is supported in the following Mobile events:
OnChange
OnChangeEdit
Save processing (including OnSaveEdit, OnSavePreChange, and OnSavePostChange) is executed exactly as if the end user clicked the save button. OnObjectChangeEdit and OnObjectChange are executed prior to initiating the save processing.
If an error occurs during save processing, it is handled the same as if the user clicked the save button. For example, if save processing encounters an OnSaveEdit error, it displays the appropriate message box. If the error is on the current detail view, the detail view is rendered with the error highlighted. If the error is not on the current detail view, the user is asked if they would like to transfer to the object with the error. The user can correct the error and continue working with the component. If the PeopleCode calls DoSave followed by TransferMobilePage and an error occurs during save processing, the TransferMobilePage is not executed.
See Also