MyApps View (1)

Source: Internet
Author: User

First, view type classification

Views are divided into five categories: normal, tree view, Calendar view, geographic view, Gantt view.

1. Normal view: General view configuration, can be generated directly by one-click generation of views

2. Tree view: Displays the contents of the form in a tree structure, the hierarchical relationships in the fields are defined by the mapping field settings in the View column, and the open type of the node can be displayed as either "View" or "link" or "Tree view".

Second, view filter conditions

1. View data Source: The data configuration interface in the view can configure the data source of the view, respectively, by design, code (DQL), code (SQL) to filter the View column conditions.

2. Example

In the following example we assume that there is a table in the database with the table named: Tlk_fm_student, which contains the field name, age.

1) DQL statement

Gets the value of the field name and age in the form, and displays the data that is queried for the corresponding content when the value of name and time and the value in Tlk_fm_student

var val = getitemvalue ("name");

var val2 = GetItemValue ("Age");

var where = (val! = null && Val.trim (). Length () > 0)? " and name = "+ val +" ":" "; Stitching query Conditions

where + = (Val2 = null && Val2.trim (). Length () > 0)? " and age= "+ Val2 +" ":";

"$formname = ' tlk_fm_student '" + where; Execute Query

2) SQL statements

Gets the value of the query form name, when the value of name in the query form equals the value of "name" in "Tlk_fm_student", and displays the data table as the corresponding content of "name" in the query form;

Note: When the field in the database does not start with "item_", then this field must take an alias that begins with "item_", otherwise the value of the data item processed by the query cannot be obtained

var sql = "";

var val = getitemvalue ("name");

if (val! = null && Val.trim (). Length () > 0) {

sql = "and item_name =" + ' "+val+";

}

"SELECT * from tlk_fm_student where istmp = 0" + SQL;

Query map form data, SQL implementation query map form tb_mapping name and Title field contents

var sql = "Select d.*, M.name, m.title from T_document D";

SQL + = "INNER join tb_mapping m on d.mappingid = M.keyname";

sql

3) Multi-table query, displaying data from multiple tables

/* The content of multiple data tables (multi-table queries) is implemented by filtering in code (SQL), there are two tables: Tlk_fm_student, Tlk_fm_school, two tables are associated by primary foreign key

var sql= "Select D.*,sub.item_finished,sub.item_date from Tlk_fm_student d";

SQL + = "INNER Join Tlk_fm_task_school sub on D.id=sub.parent";

sql

4) query to-dos data

DQL Way:

var dql = "$formname = ' formname ' and $state. Actor.actorid =" + Getwebuser (). GetId () + "'";

Dql

SQL mode:

var sql= "Select d.* from Tlk_tablename d";

SQL + = "WHERE (d.id in (select States.docid";

SQL + = "from T_flowstatert states, T_ACTORRT actors";

SQL + = "where states.id = actors.flowstatert_id";

SQL + = "and Actors.actorid = '" +getwebuser (). GetId () + "')";

sql

MyApps View (1)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.