Anyone know how to determine a field is of type Types::Time?
I have a database field of type Time witch has an EDT "timeOfDay"
When i try to check for the datatype of the field (actualy a variable af
anytype that represends the data from the field) it returns int as the type.
I want to know when the type is either Types::Time or the base EDT of the
EDT is "timeOfDay"
The complete function:
static str getFieldDataString(Common common,SGCKeyWord sgcKeyWord)
{
Name name = sgcKeyWord.Name;
anytype data = common.(sgcKeyWord.Field);
str value;
BinData binData;
Types type = typeof(data);
;
//transfer generic data to string value
switch( type )
{
case Types::Container://containers are transferred to a base64 string
binData = new BinData();
binData.setData(data);
value = binData.base64Encode();
break;
case types::Enum:
value = enum2str( data );
break;
case types::UtcDateTime:
value = DateTimeUtil::toStr( data );
break;
case types::Time:
value = time2str( data, 0, 0);
break;
default:
value = String::replaceXmlChars(data);
break;
}
return value;
}
the tricky part:
case types::Time:
value = time2str( data, 0, 0);
break;
this is bit tricky, try below job, may be this helps you.
static void Job1(Args _args)
{
// Edt TimeHour24 extends with timeOfDay
SysDictField obj1 = new
SysDictField(tablenum(Table1),fieldNum(Table1,TimeHour24));
SysDictType obj2 = new SysDictType(obj1.typeId());
print obj1.typeId();// its give EDT it
print obj2.isTime(); // its give you true
pause;
}
Thanks
Amir
http://msdax.wordpress.com/
m.ami...@gmail.com
This definitely helped me.
I find it odd that the basetype is not of Types::Time.
In morphx at the property window it is defined as being of type Time...
Why is the enum value even there to choose from?
Anyway this workaround is perfect,thanx a lot!
greetings Richard