Hi All
Actually i have a problem,
i created a field in PurchTable name TDSPercent of enum type and i define that like name- one_percent, two_percent…ten_percent
ok and l define label like 1%, 2%…10% and enum value like 1,2,3…10 respectively now i want to use enum value
so that i can use them and i can calculate TDS on the Line amount… Right now i am not able to calculate TDS Percent
because i cant use enum Label or Enum Name…
Please Help Me as early as possible because i always got the solutions
Regards
Taukeer
If you ask me, enum doesn’t sound like a wise choice to me. If you’ll want to add or remove a value, you’ll have to get a developer to change code and deploy it to test and production etc. A table where you can configure what you need (and where you have an integer field directly usable in calculations) would have many advantages.
Nevertheless if you want to use an enum, you can. If you trust that the value is always equal to the number of percent, you can use the value directly in calculations. Check out this example:
int x = MonthsOfYear::April * 10;
It’s because the underlying type of any enum is int. If you want, you can explicitly cast the enum value to int.
Also note that the default value of any enum field is 0, which isn’t a valid of your enum. You should either have an element for value = 0 (recommended), or to explicitly set all fields to a valid value for the type.
Thanks sir
for giving me the valuable suggestion , actually i got the solution i can use the enum value directly which is working after testing.