首页 > 解决方案 > Acumatica - BQL 选择等于字符串的表字段

问题描述

我想在我的 SQL 表中选择与我的代码中指定的测试字符串相等的任何字段。我看过这篇文章:Translate SQL to BQL in Acumatica然而,这是通过不可变的常量完成的。理想情况下,我想通过组合框更改字符串。这就是我所拥有的:

  public class TestOverview : PXGraph<TestOverview, TestOverview.MasterTable>
  {
       string test = "USA"

       public PXSelect<DemoCustomerBreakdown, 
       Where<DemoCustomerBreakdown.countryRegion,
       Equal<"I would like my string to go here">> CustomerCountry;
  }

任何想法如何在不使用常量类的情况下实现这一目标?谢谢

标签: c#acumatica

解决方案


如果您想将此视图绑定到表单视图,则常量是您唯一的选择。另一方面,如果您想使用此视图从代码中选择数据,则可以使用 Required<> 操作数,然后在您从此视图中选择时传递字符串:

 PXSelect<DemoCustomerBreakdown, 
   Where<DemoCustomerBreakdown.countryRegion,
   Equal<Required<DemoCustomerBreakdown.countryRegion>>> CustomerCountry;

 var results = CustomerCountry.Select(this, “My string”);

推荐阅读