From 92f84dc7c560614d0c71ab6236e14a03dd506469 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Fri, 17 Jan 2020 19:42:37 +0000 Subject: [PATCH] --- server/AyaNova/biz/ObjectFields.cs | 65 ++++++++++++++++++++++-------- 1 file changed, 49 insertions(+), 16 deletions(-) diff --git a/server/AyaNova/biz/ObjectFields.cs b/server/AyaNova/biz/ObjectFields.cs index 81071505..11b1982e 100644 --- a/server/AyaNova/biz/ObjectFields.cs +++ b/server/AyaNova/biz/ObjectFields.cs @@ -253,39 +253,72 @@ namespace AyaNova.Biz // - they could be a fragment with an alias i.e. sqlselectid="awidget.id as widgetid" //need a separate property for the id column name to fetch // for example: - /* Example of correct implementation - PropertyName="widgetname" (this is the unique key for this field and what the template and builders should be using) - ltkey="WidgetName" (this is not necessarily unique per list, for example it could be "active" or "notes" in the UI (in a report for example) more than once in cases ) - sqlidcolumn="widgetid" - sqldisplaycolumn="widgetname" - ayobjecttype=ayatype.widget + + /* WORKING OUT WHAT OBJECTFIELD REALLY SHOULD BE + + Select awidget.id, awidget.name, auser.name, auser.id, auseroptions.emailaddress +from awidget +left outer join auser on (awidget.userid=auser.id) +left outer join auseroptions on (auser.id=auseroptions.userid) +order by auseroptions.emailaddress desc + +There's actually no need for aliases. I'm fetching the values positionally and already know the columns that will be involved and the user will never see the aliases anyway so it's just fluff +Havev confirmed even without a join can still use the full tablename.columnname method for select statement so stick with that always + +It's alright to have all the info in one place here because whatever the client needs can be parsed out and send separately without the server needed stuff + +Nothing at the client yet is using any of this other than the custom fields formatter + +Here at the server some validators maybe are using it and the sql builders + +So rename things and see what breaks I guess + + Named AYFIELD? + + CLIENT ONLY USED + LtKey="WidgetName" (this is not necessarily unique per list, for example it could be "active" or "notes" in the UI (in a report for example) more than once in cases ) + AyaObjectType=ayatype.widget UiFieldDataType=AyaUiFieldDataType.Text - Hideable=false (this is required for the edit forms, not the list template because it will warn if no fields are visible and doesn't require any particular field to be visible, just one of them) + Hideable=false (this is required for the edit form customizations, not the list template because it will warn if no fields are visible and doesn't require any particular field to be visible, just one of them) + enumtype (required for client display) + + SERVER ONLY USED + sqlidcolumnName="awidget.id" + sqldisplaycolumnName="awidget.name" + + + BOTH + PropertyName (RENAME TO FieldName)="widgetname" (this is the unique key for this object and what the template and builders and client should be using) + Custom (RENAME it IsCustomField TODO: WHO NEEDS THIS? this is used by the form customization at the client end and for validation I think NEED TO CHECK) + filterable (RENAME to IsFilterable required for CLIENT UI datafilter builder and validation) + sortable (RENAME to IsSortable required for CLIENT UI datafilter builder and validation) + + + SharedLTKEY= (DEPRECATE, NO IDEA, NOT REALLY required, probably thought I needed it for localized text editing maybe?) - Custom (this is used by the form customization at the client end and maybe other shit, keep for now) - filterable (required for CLIENT UI datafilter builder) + */ - l.Add(new ObjectField { Key = "df", AyObjectType = (int)AyaType.Widget, SqlIdColumn="awidget.id as df" }); + l.Add(new ObjectField { Key = "df", AyObjectType = (int)AyaType.Widget, SqlIdColumn = "awidget.id as df" }); l.Add(new ObjectField { Key = "WidgetName", PropertyName = "widgetname", - UiFieldDataType = (int)AyaUiFieldDataType.Text, + UiFieldDataType = (int)AyaUiFieldDataType.Text, AyObjectType = (int)AyaType.Widget, SqlIdColumn = "awidget.id as widgetid", - SqlDisplayColumn="awidget.name as widgetname" + SqlDisplayColumn = "awidget.name as widgetname" }); l.Add(new ObjectField { Key = "User", PropertyName = "username", - UiFieldDataType = (int)AyaUiFieldDataType.Text, + UiFieldDataType = (int)AyaUiFieldDataType.Text, AyObjectType = (int)AyaType.User, SqlIdColumn = "userid", - SqlDisplayColumn="auser.name as username" - }); - l.Add(new ObjectField { Key = "UserEmailAddress", PropertyName = "emailaddress", UiFieldDataType = (int)AyaUiFieldDataType.EmailAddress}); + SqlDisplayColumn = "auser.name as username" + }); + l.Add(new ObjectField { Key = "UserEmailAddress", PropertyName = "emailaddress", UiFieldDataType = (int)AyaUiFieldDataType.EmailAddress }); break; #endregion