在通用查询条件中使用非持久字段

问题描述

我正在构建一个通用查询,它将列出带有 FixedRecurringPriceVal 和 UsrCustomFixedRecurringPriceVal 的合同详细信息。后者是自定义持久字段。现在,在此通用查询中,我只想列出客户合同中具有不同 FixedRecurringPriceVal 和 UsrCustomFixedRecurringPriceVal 的合同详细信息。

但是,那些我可以在结果网格中使用 FixedRecurringPriceVal 的,似乎我不能在需要在这些字段之间进行比较的条件中使用这个字段。

在查看数据字段源时,我发现了这一点。

        [PXDecimal(6)]
        [PXFormula(typeof(GetItemPriceValue<
            ContractDetail.contractID,ContractDetail.contractItemID,ContractDetailType.ContractDetail,ContractDetail.fixedRecurringPriceOption,Selector<ContractDetail.contractItemID,ContractItem.recurringItemID>,ContractDetail.fixedRecurringPrice,ContractDetail.basePriceVal,ContractDetail.qty,Switch<
                Case<Where<Parent<Contract.status>,Equal<Contract.status.draft>,Or<Parent<Contract.status>,Equal<Contract.status.pendingActivation>>>,IsNull<Parent<Contract.activationDate>,Parent<Contract.startDate>>,Case<Where<Parent<Contract.status>,Equal<Contract.status.active>,Equal<Contract.status.inUpgrade>>>,IsNull<Parent<ContractBillingSchedule.nextDate>,Current<AccessInfo.businessDate>>,Equal<Contract.status.expired>>,Parent<Contract.expireDate>>,Equal<Contract.status.canceled>>,IsNull<Parent<Contract.terminationDate>,Current<AccessInfo.businessDate>>>>>>,Current<AccessInfo.businessDate>>>))]
        [PXUIField(displayName = "Recurring Price")]
        public decimal? FixedRecurringPriceVal
        {
            get;
            set;
        }

所以,对我来说,非持久字段似乎不能用于通用查询条件。我做了一些谷歌,但找不到任何解决方案,还查看了 S130 数据检索和分析,但找不到特定于这种情况的内容

有什么办法可以做到这一点吗?

谢谢。

解决方法

不,您不能在条件中使用非持久字段。
字段下拉列表有意将它们排除在外。下面是加载下拉列表的 GenericInquiryDesigner 图中的 FieldSelecting 事件处理程序。

    protected void GIWhere_DataFieldName_FieldSelecting(PXCache cache,PXFieldSelectingEventArgs e)
    {
        string[] allParameters = this.GetAllParameters(true);
        PXStringListAttribute.SetList(cache,e.Row,typeof(GIWhere.dataFieldName).Name,allParameters,allParameters);
        this.a<GIWhere.dataFieldName>(cache,true,(PXCache c,string f) => !PXGenericInqGrph.IsVirtualField(c,f,null));
    }

在这种情况下,唯一的方法是创建一个单独的页面而不是 GI。