Interface Management Helper functions

Article05/08/20233 min read

App Integration Data FDW

SetIntegrationData

Procedure SetIntegrationData(Description: Text; Value: Variant)

This function is used to set information on Interface Management so that another module will pick it up later. It is used to send any filters or other information when attempting to call a function from another module.

GetIntegrationDataText

Procedure GetIntegrationDataText(Description: Text; Index: Integer): Text

This function is also present in versions for other data types. It is used to retrieve information stored in Interface Management, which enables modules to receive data from the module they’ve previously communicated with, like function returns.

Json Helper FDW

Serialize

Procedure Serialize(RecordVariant: Variant; FieldNameFilter: Text) JsonText: Text

This function serves as a generic serialization of a given record to JSON. If the desired JSON file needs to have all fields from the table, this is the function to use.

AddVariable

Procedure AddVariable(var JObject: JsonObject; VariableName: Text; VariableValue: Variant);

This function takes a JObject and adds a new field to the record being serialized. The VariableName is the name of the field and the VariableValue is its value.

AddRecord

Procedure AddRecord(var JObject: JsonObject; RecordVariant: Variant; FieldNameFilter: Text);

This function serializes a full record into a JObject. The containing fields can be filtered using the FieldNameFilter parameter so that only the fields who meet the filtering criteria get added to the JObject.

AddRecords

Procedure AddRecords(var JArray: JsonArray; RecordVariant: Variant; FieldNameFilter: Text);

This function adds to a JArray whatever records meet the filtering criteria set on the RecordVariant itself. Once again, the fields can be filtered using the FieldNameFilter.

RemoveNonAplhaNumericCharacters

Procedure RemoveNonAplhaNumericCharacters(OldValue: Text) NewValue: Text;

This function removed non-alphanumeric characters from a text. This is used to search for and write fields on a JSON because it’s good practice to not use these characters in JSON fields.

GetRecord

Procedure GetRecord(JObject: JsonObject; var RecordVariant: Variant; FieldNameFilter: Text)

This function deserializes a single record, given a JObject containing the JSON token pertaining to that serialized record.

GetFieldValue

Procedure GetFieldValue(JObject: JsonObject; FieldName: Text): JsonValue

This function is used to get a certain field from a JObject using only its name to retrieve it. This function already removes the non-alphanumeric characters when searching for the field.

GetFieldValueAsObject

Procedure GetFieldValueAsObject(JObject: JsonObject; FieldName: Text): JsonObject

This function gets a JObject from inside another JObject. This is useful for nested JSON objects, in which the value for a field in the object is an object itself.

GetGenericJsonValue

Procedure GetGenericJsonValue(JObject: JsonObject; VariableName: Text): JsonValue

This function does the same as GetFieldValue without taking care of non-alphanumeric characters when searching for the field.

GetGenericJsonObject

Procedure GetGenericJsonObject(JObject: JsonObject; VariableName: Text): JsonObject

This function does the same as GetFieldValueAsObject without taking care of non-alphanumeric characters when searching for the field.

GetGenericJsonToken

Local procedure GetGenericJsonToken(JObject: JsonObject; VariableName: Text): JsonToken

This function does the same as the previous two functions but returns a JsonToken instead.

GetJsonValue

Procedure GetJsonValue(JObject: JsonObject; Name: Text; var TextValue: Text)

This function, which is present in many versions concerning different data types, will retrieve from the JObject a value from the field with the given Name. This function doesn’t account for non-alphanumeric characters.

Deserialize

Procedure Deserialize(JsonText: Text; RecordVariant: Variant; FieldNameFilter: Text)

This function serves to fully deserialize a JSON text into a set of records from a given table. The function will attempt to insert the records upon deserializing them from the JSON text.