Hello all,
I am wondering how can I get the Data Type (string, decimal, int ...) of a field. I have a method like below and I need to know what is the Data Type of the “Field”
public static void MyMethod<Field>(PXCache cache) where Field : IBqlField
{
string fieldName = cache?.GetField(typeof(Field)); // This gets me the name correctly
// I tried all below and they are returning null
var aa = cache?.GetType()?.GetField(fieldName)?.FieldType;
var bb = cache?.GetType()?.GetProperty(fieldName)?.PropertyType?.GetField(fieldName)?.FieldType;
var cc = cache?.GetItemType()?.GetField(fieldName)?.FieldType;
var dd = cache?.GetItemType()?.GetProperty(fieldName)?.PropertyType?.GetField(fieldName)?.FieldType;
// Rest of my code
}