cancel
Showing results for 
Search instead for 
Did you mean: 

How to check if a value exist in a "Simple Type Enumeration"

Former Member
0 Kudos

I've created a Simple Type Enumeration (in the Local Dictionary) with these values :

RED

BLUE

GREEN

How do we verifiy if a string exist in this enumeration?

By example :

- check for the string "RED" --> true

- check for the string "YELLOW" --> false

Thanks!

Message was edited by:

Emanuel Champagne

Accepted Solutions (1)

Accepted Solutions (1)

former_member182294
Active Contributor
0 Kudos

Hi,

Here is the code:

	IWDAttributeInfo attribInf = wdContext.getNodeInfo().getAttribute("Color");
	ISimpleType simpleType = attribInf.getSimpleType();
	Set set = simpleType.getEnumeration();
	String color = "RED";
	if(set != null)
	{
		if(set.contains(color))
		{
                    wdComponentAPI.getMessageManager().reportSuccess("Color "+color+" is true");
		}
        }

Regards

Abhilash

Former Member
0 Kudos

Thanks!

Answers (0)