This commit is contained in:
2020-03-13 21:48:25 +00:00
parent 73ccf1c359
commit 84dbf06991
2 changed files with 22 additions and 12 deletions

View File

@@ -5,6 +5,15 @@
## IMMEDIATE ITEMS
//PICKLISTS:
//TODO: build a sql List<AyaPickListFieldDefinition> columnDefinitionsselect and order by and a where clause that searches appropriately in each field (tags)
//it should return results based on the query where there is a single name (display) column and an id column for rowid
//and the fields should be combined in a standard way separated by spaces "Widget widgetserial username" for compactness
//WORKING QUERY
//select awidget.id AS rowid,awidget.active,awidget.name,awidget.serial,auser.name from awidget left outer join auser on (awidget.userid=auser.id)
//where awidget.active = true and ((awidget.name like '%some%') or (cast (awidget.serial as text) like '%some%') or (auser.name like '%some%') ) order by awidget.name,awidget.serial,auser.name limit 100
TODO: BizRoles.cs seems to get hammered on every single request, is it efficient?
- Why is it not cached in some way?

View File

@@ -18,18 +18,9 @@ namespace AyaNova.PickList
internal static string Build(IAyaPickList pickList, List<string> templateColumnNames, string autoCompleteQuery, bool IncludeInactive)
{
//TODO: if no autocompletequery returns the first XX results without querying in natural order by column names
//if autocomplete returns teh first XX results with query in natural order by column names
//TODO: build a sql List<AyaPickListFieldDefinition> columnDefinitionsselect and order by and a where clause that searches appropriately in each field (tags)
//it should return results based on the query where there is a single name (display) column and an id column for rowid
//and the fields should be combined in a standard way separated by spaces "Widget widgetserial username" for compactness
//WORKING QUERY
//select awidget.id AS rowid,awidget.active,awidget.name,awidget.serial,auser.name from awidget left outer join auser on (awidget.userid=auser.id)
//where awidget.active = true and ((awidget.name like '%some%') or (cast (awidget.serial as text) like '%some%') or (auser.name like '%some%') ) order by awidget.name,awidget.serial,auser.name limit 100
//TODO: TAGS
//TODO: custom template routes and tests
//TODO: TESTS FOR ALL FORMS OF QUERY (tags, non text fields etc)
//TODO: Clean out unnneeded stuff in AyaPickListFieldDefinition (stuff from datalist copied over)
//determine this in advance as it will be used in a loop later
@@ -86,6 +77,16 @@ namespace AyaNova.PickList
//Tag?
if (o.ColumnDataType == UiFieldDataType.Tags)
{
//awidget.tags @> array['blah','blah3'::varchar(255)]
//or in real life: ((awidget.name like '%o34%') or (awidget.tags @> array['zone-0'::varchar(255)]) )
//but this means exact match only, not like comparison here
//This also works: ((awidget.name like '%o34%') or ('blue' like any(awidget.tags)) )
//but again, not a like query only exact match
//THIS is the one:
//(array_to_string(awidget.tags,',') like '%zo%')
sWhere = $"(array_to_string({valueColumnName},',') like '%{autoCompleteQuery}%')";
}
else if (o.ColumnDataType == UiFieldDataType.Text || o.ColumnDataType == UiFieldDataType.EmailAddress || o.ColumnDataType == UiFieldDataType.HTTP)