There are many critical functions for processing DataItems in both the Clever WMS Devices Framework and Clever WMS Devices. All WMS Devices events pass .Sender, but as the Clever WMS Devices Framework is generally two-steps removed the base functions are accessible only via the HHF Session Mgt. Codeunit (Referred to below as SessionMgt). HHF Session Mgt is a singleton, or single-instance codeunit.

To clarify, when subscribed to an event in Clever WMS Devices you can use .Sender to gain access to public functions in Clever WMS Devices, but to access the functions in the framework (For instance InitialiseDataItem) you will need to go via HHF Session Mgt.

HHF Session Mgt. also maintains useful session data such as whether this is a handheld session, current user, current device, current location etc.

SessionMgt.GetContent

GetContent(DataItemName : Text) : Text

GetContent is used to get the data held in a DataItem. For instance, SessionMgt.GetContent('ItemNo') will return the value of the ItemNo DataItem.

SessionMgt.SetContent

SetContent(DataItemName : Text;DataItemValue : Text) : Text

SetContent is used to set the data held in a DataItem.

Example:

SessionMgt.SetContent('ItemNo',’1100’)

This will set the value of the ItemNo DataItem to “1100”. This does not set the Locked Property of the DataItem. To set this Property, see the SetResponseData function.

SessionMgt.InitResponseData

InitResponseData(DataItemName : Text;DataItemCaption : Text;ItemLock : Boolean)

InitResponseData is primarily used to initialise DataItems at the start of a transaction or immediately following a ‘POST’ action.

Example:

SessionMgt.InitResponseData('ItemNo', ItemJnlLine.FIELDCAPTION(“Item No.”), FALSE);

SessionMgt.InsertResponseData

InsertResponseData(DataItemName : Text; BeforeDataItem : Text;DataItemCaption : Text;ItemLock : Boolean)

InsertResponseData is as per InitResponseData but inserts the DataItem between other DataItems.

SessionMgt.AddGS1AppIdent

AddGS1AppIdent(DataItemName : Text;Ident : Integer)

Usually follows immediately after InitResponseData, this applies a GS1 Application Identifier to the DataItem.

Example:

SessionMgt.SetResponseData

SetResponseData(DataItemName : Text;ContentValue : Text;ItemLock : Boolean)

SetResponseData sets the value of a particular Response DataItem and can then lock the DataItem on the device.

Example:

SessionMgt.SetResponseData(‘ItemNo’, Item.”No.”, TRUE);

SessionMgt.GetTransLocked

GetTransLocked(DataItemName : Text) : Boolean

GetTransLocked is used to return the locked state of the DataItem as a Boolean. It is specific to transactional processing.

Example:

This will return the Locked Property of the ItemNo DataItem to the SetResponseData function and use it to set the Locked Property.

SessionMgt.AddTransColumnStyleGroup

AddTransColumnStyleGroup(GroupName : Text;GroupCaption : Text)

A ColumnStyleGroup is a grouping of ColumnStyles, this is purely a visual element for grouping related data together on the device.

Each ColumnStyle must belong to a ColumnStyleGroup. This function is specific to transactional processing.

SessionMgt.InsertTransColumnStyleGroup

InsertTransColumnStyleGroup(GroupName : Text; InsertGroupName : Text;GroupCaption : Text)

As per AddTransColumnStyleGroup, but inserts between other groups.

SessionMgt.AddTransColumnStyle

AddTransColumnStyle(GroupName : Text;ColumnName : Text;ColumnCaption : Text;ColumnWidth : Decimal)

A ColumnStyle is a purely visual element to be displayed on the device to the user. It must map to an existing DataItem name.

Below is an Example of a ColumnStyle and ColumnStyleGroup:

This function is specific to transactional processing.

SessionMgt.GetTransResponseCode

GetTransResponseCode() : Text

GetTransResponseCode is used to return the value of the ResponseCode.

Example:

IF SessionMgt.GetTransResponseCode = ‘YESNO’ THEN

This will return the ResponseCode Property. If it has been set then the Client will show a prompt. See the Yes \ No Prompt Example further on in the Developers Guide for a full example of how to us this function. This function is specific to transactional processing.

SessionMgt.GetTransConfirmed

GetTransConfirmed() : Text

GetTransConfirmed is used to return the value of the ConfirmedFlag.

Example:

IF UPPERCASE(SessionMgt.GetTransConfirmedFlag) = 'FALSE' THEN

This will check the value of the ConfirmedFlag. It will only have been set if the prompt Box (i.e Yes \ No) has shown and the user has selected a value. Otherwise it’s value will be blank.

