assigning value(s) to enumerated attribute

I am trying to use dxl to modify object attributes. All is fine for text type attribute but I can not find the syntax for assigning enumeration type attribute. Can someone point me to place when I can find such information or simply write short sample for me. Say, I have attribute name Owner, with possible values being Mark, John, Tom. And I want my script to assign the value of Mark and Tom.

Thanks for help.

Tony
Tony_Aus - Fri Oct 23 00:01:48 EDT 2009

Re: assigning value(s) to enumerated attribute
Peter_Albert - Fri Oct 23 03:43:44 EDT 2009

From your question I am guessing that you are talking about multi-value enumerated attributes.

From the DXL Help:

Multi-value enumerated attributes
This section defines functions that apply to multi-value enumerated attributes.

Assignment (enumerated option)
The assignment operators += and -= can be used as shown in the following syntax:

attrRef += string s
attrRef -= string s
So in your case the DXL snippet is
 

Object obj = current Object
obj."Owner" += "Mark"
obj."Owner" += "Tom"

 


The syntax for checking whether Mark is an owner is

 

if (isMember(obj."Owner", "Mark")){print "Mark is an owner\n"}

 


Regards,

Peter

 

Re: assigning value(s) to enumerated attribute
sarfrazm - Fri Feb 12 13:26:00 EST 2010

Peter_Albert - Fri Oct 23 03:43:44 EDT 2009

From your question I am guessing that you are talking about multi-value enumerated attributes.

From the DXL Help:

Multi-value enumerated attributes
This section defines functions that apply to multi-value enumerated attributes.

Assignment (enumerated option)
The assignment operators += and -= can be used as shown in the following syntax:

attrRef += string s
attrRef -= string s
So in your case the DXL snippet is
 

Object obj = current Object
obj."Owner" += "Mark"
obj."Owner" += "Tom"

 


The syntax for checking whether Mark is an owner is

 

if (isMember(obj."Owner", "Mark")){print "Mark is an owner\n"}

 


Regards,

Peter

 

Does anyone know if a function exists similar to "isMember" in DXL for enumerated attributes which are not multi-valued? I need a bool which does the same job but my attribute is not multi-valued so using the "isMember" function gives error. A quick response will be highly appreciated. Thanks.

sarfrazm

Re: assigning value(s) to enumerated attribute
SystemAdmin - Fri Feb 12 15:14:45 EST 2010

sarfrazm - Fri Feb 12 13:26:00 EST 2010
Does anyone know if a function exists similar to "isMember" in DXL for enumerated attributes which are not multi-valued? I need a bool which does the same job but my attribute is not multi-valued so using the "isMember" function gives error. A quick response will be highly appreciated. Thanks.

sarfrazm

For normal enumerations the comparison would be same as for a text type attribute:
 

if (o."Attribute Name" "" == "Enumeration Value")
  {
   // do stuff
  }

Re: assigning value(s) to enumerated attribute
sarfrazm - Tue Feb 16 09:37:44 EST 2010

SystemAdmin - Fri Feb 12 15:14:45 EST 2010

For normal enumerations the comparison would be same as for a text type attribute:
 

if (o."Attribute Name" "" == "Enumeration Value")
  {
   // do stuff
  }

Thanks Pekka for your help. I appreciate it. I tried your suggestion, but I do not know why I was getting syntax errors so I tried the following function:

if(probeAttr_(object,"Attribute Name") != "Enumeration Name")
{
// body of if statement
}

This works for me. And I got the idea from your suggestion. Thanks for solving my problem!

sarfrazm

Re: assigning value(s) to enumerated attribute
davecolorado - Thu Apr 28 11:08:16 EDT 2011

sarfrazm - Tue Feb 16 09:37:44 EST 2010
Thanks Pekka for your help. I appreciate it. I tried your suggestion, but I do not know why I was getting syntax errors so I tried the following function:

if(probeAttr_(object,"Attribute Name") != "Enumeration Name")
{
// body of if statement
}

This works for me. And I got the idea from your suggestion. Thanks for solving my problem!

sarfrazm

Interesting/helpful thread. Is there any way to programmatically access the single enum and multi-enum's "related numbers"?

I'd like to develop a layout DXL that compares the related numbers of the object's selected enum values and compare them against another single-select enum's related value for the same object, display text such as "Valid" or "Not valid".

Example:
"MasterEnum" is a single select enum (Values=Red/Blue/Yellow/Orange (related values 1/2/3/4 respectively)
"SecondaryEnum" is a multi-select enum with 15 possible values "A", "B", etc with related 1-15 respectively.

My layout column should indicate the following:
SecondaryEnum MasterEnum Display (Reason)
A,C Orange "Valid" Both 1 and 3 (A/C resp values) < 4 (Orange)
A,C,F Orange "Invalid" 6 (F) not < 4 (Orange)
<null> Red "Valid" no value for null string < 1 (Red)