Orchestra Python API | read 方法的 goups 參數(shù)

前言:
要使用 Orchestra Python API (下文簡稱 api) 查詢數(shù)據(jù),就需要使用 read 方法。read 方法提供豐富的過濾、聚合、排序功能,在用戶權(quán)限范圍內(nèi)支持查詢一切實(shí)體類型,且線程安全,可放心使用。
開發(fā)界面展示數(shù)據(jù)時(shí)常常需要對(duì)數(shù)據(jù)分組,這就需要用到 groups?參數(shù)。
正文:
groups 參數(shù)用于對(duì)數(shù)據(jù)分組,參數(shù)包含 column,direction 關(guān)鍵字,以及一個(gè)待開發(fā)的 method 關(guān)鍵字。
注意:給定字段需要滿足在圖式中 grouper 屬性的 enabled 不為 false,如果為 false 則排序無效,目前 summary、lambda 及 pivot 字段不支持排序。
groups 的一般形式如下:
column 關(guān)鍵字表示按照給定字段對(duì)查詢結(jié)果排序,與 sorts 參數(shù)一致。
direction 關(guān)鍵字表示排序的方向,有兩個(gè)可選值,分別是 asc 和 desc,與 sorts 參數(shù)一致。
未啟用?groups 參數(shù)時(shí),read 方法的返回?cái)?shù)據(jù)結(jié)構(gòu)如下:
當(dāng)啟用?goups?參數(shù)時(shí),read 方法的返回?cái)?shù)據(jù)結(jié)構(gòu)的形式會(huì)有所不同:
數(shù)組元素的 display_name?表示該組名稱,children 屬性表示該組包含的所有任務(wù)。
下面我們舉例說明,執(zhí)行以下代碼:
返回?cái)?shù)據(jù)應(yīng)是如下形式:
注意:pages 參數(shù)會(huì)影響 children 中任務(wù)的數(shù)量
我們的主頁:
orchestra-technology.com
API:
https://github.com/orchestra-technology/python-api.git
申請(qǐng)?jiān)囉茫?/strong>
service@orchestra-technology.com