Here is a table of the ConfirmFlag values:

For more information see the Yes \ No Prompt Example later in the guide for a full example of how to us this function. This function is specific to transactional processing.

SessionMgt.SetTransResponseCode

SetTransResponseCode(ResponseCode2 : Text)

SetTransResponseCode is used to set the value of the ResposeCode for the confirmation message.

Example:

SessionMgt.SetTransResponseCode(‘YESNO’);

This will set the value of the ResponseCode variable to YESNO. This will tell the client to prompt for a Yes \ No response from the user. This function is specific to transactional processing.

SessionMgt.SetTransResponseMessage

SetTransResponseMessage(ResponseMessage2 : Text)

SetTransResponseMessage is used to set the value of the ResposeMessage for the confirmation message.

Example:

Session.SetTransResponseMessage(‘Are you sure you want to do that thing?’);

This will set the value of the ResponseMessage variable to ‘Are you sure you want to do that thing?’. This will be displayed to the user when the prompt is displayed.

For more information see the Yes \ No Prompt Example for a full example of how to us this function. This function is specific to transactional processing.

SessionMgt.SetDeviceUserID

SetDeviceUserID(DeviceName2 : Text[50];UserID2 : Code[20];LocationCode2 : Code[20])

SetDeviceUserID is used to set the user and \ or location for a specific device.

SessionMgt.GetDeviceUserID

GetDeviceUserID() : Code[20]

GetDeviceUserID is used to get the user ID running on the device which makes the request.

SessionMgt.AddTransLookupColumnStyle

AddTransLookupColumnStyle(ParentDataItem : Text;ColumnName : Text;ColumnCaption

Text;ColumnTableNo : Integer;ColumnFieldNo : Integer;ColumnImportance : Integer)

Part of the replacement suite of functions for BuildResponseLookup. The new functions allow multiple columns in a lookup with the ability to specify the ‘Importance’ of a column of data.

AddTransLookupColumnStyle should always be used to specify the columns to be displayed before populating the lookup. Once Columns are set the developer may either use BuildTransLookup to build a lookup from a RecordRef, or AddTransLookupRow and AddTransLookupRowColumn to build a lookup manually.

For a full example of how to use this see BuildTransLookup. This function is specific to transactional processing.

SessionMgt.BuildTransLookup

BuildTransLookup(DataItemName : Text;LookupTable : RecordRef)

Part of the replacement suite of functions for BuildResponseLookup. The new functions allow multiple columns in a lookup with the ability to specify the ‘Importance’ of a column of data.

Before using this function, the developer should use AddTransLookupColumnStyle to specify the data to be displayed. The RecordRef/table can be filtered and sorted prior to calling BuildTransLookup. Temporary tables can also be used.

For cases where it is not possible to build a lookup from a table, see the AddTransLookupRow and AddTransLookupRowColumn functions.

Example: This example builds a list of purchase orders against a DataItem called ‘DocumentKey’.

On the device, a list of purchase orders is displayed showing Document No. and Vendor Order No

Clicking on the + key reveals the additional Order Date and Expected Receipt Date values…

This function is specific to transactional processing.

SessionMgt.AddTransLookupRow

AddTransLookupRow(ParentDataItem : Text;LookupKey : Text)

Before using this function, the developer should use AddTransLookupColumnStyle to specify the data to be displayed. BuildTransLookup should be used in preference where a table is available (Temporary or otherwise).

This function specifies a new row for the lookup – individual columns should be added using AddTransLookupRowColumn.

Example:

The above code sets a lookup against DataItem ‘ActStatus’, then manually adds three rows: Full, Part or None. This function is specific to transactional processing.

SessionMgt.AddTransLookupRowColumn

AddTransLookupRowColumn(ParentDataItem : Text;ColumnName : Text;ColumnValue : Text)

This function populates a column in an existing row for the lookup – rows should be added using AddTransLookupRow.

Example:

This function is specific to transactional processing.

SessionMgt.DeleteTransLookup

DeleteTransLookup(DataItemName : Text)

Deletes all lookup data against the parent data item specified in DataItemName.

This function is specific to transactional processing.

SessionMgt.AddTransSubFunction

AddTransSubFunction(SubFunctionName : Text;SubFunctionCaption : Text)

AddTransSubFunction can be used to create a custom child function of the current function. This will appear on the device under an ellipsis menu (…)

When a sub function is selected, the validate event for the parent function is called. The name of the sub function is written into the “RequestSubFuncCode” variable. The developer can check:

  1. That this variable is not blank

  2. Which function name this variable has been set to

