如何在 AL Business Central 中 query.open() 之后的 while 循环体中的查询对象中应用 SetFilter
How to apply SetFilter in a query object in while loop body after query.open() in AL Business Central
我只想在阅读查询正文时应用另一个过滤器。
例如:这是我的代码。
customAttributeQuery.SetFilter(Value_ID, attributeValueID);
customAttributeQuery.Open();
while customAttributeQuery.Read() do begin
counter := 0;
// HERE IN BODY I WANT TO APPLY ANOTHER FILTER
// customAttributeQuery.SetFilter(Value, attributeValue);
end;
The issue is when i apply another filter in the body of while loop and open the query and try to read it .This code always breaks my whole code.
我很确定你不能那样做,如果你应用过滤器,很可能你会打破循环并跳出。如果可能,请尝试将过滤器合并到查询对象中,在这种情况下,您可以使用类似的东西:
Table 1 as t1
{
Table 2 a t2
{
Table 1 as t3
{}
}
}
如果您正确使用它,通过在 t2 上设置过滤器,您可以在 t3 上获得所需的过滤器,它指向 t1 循环中的 Table。
我只想在阅读查询正文时应用另一个过滤器。 例如:这是我的代码。
customAttributeQuery.SetFilter(Value_ID, attributeValueID);
customAttributeQuery.Open();
while customAttributeQuery.Read() do begin
counter := 0;
// HERE IN BODY I WANT TO APPLY ANOTHER FILTER
// customAttributeQuery.SetFilter(Value, attributeValue);
end;
The issue is when i apply another filter in the body of while loop and open the query and try to read it .This code always breaks my whole code.
我很确定你不能那样做,如果你应用过滤器,很可能你会打破循环并跳出。如果可能,请尝试将过滤器合并到查询对象中,在这种情况下,您可以使用类似的东西:
Table 1 as t1
{
Table 2 a t2
{
Table 1 as t3
{}
}
}
如果您正确使用它,通过在 t2 上设置过滤器,您可以在 t3 上获得所需的过滤器,它指向 t1 循环中的 Table。