Một số hàm dữ liệu iif-D

Các hàm xử lý data

* Cú pháp chung:
<iif-D>Hàm:Lệnh
<In>ts01</>ts02</>ts03</>ts04</>ts05</In>
<D-Compute>
Biểu_thức1</>Lọc1</>Tên_cột1
Biểu_thức2</>Lọc2</>Tên_cột2
</D-Compute>
<null:/>
<empty:/>
<notempty:/>
<fm></fm>
<expD></expD>
<covD></covD>
</iif-D>

* covD
Double, Int, HtmlEncode



1 Tham chiếu dữ liệu cột từ DataWeb
Cú pháp:
<iif-D>Data:CellWeb
<In>ID</>Tên_cột</In>
</iif-D>

Với NoiDung_Web thì hệ thống tự chỉ định ID_NoiDung_Web, nếu là file xml thì tự chỉ định là _SYS_Key
Ví dụ
: lấy dữ liệu tiêu đề của bảng ghi có ID=1
<iif-D>Data:CellWeb
<In>1</>TieuDe</In>
</iif-D>

Theo điều kiện where
<iif-D>Data:CellWeb
<In>Where:Điều_kiện</>Cột</In>
</iif-D>
Ví dụ:
<iif-D>Data:CellWeb
<In>Where:NameUrl='/gio-hang/goi-don-hang'</>ID_NoiDung_Web</In>
</iif-D>


Áp dụng D-Compute
<iif-D>Data:CellWeb
<In>Where:</>{Tên_cột1} - {Tên_cột2} </In>
<D-Compute>
Biểu_thức1</>Lọc1</>Tên_cột1
Biểu_thức2</>Lọc2</>Tên_cột2
</D-Compute>
</iif-D>

* Where: Sau khi DComputer ra kết quả mới gọi Where
* Muốn where dùng tham số Lọc thì Biểu_thức1</>Lọc1</>Tên_cột1
Ví dụ:
<iif-D>Data:CellWeb
<In></>{TongSo:n0}</In>
<D-Compute>
Count(ID_NoiDung_Web)</>ID_NoiDung_Web_Parent=1</>TongSo
</D-Compute>
</iif-D>


Nếu định dạng số dùng {Tên_cột1:n0} - {Tên_cột2:n2}
Ví dụ:

<iif-D>Data:CellWeb
<In></>{TongDiem:n0} - {SoLuongHS:n0} </In>
<D-Compute>
Sum(Diem)</></>TongDiem
Count(Ma)</></>SoLuongHS
</D-Compute>
</iif-D>
* Where có thể để trống để lấy hết dữ liệu.

Áp dụng hàm IsNull(TenCot,0)  -> Đang kiem tra
Không dùng được Sum(Diem+2)</></>TongDiem
C2 IS NOT NULL
Không dùng được cách: Sum(SL_M*Gia)

2 Lấy dữ liệu từ DataWeb
Cú pháp:
<iif-D>Data:DataWeb
<In>State</>Where</>Sort</>SelectCoumn</>Distinct</In>
</iif-D>
Giải thích:
State: chế độ xuất có 2 lựa chọn  xml   /  json
Where: là điều kiện truy xuất dữ liệu
Sort: sắp xếp theo sql
SelectCoumn: tên cột cần lấy, để trống lấy hết


Ví dụ:
<iif-D>Data:DataWeb
<In>json</>ID_NoiDung_Web_Parent=2</In>
</iif-D>


3 Lấy dữ liệu từ file xml
Cú pháp:
<iif-D>Data:FileXml
<In>State</>Đường_dẫn</>Where</>Sort</>SelectCoumn</>Distinct</In>
<D-Compute></D-Compute>
</iif-D>

Giải thích:
State: chế độ xuất có 2 lựa chọn  xml   /  json
Đường_dẫn: là đường dẫn file xml
Where: Theo điều kiện như SQL, có thể để trống.
Sort: sắp xếp
SelectCoumn: tên cột cần lấy, để trống lấy hết
D-Compute: biểu thức tính, nhiều cách nhau dấu /-/
                     SUM(Cot1)#MoTaCo1&SUM(Cot2)#MoTaCo2
Ví dụ:
<iif-D>Data:FileXml
<In>json</>/app_data/dulieu.xml</>Diem>10</>Diem ASC</>HoTen,Lop</In>
</iif-D>

<iif-D>Data:FileXml
<In>json</>/app_data/xml_data/xe.xml
</In></iif-D>

4 Lấy dữ liệu từ SessionDataTable
Cú pháp:
<iif-D>Data:SessionDataTable
<In>Tên_Session</>State</>Where</>Sort</>SelectCoumn</>Distinct</In>
</iif-D>


Giải thích:
State: chế độ xuất có 2 lựa chọn  xml   /  json
Đường_dẫn: là đường dẫn file xml
Where: Theo điều kiện như SQL, có thể để trống.
SelectCoumn: tên cột cần lấy, để trống lấy hết

5 Lấy dữ liệu từ Query
Cú pháp:
<iif-D>Data:Query
<In>State</>Tên_Query</>ID_Query</In>
</iif-D>

Giải thích:
State: chế độ xuất có 2 lựa chọn  xml   /  json
Tên: là tên query đã khai báo

* Kết hợp phần lệnh để xuất đúng chuẩn dữ liệu

xx

Mục liên quan: