If someone could point me in the right direction I would be really grateful.
As the subject suggests I am currently building a CRM List Object within an ASP page which does not reference Metadata. The list itself is working and returning the data as expected
var listObject = CRM.GetBlock("List");
listObject.SelectSql = "select *, datediff(day,Lead_CreatedDate,getdate()) as lead_v_age from vSummaryLead";
var lead_v_age = listObject.AddGridCol("lead_v_age",-1,true);
However, as you can see from the above the SQL statement returns a derived field (lead_v_age) which is being added to the list. Being a derived field it has no metadata within CRM so there is no translation and is not user friendly within the UI.
Looking at http://help.sagecrm.com/on_premise/en/2017R2/dev/Content/Developer/ASP%20Object%20Reference/CRMGridColBlock%20Object/AS_CRMGridColBlockObject.htm there are a number of properties available regarding the list columns:
Alignment. Sets the alignment of text within the column.
AllowOrderBy. Sorts entries in the list by the values in the column.
CustomActionFile. Hyperlinks a column to an ASP file.
CustomIdField. Allows a value to be passed to the custom file when the corresponding column is selected.
JumpEntity. Adds a hyperlink that opens the summary screen of an entity record.
ShowHeading. Shows or hides the column heading.
ShowSelectAsGif. Shows the values in the column as GIF image
The issue which I am having is that this does not cover all of the options which are available to list column, specifically:
Order By Desc
Default Order By
Caption (which I am trying to set via CreateScript)
Taking an educated guess and trying the following results in an error
lead_v_age.DefaultOrderBy = true
lead_v_age.OrderByDesc = true
Whilst the following appears to do nothing
lead_v_age.CreateScript = "Caption = 'Record Age'"
In summary for the derived field the caption, order by desc and default order by need to be set. In addition all fields must be sortable although and this is the last field in the list so does not get sorted by default.