尝试仅过滤满足两个条件的行 [英] Trying To Filter Only Rows That Meet Two Criteria
问题描述
我保证我已经阅读了查询信息"页面,但是显然我缺少/误解了一些东西.
I promise I have read through the Query information page, but obviously I am missing/misunderstanding something.
我有一个表,其中包含多个部门的状态(字段为字符串).当用户加载该表时,我希望App Maker 隐藏已完成 的作业.
I have a Table that has the statuses for multiple departments (the fields are Strings). When a user loads that table I want App Maker to hide jobs that have been finished.
将作业分类为完成的方式是:
The way we categorize a job as finishes is when:
库存状态=已完成,以及交付状态=已交付.
这两个条件都必须满足.
Both these conditions need to be met.
示例:
库存(已完成)+交付(已交付)= 隐藏
Inventory (Complete) + Delivery (Delivered) = hide
库存(进行中)+交付(已交付)=不要隐藏
Inventory (In Progress) + Delivery (Delivered) = don't hide
库存(完整)+交货(预定)=不要隐藏
Inventory (Complete) + Delivery (Scheduled) = don't hide
我尝试了以下操作,但是它隐藏了上面列出的示例的 all ,而不仅仅是第一个示例.
I tried the following, however it hides all the example listed above, not just the first one.
var datasource = app.datasources.SystemOrders;
var inventory = ['Complete'];
var delivery = ['Delivered'];
datasource.query.filters.InventoryStatus._notIn = inventory;
datasource.query.filters.DeliveryStatus._notIn = delivery;
datasource.load();
我也尝试过:
var datasource = app.datasources.SystemOrders;
datasource.query.filters.InventoryStatus._notIn = 'Complete';
datasource.query.filters.DeliveryStatus._notIn = 'Delivered';
datasource.load();
但我收到此错误:
类型不匹配:无法为属性_notIn设置类型字符串.类型列表是预期的.在SystemOrders.ToolBar.Button2.onClick:2:46
Type mismatch: Cannot set type String for property _notIn. Type List is expected. at SystemOrders.ToolBar.Button2.onClick:2:46
任何帮助将不胜感激.
Any help would be greatly appreciated.
推荐答案
过滤器使用AND运算符.请考虑切换数据源查询生成器并应用以下查询:
Filters are using AND operator. Please consider switching the Datasource Query Builder and applying the following query:
"InventoryStatus!=:CompleteStatus或DeliveryStatus!=:DeliveredStatus"
"InventoryStatus != :CompleteStatus OR DeliveryStatus != :DeliveredStatus"
将CompleteStatus变量设置为Complete 将DeliveredStatus变量设置为Delivered
Set CompleteStatus variable to Complete Set DeliveredStatus variable to Delivered
说明: 您要应用的过滤器是"NOT(InventoryStatus =完成AND DeliveryStatus =已交付)",它等效于"InventoryStatus!=完成或DeliveryStatus!=已交付".
Explanation: Filter you want to apply is "NOT(InventoryStatus = Complete AND DeliveryStatus = Delivered)" which is equivalent to "InventoryStatus != Complete OR DeliveryStatus != Delivered".
这篇关于尝试仅过滤满足两个条件的行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!