PLEASE NOTE: This Tech Tip applies to 4D Web 2.0 Pack version 1.2
If you are comfortable with XML, 4D Ajax Framework 1.2 now allows you to create your own Query Templates. Query Templates are stored in the folder "\Extras\Support\Query Templates", and each template is an XML file. You can create or edit these files to create templates of your own. Here is a quick overview of the XML definition:
Each query is defined within a element. The element must always have 5 attributes:
- name – this is the name that is displayed on the tab that is created by the query
- sortfield – this is a place holder that should always be empty ””
- sortorder – this is a place holder that should always be “Asc”
- tableid – this is a place holder that should always be empty ””
- maxnb – this is a place holder that should always be ”-1”
Each condition is defined within a element. The element must have 5 attributes:
- condition – this is the value to query for
- field – this is a place holder that should always be empty ””
- link – this must always be either “And” or “Or” and determines how multiple querylines are evaluated together
- operator – this must be a textual representation of the operator to use for this condition. Valid operators are:
- “equal”
- “notequal”
- “less”
- “greater”
- “lesseq”
- “greatereq”
- “ends with”
- “starts with”
- method – this must always be either “True” or “False” and determines if the condition should be treated as a condition to query on or as a method to be executed which will return the condition to query on.
It is recommended to review the included query template files in "\Extras\Support\Query Templates" to see examples of this structure in action.
For the latest information the 4D Ajax Framework please see the Daxipedia:
http://daxipedia.4d.com