我有一个选择字段'州'其值为$xpath = new DOMXPath($dom);
$metas = $xpath->query('//meta[@property="al:ios:url"]');
$id = "";
if (preg_match('~[?&]id=(\d+)~', $metas->item(0)->getAttribute('content'), $match))
{
$id = $match[1];
}
。
我按照“州”字样对记录进行了分组。字段,但我们如何按字段值对记录进行分组,在本例中为resolved, dismissed, closed
?
resolved, dismissed and closed
答案 0 :(得分:2)
可以通过在过滤器中指定域来实现。
<filter string="Resolved" domain="[('state','=','resolved')]" />
<separator/>
<filter string="Dismissed" domain="[('state','=','dismissed')]" />
<separator/>
<filter string="Closed" domain="[('state','=','closed')]" />
一旦您选择了将根据您在域中指定的条件过滤结果集的过滤器,它将创建3个过滤器。
要为所有这三个生成group by,您需要通过为group by创建三个单独的过滤器来指定相同的域。
<group extend="0" string="Group By">
<filter name="attachment_type" string="attachment Type" context="{'group_by' : 'attachment_type'}"></filter>
<filter name="state_resolved" string="Resolved" context="{'group_by': 'state'}" domain="[('state','=','resolved')]" ></filter>
<filter name="state_dismissed" string="Dismissed" context="{'group_by': 'state'}" domain="[('state','=','dismissed')]" ></filter>
<filter name="state_closed" string="Closed" context="{'group_by': 'state'}" domain="[('state','=','closed')]" ></filter>
</group>