DataBasic Reference > MultiValue Compatibility > Statements and Intrinsic Functions > TRANS Function

Comment on this topic

Documentation Comments

Use this form to comment on this topic. You can also provide any general observations about the Online Documentation, or request that additional information be added in a future release.

Reality V15.0 ()

TRANS Function (DataBasic MultiValue Compatibility) (m6187ai+trans_f.htm)

To

Reality

Version

Topic

Submitted by

Company

Location

Email address

Comment

 

 

TRANS Function

Extracts data from a file.

This function is provided for compatibility with other MultiValue systems.

Syntax

TRANS({DICT }fileSpec, itemId, attrNo{, actionCode})

XLATE({DICT }fileSpec, itemId, attrNo{, actionCode})

Syntax Elements

DICT Specifies that the dictionary of the specified file should be used instead of the data section. This keyword can also be in lower case (dict).

fileSpec The name of file from which to extract the data, in the following format:

{/account/}filename{,data-section-name}

If both DICT and data-section-name are specified, data-section-name is ignored.

itemId The item-Id of the required source file item.

attrNo The number of the required attribute in the specified item.

actionCode An expression that evaluates to the following:

errorOp{[valueNo||:delimiter]}

errorOp The action to take if the specified item does not exist or the specified attribute is null. One of the following:

CReturn itemId.

VDisplay an error message and return null.

XReturn null.

valueNo One of the following:

  • A value number: TRANS or XLATE returns that value from the specified attribute; if omitted, the complete attribute is returned.
  • An asterisk (*): return the first value.

:delimiterUse delimiter to separate values and subvalues. If delimiter contains more than one character, only the first is used.

If actionCode is null the default is "X".

Return Value

The extracted data.

Comments

TRANS and XLATE return the same value as:

OCONV(itemId,"T{DICT }fileSpec;actionCode;;attrNo;")

See Also

OCONV function, Tfile conversion code.

Example

Assuming that the file TRANS.DATA contains the following item:

    TRANS.ITEM
001 A
002 BAVMBBVMBC
003 CAVMCBASVMCBBSVMCBCVMCC

The following sets the variable ITEM to "BAVMBBVMBC":

ITEM = TRANS("TRANS.DATA", "TRANS.ITEM", 2)

and the following sets ITEM to the item-id, "TRANS.ITEM":

ITEM = TRANS("TRANS.DATA", "TRANS.ITEM", 4, "C")

RealityV15.0Comment on this topic