@WITHATTR

Returns all base members that are associated with an attribute or varying attribute that satisfies the conditions you specify. You can use operators such as >, <, =, and IN to specify conditions that must be met. @WITHATTR can be used as a parameter of another function, where that parameter is a list of members.

Syntax

@WITHATTR (dimName, "operator", value)
ParameterDescription

dimName

Single attribute dimension name or varying attribute dimension name.

operator

Operator specification, which must be enclosed in quotation marks ("").

value

A value that, in combination with the operator, defines the condition that must be met. The value can be an attribute member specification, a constant, or a date-format function (that is, @TODATE).

Notes

Example

The following table shows examples, based on the Sample Basic database, for each type of operator:

OperatorExampleResult
>@WITHATTR(Population,">","18000000")Returns New York, California, and Texas
>=@WITHATTR(Population,">=",10000000) where 10,000,000 is not a numeric attribute member, but a constantReturns New York, Florida, California, Texas, Illinois, and Ohio
<@WITHATTR(Ounces,"<","16")Returns Cola, Diet Cola, Old Fashioned, Sasparilla, and Diet Cream
<=@WITHATTR("Intro Date","<=",@TODATE("mm-dd-yyyy", "04-01-2002"))Returns Cola, Diet Cola, Caffeine Free Cola, and Old Fashioned
= =@WITHATTR("Pkg Type","= =",Can)Returns Cola, Diet Cola, and Diet Cream
<> or !=@WITHATTR(Caffeinated,"<>",True)Returns Caffeine Free Cola, Sasparilla, Birch Beer, Grape, Orange Strawberry
IN@WITHATTR("Population","IN",Medium)Returns Massachusetts, Florida, Illinois, and Ohio

The following two examples show @WITHATTR used in a calculation script, based on the Sample Basic database:

/* To increase by 10% the price of products that are greater than
or equal to 20 ounces */


FIX (@WITHATTR(Ounces,">=","20"))
Price = Price * 1.1;
ENDFIX
/* To increase by 10% the marketing budget for products brought
to market after a certain date */


FIX (@WITHATTR("Intro Date",">",
@TODATE("mm-dd-yyyy","06-26-1996")));
Marketing = Marketing * 1.1;
ENDFIX

See Also