How to use a Multi-Select String field in a BQL Where

Viewed 25

I have a field in the unbound filter DAC for a custom processing screen that is a multi-select dropdown field. It has the PXStringList attribute defined like this:

    #region POStatus
    [PXString]
    [PXDefault(PersistingCheck = PXPersistingCheck.Nothing)]
    [PXUIField(DisplayName = "PO Status")]
    [PXStringList(new string[] { "N", "B" }, new string[] { "Open", "Pending Approval" }, MultiSelect =true)]
    public string POStatus { get; set; }
    public abstract class poStatus : PX.Data.BQL.BqlString.Field<poStatus> { }
    #endregion 

How can I use this field in the Where clause of the BQL query for the main view? So, in this case I'm trying to filter POOrder records by whatever statuses the user selects in the multi-select drop down. I tried using the IsIn<> operator but, it doesn't build.

Do I have to resort to a view delegate in order to do this?

TIA!

1 Answers

Acumatica stores the values for the multi-select drop-downs in 1 field as comma-separated values. The first thing I would try would be to try using the Contains operation in opposite direction like below:

PXSelect<POOrder, Where<Current<FilterDAC.poStatus>, Contains<POOrder.status>>> FilteredPOList;
Related