Refine the fields in the WebDrawer search form

Refining the list of fields

The standard search form in WebDrawer contains 3 lists each containing a list of search clauses and additional fields.  Maybe you only want a selection of your additional fields included in these lists?  This video shows one way to achieve this.

In short

In the video above I:

  1. edit the file Views\WDSearchClauseDefJS.cshtml, then

  2. in the FieldDefinition 'foreach' loop I edit the search clause to only return the field definitions I am interested in.

Refining Search Clauses

Search clauses are managed in the same CSHTML file (help\WDSearchClauseDefJS.cshtml). To refine the list of search clauses remove the IF clause from within the foreach and add a WHERE on the foreach.

bool start = true;
foreach (SearchClauseDef searchClause in searchClauses.Where(sc => !new SearchClauseIds[] { SearchClauseIds.RecordTitle,SearchClauseIds.RecordNumber }.Contains(sc.Id)))
     {           
          if (!start) {<text>,</text>}                                                   
<text>{</text><text>InternalName: "</text>@searchClause.InternalName<text>",</text>
<text>Name: "</text>@searchClause.Name<text>",</text>
        <text>MethodGroup: "</text>@searchClause.MethodGroup<text>",</text>
        <text>ObjectTypeParameter: "</text>@searchClause.ObjectTypeParameter<text>",</text>
        <text>ParameterFormat: "</text>@searchClause.ParameterFormat<text>",</text>
        <text>CanSort: </text>@searchClause.CanSort.ToJson()<text>,</text>
    <text>Caption: "</text>@searchClause.Caption.AsRaw()<text>"</text>
<text>}</text>
            start = false;
        }



Note for version 9.0 and later

In 9.0 the file WDSearchClauseDefJS.cshtml was moved to the 'Help' folder.  Unfortunately it is also installed in the 'Views' folder.  Ignore the file in the 'Views' folder and modify the one in the 'Help' folder.

Written on July 21, 2015