"Accessor tables"
A central part of the Extension API is an "accessor layer" to manipulate the XML content, but with no need to manipulate the XML Documents directly.
You are given functions that handles XML behind-the-scenes for you.
Derived from C#
Our "accessor table" -concept is derived from C# property classes.
...
Code Block | ||||
---|---|---|---|---|
| ||||
class Person { private string name; // the name field public string Name // the Name property { get { return name; } set { name = value; } } } |
Accessor Tables (AL)
Since Codeunits cannot be used as parameters in all BC versions, we have introduced "accesssor tables". Basically C# style acccessor classes, but implemented at table level.
...
The simplest accessor table, which only has one get/set-method property: "Description".
- Get_description(): Text
- Set_description(NewValue: Text)
- GetValue(_PathToGet: Text): Text
- SetValue(_PathToSet: Text; _NewValue: Text)
SetValueAsCData(_PathToSet: Text; _NewXmlCData: XmlCData)
SetValueAsCData(_PathToSet: Text; _NewCDataValue: Text)
Ns BaseDataModel Element
...
... for new (custom) tags:
- GetValue(_PathToGet: Text): Text
- SetValue(_PathToSet: Text; _NewValue: Text)
SetValueAsCData(_PathToSet: Text; _NewXmlCData: XmlCData)
SetValueAsCData(_PathToSet: Text; _NewCDataValue: Text)
Ns WhseInquiry Element
The "MOB Ns WhseInquiry Element" is used to build "<LookupResponse>"-elements in the WarehouseInquiryDataModel namespace. It is used from the "MOB WMS Lookup" codeunit.
...
... for new (custom) tags with no preexisting Get/Set-methods:
- GetValue(_PathToGet: Text): Text
- SetValue(_PathToSet: Text; _NewValue: Text)
SetValueAsCData(_PathToSet: Text; _NewXmlCData: XmlCData)
SetValueAsCData(_PathToSet: Text; _NewCDataValue: Text)
Ns Request Element
The "MOB Ns Request Element" is used to read data from "Request"-XmlDocuments.
...
... for new (custom) tags with no preexisting Get/Set-methods:
- GetValue(_PathToGet: Text): Text
- SetValue(_PathToSet: Text; _NewValue: Text)
- GetContextValue(_PathToGet: Text): Text - requires Android App 1.5.5 and Mobile WMS 5.22 (or newer)
In legacy versions...
- GetValue requires the tag to be in requestData-section of the Xml Request.
- The tag must have a corresponding HeaderField in the HeaderConfiguration declared for the page.
- Only tags with corresponding and exactly equally named HeaderFields is transferred from the calling page ("context") to the Xml Request
...
Since Android App 1.5.5 additional "ContextValues" is sent with the Xml Request when calling an action from a lookup-any page. This feature is currently not supported for all subpages and page types.
Reading such "ContextValues" requires Mobile WMS 5.22 (or newer).
- Actions from Lookup-pages provides additonal "ContextValues" with their request
- ContextValues can be read using GetValue (fallback to ContextValue if RequestData do not exist), or directly using GetContextValue if you need the original value when same tag exists as RequestData, or with GetValueOrContextValue (fallback to ContextValue if RequestData do not exist).
- All values from LookupResponse-elements from "caller" pages is added to the Xml Request and can be accessed with no need for a corresponding HeaderField
...