SetAttribute

Note: This page includes content based on the F1 documentation for Centura development. It may be partially converted to support APF development, but should be regarded to be of uncertain actuality. It is provided as is. Eventually, it should be replaced by documentation available from within Visual Studio.

SalNumber SetAttribute( SalString sName, SalString sValue )

The SetAttribute method sets the value of an existing or new attribute in the message.

Parameters

Name Description
SalString sName Name of the attribute to set value for. This name should always be in uppercase.
SalString sValue Value for attribute.

Returns

The return value is the attribute number of the attribute whose value was set.

Comments

If the attribute already exists in the message, SetAttribute updates the attributes value. If the attribute does not exist, it is added and the value set.

It is not possible to add multiple attributes with the same name using the SetValue methods. To do so applications should use the AddAttribute method.

Example

public SalNumber CreateTableFromEditLayout(SalString sLayout)
{
	#region Local Variables
	cMessage Layout = new cMessage();
	SalArray<SalString> sAttributes = new SalArray<SalString>();
	SalArray<SalString> sValues = new SalArray<SalString>();
	SalNumber nEnties = 0;
	SalNumber nCount = 0;
	#endregion
	
	#region Actions
	using (new SalContext(this))
	{
		Sal.TblReset(i_hWndSelf);
		Layout.Unpack(sLayout);
		nEnties = Layout.EnumAttributes(sAttributes, sValues);
		// Create a default layout to always hold all attributes.
		CreateDefaultEditLayout(Layout);
		// Override default values with real ones.
		nCount = 0;
		while (nEnties > nCount) 
		{
			Layout.SetAttribute(sAttributes[nCount], sValues[nCount]);
			nCount = nCount + 1;
		}
	.............