reconnect

Reconnect data loaded from a disconnected record set (XML, JSON, or Struct) with the occurrences in a database or component.

reconnect {/readcheck}  {EntityName}

Switches

/readcheck—for read-only fields, ignores any user modifications and restores the field value from database.

Parameters

EntityName—component entity; can be a string, or a field, variable, function, or parameter that evaluates to a string.

Return Values

Values returned in $status

Value

Meaning

0

Occurrence was successfully reconnected.

>0

Number of errors encountered.

In this context, an error is defined as the number of times an On Error trigger returned a negative value.

Use

Allowed in all Uniface component types.

Description

Used after the xmlload, webload, structToComponent statements, reconnect resolves the occurrence state information stored in the processing information attributes of the XML stream. The procedure followed for each occurrence depends on the value of the XML status attribute for each occurrence in the XML stream.

The reconnect statement merges all disconnected occurrences that have the XML states "", "new", "mod" and "del". Occurrences that have the XML state "est" are not be reconnected. This improves performance and avoids CRC errors on occurrences that were not modified in this session anyway.

The XML ID attribute is used to merge disconnected occurrences with connected occurrences. Duplicate key checks are not done by reconnect. CRC checks are done for every merged occurrence.

Depending on the value of the XML status attribute, as set in $occstatus, Uniface modification flags are set or reset.

Effect of XML status Attribute on Uniface Modification Flags

$occstatus

$occmod

$storetype

$occdel

Description

""

1

1

0

Treated as a new occurrence

"new"

1

1

0

New occurrence

"est"

0

0

0

Existing unmodified occurrence

"mod"

1

0

0

Existing modified occurrence

"del"

X

X

1

Marked as deleted occurrence

The Uniface modification flags of all fields in an occurrence get the same modification state. All modified occurrences and fields are flagged for validation ($occvalidation, $fieldvalidation, and so on). These flags can be reset in Proc. $formmod and $instancemod are recalculated. If no occurrences or fields have set modification flags, $formmod and $instancemod are reset again. All modified occurrences are locked in the database if the locking type is cautious.

For more information, see Reconnect Process.

Reconnecting Read-Only Fields

Fields are marked as read-only if:

  • The field syntax definition specifies NED (no edit allowed)

  • The field syntax has been changed to NED at runtime by the fieldsyntax or $fieldsyntax Proc instructions.

When the /readcheck switch is used in a reconnect process, any modifications made by the user to a read-only field are ignored and the field value is restored from the database.

History

Version

Change

9.4.01

Introduced