… and then act accordingly.

This function is specific to transactional processing.

SessionMgt.ValidateTransDataItem

ValidateTransDataItem(DataItemName : Text;ContentValue : Text;ItemLock : Boolean)

ValidateTransDataItem can be used to fire Validation again for a data item. Will allow the developer to set a DataItem with a new value and force it to validate, without having to copy any of the standard validation code into their bespoke codeunit.

Example: For a full example of how to use this see the ValidateDataItem example.

One potential danger with this function is that it might cause the code to end up in an infinite loop. Once an item has been Validated, its Data State is set from “Validate” to “Context “. This function works by setting it back to “Validate” again. It is important to use this function with care. To guard against this eventuality, Handheld Framework counts the number of times that a DataItem has been Validated. If the same item has been validated more than 2 times, then it will throw an error:

This function is specific to transactional processing.

SessionMgt.GetHandheldSession

GetHandheldSession() : Boolean

Can be used to determine if we are running in a Handheld session. Useful when customising and extending functionality.

SessionMgt.GetTransResponseDataType

GetTransResponseDataType(DataItemName : Text) : Integer

GetTransResponseDataType returns the ResponseDataType of the DataItem.

The ResponseDataType can be used to change the behaviour of the DataItem. For example, if the ResponseDataType is Masked then when the DataItem is prompted for, text entered will appear as “***” (password characters).

Example:

ResponseDataType := SessionMgt.GetTransResponseDataType(‘ItemNo’);

This function is specific to transactional processing.

SessionMgt.SetTransResponseDataType

SetTransResponseDataType(DataItemName : Text;DataItemType : ' ,Masked')

SetTransResponseDataType sets the ResponseDataType of the DataItem.

The ResponseDataType can be used to change the behaviour of the DataItem. For example, if the ResponseDataType is Masked then when the DataItem is prompted for, text entered will appear as “***” (password characters).

Example:

SessionMgt.SetResponseDataType(‘Password’,MobileContent.Type::Masked);

This function is specific to transactional processing.

SessionMgt.RemoveTransColumnStyleGroup

RemoveTransColumnStyleGroup(GroupName : Text)

RemoveTransColumnStyleGroup can be used to remove an entire group of DataItems from the display without removing it from the underlying contextual data.

ItemNo is often displayed as a group of ItemNo and Description. If you were to remove the ItemNo ColumnStyleGroup this would remove both ItemNo and Description from the display.

Example:

SessionMgt.RemoveTransColumnStyleGroup(‘ItemNo’);

This function is specific to transactional processing.

SessionMgt.RemoveTransColumnStyle

RemoveTransColumnStyle(ColumnName : Text)

RemoveTransColumnStyle can be used to remove a single DataItem from the display without removing it from the underlying contextual data.

ItemNo is often displayed as a group of ItemNo and Description. If you were to remove the ItemNo ColumnStyle this would remove Only ItemNo and not Description from the display.

Example:

SessionMgt.RemoveTransColumnStyle(‘ItemNo’);

This function is specific to transactional processing.

SessionMgt.GetTransFixedDataItem

GetTransFixedDataItem(DataItemName : Text) : Boolean

GetTransFixedDataItem returns the Boolean value for whether the supplied DataItem is Fixed.

If a DataItem is Fixed, this means that it is mandatory and must have a value. For example, the Item No. is mandatory on a Pick as this must be supplied for the pick to work.

If a DataItem is set as Non-Fixed, then this means that it is optional and does not have to be supplied for the process \ function to work. For example, Shipping Agent Code is not Fixed in the Shipping function.

If a DataItem is not fixed, this means that it can be disabled. Disabling it will mean that it will not be prompted for on the Device Client (the value for this DataItem can still be set through code).

SessionMgt.GetTransFixedDataItemEnabled

GetTransFixedDataItemEnabled (DataItemName : Text) : Boolean

GetTransFixedDataItemEnabled returns the Boolean value for whether the supplied Fixed DataItem is Enabled.

SessionMgt.SetTransFixedDataItem

SetTransFixedDataItem(DataItemName : Text;FixedDataItem : Boolean)

SetTransFixedDataItem sets the Boolean flag “Fixed Data Item” for the supplied DataItem to the supplied value.

If this value is set to true then the DataItem becomes optional.

SessionMgt.GetLocationCode

GetLocationCode() : Code[20]

GetLocationCode gets the Location Code for the user which made the request.

Example:

LocCode := SessionMgt.GetLocationCode;