# UEnum : how to query the FString value at index?

**URL:** <https://forums.unrealengine.com/t/uenum-how-to-query-the-fstring-value-at-index/316937>\
**Category:** Programming & Scripting\
**Tags:** unreal-engine\
**Created:** [April 30, 2015, 4:22am UTC](https://forums.unrealengine.com/t/uenum-how-to-query-the-fstring-value-at-index/316937 "2015-04-30T04:22:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![DanaFo](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@DanaFo](https://forums.unrealengine.com/u/DanaFo)\
**Post date:** [April 30, 2015, 4:22am UTC](https://forums.unrealengine.com/t/uenum-how-to-query-the-fstring-value-at-index/316937/1 "2015-04-30T04:22:00Z")

</div>

Hi,  
I’m currently learning how to use UEnum and so I followed Rama’s example:

```
UENUM(BlueprintType) //"BlueprintType" is essential to include
enum class EVictoryEnum : uint8
{
        VE_Dance UMETA(DisplayName="Dance"),
        VE_Rain UMETA(DisplayName="Rain"),
	VE_Song	UMETA(DisplayName="Song")
};
 
UCLASS()
class YourClass : public YourSuperClass
{
	GENERATED_UCLASS_BODY()
 
	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=Enum)
	EVictoryEnum VictoryEnum;
 
	//Rest of Class Code
};

```

I’m currently investigating how I would get the FString at index[i] and again using Rama’s example:

```
FString GetVictoryEnumAsString(EVictoryEnum::Type EnumValue)
{
  const UEnum* EnumPtr = FindObject<UEnum>(ANY_PACKAGE, TEXT("EVictoryEnum"), true);
  if(!EnumPtr) return FString("Invalid");
 
  return EnumPtr->GetEnumName(EnumValue); // for EnumValue == VE_Dance returns "VE_Dance"
}

```

I assumed the EVictoryEnum::Type EnumValue was where I would pass in a uint8 to check the index, but my compiler won’t have any of it, saying that **‘EVictoryEnum’ has no member type ‘EnumValue’** which I understand, but why is the example written this way?? Is there something interesting going on in the method definition in the .h file I’m missing?

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_957a4452](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_957a4452](https://forums.unrealengine.com/u/anonymous_user_957a4452)\
**Post date:** [April 30, 2015, 10:45am UTC](https://forums.unrealengine.com/t/uenum-how-to-query-the-fstring-value-at-index/316937/2 "2015-04-30T10:45:23Z")

</div>

Hello,

From the way method is declared, I assume it is supposed to be used with old enums. For example, the old-style declaration for described enum would look like this:

```
UENUM(BlueprintType)
namespace EVictoryEnum 
{
	enum Type 
	{
		VE_Dance UMETA(DisplayName = "Dance"),
		VE_Rain UMETA(DisplayName = "Rain"),
		VE_Song UMETA(DisplayName = "Song")
	};
}

```

In the declaration you would need to use TEnumAsByte:

```
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Enum)
TEnumAsByte<EVictoryEnum::Type> VictoryEnum;

```

However, to get the method work with the new-style enum that is provided in the tutorial, you can replace EVictoryEnum::Type EnumValue in the argument list with uint8 EnumValue:

```
FString GetVictoryEnumAsString(uint8 EnumValue)

```

If you like to learn more about enums in Unreal Engine 4, please go here:

> **[Coding Standard](https://docs.unrealengine.com/5.1/en-US/epic-cplusplus-coding-standard-for-unreal-engine/)**
>
> Write maintainable code by adhering to established standards and best practices.

Hope this helped!  
Cheers!

---

<div class="post-metadata">

**Author:** ![DanaFo](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@DanaFo](https://forums.unrealengine.com/u/DanaFo)\
**Post date:** [April 30, 2015, 2:23pm UTC](https://forums.unrealengine.com/t/uenum-how-to-query-the-fstring-value-at-index/316937/3 "2015-04-30T14:23:26Z")

</div>

Ahhh I am going to try this, but that makes sense. I had a feeling it may have been for an older style enum. Thanks for the info and the doc link!

---

<div class="post-metadata">

**Author:** ![DanaFo](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@DanaFo](https://forums.unrealengine.com/u/DanaFo)\
**Post date:** [May 27, 2015, 1:32am UTC](https://forums.unrealengine.com/t/uenum-how-to-query-the-fstring-value-at-index/316937/4 "2015-05-27T01:32:54Z")

</div>

@.Bulgakov : I tried this implementation, so in blah.h I have:

```
    //header stuff
    UENUM( )
    enum class ETaxiMoveModeEnum : uint8
    {
    	TX_PerchedIdle UMETA( DisplayName = 'Perched - Idle' ) ,
    	TX_Flapping UMETA( DisplayName = 'Flapping' ) ,
    	TX_Diving UMETA( DisplayName = 'Diving' ) ,
    	TX_Gliding UMETA( DisplayName = 'Gliding' )
    };
    //...
    UCLASS(Blueprintable)
    class AtwinStickPawn : public APawn
    {
    	GENERATED_BODY()
    
    	UPROPERTY()
    	ETaxiMoveModeEnum ETaxiMovementModeObj; 
    //... etc etc

and then in the blah.cpp I am trying to access the enum values via:
AtwinStickPawn::AtwinStickPawn(const FObjectInitializer& ObjectInitializer)
	: Super(ObjectInitializer)
{ 
//...
ETaxiMoveModeObj::TX_Flapping 

```

but I get an error saying:  
ETaxiMoveModeObj is not a namespace or class. Which I guess is pretty obvious looking at it. So just how am I to access this enum data?
