This commit is contained in:
@@ -53,6 +53,9 @@ namespace AyaNova.DataList
|
||||
[JsonIgnore]
|
||||
public string SqlColorColumnName { get; set; }//column to fetch the color if applicable to this field
|
||||
|
||||
[JsonIgnore]
|
||||
public string SqlColumnExpression { get; set; }//column is based on this expression, not directly on the source tables
|
||||
|
||||
public DataListFieldDefinition()
|
||||
{
|
||||
//most common defaults
|
||||
@@ -65,6 +68,7 @@ namespace AyaNova.DataList
|
||||
AType = (int)AyaType.NoType;
|
||||
SqlATypeColumnName = null;//must be null as that is checked against specifically
|
||||
SqlColorColumnName = null;//must be null to be ignored properly
|
||||
SqlColumnExpression = null;
|
||||
}
|
||||
|
||||
//Get column to query for display name or use FieldName if there is no difference
|
||||
|
||||
@@ -58,7 +58,11 @@ namespace AyaNova.DataList
|
||||
{
|
||||
if (firstColumnAdded)
|
||||
sb.Append(", ");
|
||||
sb.Append(valueColumnName);
|
||||
|
||||
if (o.SqlColumnExpression != null)//if there is an expression defined then add it into the select statement, the valuecolumnname will be the AS alias of it
|
||||
sb.Append(o.SqlColumnExpression);
|
||||
else
|
||||
sb.Append(valueColumnName);
|
||||
firstColumnAdded = true;
|
||||
map.Add(valueColumnName, nOrdinal++);
|
||||
}
|
||||
|
||||
@@ -11,7 +11,6 @@ namespace AyaNova.DataList
|
||||
{
|
||||
DefaultListAType = AyaType.WorkOrder;
|
||||
SQLFrom = "from aworkorder "
|
||||
// + "left join lateral (select id, workorderstatusid, workorderid from aworkorderstate st where workorderid = aworkorder.id order by st.id DESC limit 1) st on aworkorder.id=st.workorderid "
|
||||
+ "left join aworkorderstatus on (aworkorder.laststatusid = aworkorderstatus.id) "
|
||||
+ "left join acustomer on (aworkorder.customerid=acustomer.id) "
|
||||
+ "left join aheadoffice on (acustomer.headofficeid=aheadoffice.id) "
|
||||
@@ -19,7 +18,7 @@ namespace AyaNova.DataList
|
||||
+ "left join acontract on (aworkorder.contractid=acontract.id)";
|
||||
var RoleSet = BizRoles.GetRoleSet(DefaultListAType);
|
||||
AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change;
|
||||
DefaultColumns = new List<string>() { "WorkOrderSerialNumber", "Customer", "WorkOrderServiceDate", "WorkOrderCloseByDate", "WorkOrderStatus", "Project" };
|
||||
DefaultColumns = new List<string>() { "WorkOrderSerialNumber", "Customer", "WorkOrderServiceDate", "WorkOrderCloseByDate", "WorkOrderStatus", "Project", "WorkOrderAge" };
|
||||
DefaultSortBy = new Dictionary<string, string>() { { "WorkOrderSerialNumber", "-" } };
|
||||
FieldDefinitions = new List<DataListFieldDefinition>();
|
||||
|
||||
@@ -247,6 +246,15 @@ namespace AyaNova.DataList
|
||||
SqlValueColumnName = "aworkorder.longitude"
|
||||
});
|
||||
|
||||
FieldDefinitions.Add(new DataListFieldDefinition
|
||||
{
|
||||
TKey = "WorkOrderAge",
|
||||
FieldKey = "WorkOrderAge",
|
||||
UiFieldDataType = (int)UiFieldDataType.TimeSpan,
|
||||
SqlColumnExpression="AGE(timezone('UTC', now()), aworkorder.createddate) as expwoage",
|
||||
SqlValueColumnName = "expwoage"
|
||||
});
|
||||
|
||||
|
||||
/*
|
||||
|
||||
|
||||
Reference in New Issue
Block a user