CutAttribute

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.

SalString CutAttribute( SalString sName, SalString sDefault )

The CutAttribute works in the same way as FindAttribute except that the attribute returned is also removed from the message.

Parameters

Name Description
SalString sName Name of the attribute to get value for. This name should always be in uppercase.
SalString sDefault Value to return in the case when the attribute does not exist in the message.
 

Returns

The return value is the value of the attribute, or sDefault if the attribute didn't exist in the message.

Comments

CutAttribute does not require the attribute to exist in the message. If the attribute does not exist, the specified default value is returned.

Example

public SalNumber PackMenuDefinition(SalString sMenuName)
{
	#region Local Variables
	SalNumber nItems = 0;
	SalNumber n = 0;
	SalArray<SalString> sRemovedItems = new SalArray<SalString>();
	SalString sPackedValue = "";
	#endregion
	
	#region Actions
	using (new SalContext(this))
	{
		nItems = Int.PalArrayCount(_sDisplayMenuItems);
		while (n < nItems) 
		{
			if (!(Sal.ListQueryState(lbMenuDefinitions, n))) 
			{
				sRemovedItems[Int.PalArrayCount(sRemovedItems)] = _sDisplayMenuItems[n];
			}
			n = n + 1;
		}
		MenuItemsRemoved.CutAttribute(sMenuName, Const.strNULL);
		sPackedValue = Int.PalArrayToString(sRemovedItems, ",");
		// Create a new one (if there's is any items to remove)
		if (sPackedValue != Const.strNULL) 
		{
			MenuItemsRemoved.AddAttributeRaw(sMenuName, sPackedValue);
		}
		Sal.SendMsg(this, Const.AM_MethodStateChanged, 0, 0);
	}
	return 0;
	#endregion
}