AssignHeader (FPScript)

21.09.2021

Assigns header information to a value.

Syntax

AssignHeader(Value, [ DataObject ] [ , ElementNames ])

 

The syntax of the AssignHeader function consists of the following parts:

Part

Description

Value

The value to which the header information is assigned.

All data structures are allowed. All data types are permitted.

DataObject

A reference to a data object whose header information is to be assigned, or a value with appended header information that is to be assigned. If you omit the argument, header information is created and assigned that does not linked to a data object. If you pass as the DataObject argument a link to the formula in which you call the AssignHeader function, the settings on the "Results" tab of this formula are taken into account.

All data structures are allowed. All data types and also object references are permitted.

ElementNames

A list whose element names are to be used to form the element names of the result. This argument is only used if as the DataObject argument you have specified a link to the formula in which you call the AssignHeader function and the value of its "List Element Names" property is "Automatic". AssignHeader then assigns the names to the elements in the result list. These names are formed from the element names of the passed list and settings on the "Result" tab of the formula. The use of AssignHeader with this argument is obsolete. Use the local variable SourceData as shown under Examples instead.

All data structures are allowed. All data types and also object references are permitted.

Remarks

The result is the passed value to which the header information was passed or from which it was removed. If Value is a list, then the header information is assigned to each element of the list. If a list element is named, a separate copy of the header information is added for this element and the list element name is entered as the "Name" attribute.

Available in

FlexPro View, Basic, Professional, Developer Suite

Examples

Result = AssignHeader(Result, This)

Assigns the header information of the formula with the FPScript code to the value "Result".

Result = AssignHeader(Result, Formula As Object)

Assigns the header information of the formula to the value "Result".

Result = AssignHeader(Result, Formula)

Assigns the header information, which is appended to the result of the "Formula” formula, to the value "Result".

Result = AssignHeader(Result, $"\Data\Channel1"$)

Assigns the header information of the data set with the path name specified in the string to the value "Result".

Result = AssignHeader(Integral(Data))
Result.Name = "Integral"

Assigns the header information that is not linked to a data object to the value "Result" and then assigns a name.

Dim Data = [Signal1, Signal2]
Dim Result = AssignHeader(Integral(Data), This, Data)

Calculates the integral of two data sets and returns the result as a list. A separate copy of the header information of the formula containing the FPScript code is assigned to each element in the list. If the "Automatic" option is selected on the "Result" tab of the formula under "List Element Names" and "(Automatic)" is set as the Template, the "Name" attribute is then set to "Signal1Integral" or "Signal2Integral". This means that the expression Result.[0].Name would return "Signal1Integral", for instance.

Dim SourceData = [Signal1, Signal2]
Integral(SourceData)
 

This code is the equivalent of the previous example without the AssignHeader function. If you assign the source data to the local variable SourceData, after the calculation FlexPro can access the element names of the source data and automatically assign the header information.

See Also

RemoveHeader Function

Header Information

As Object Keyword

Share article or send as email:

You might be interested in these articles