How To Make Selector For Csanswers
17 August 2020
Hello everybody,
recently one of the colleagues asked me how to make selector from Attributes values. Also that request seem trivial, but still took some time, especially with usage of FBQL query to build.
Below goes template you may use if you'll need some kind of selector for attributes by some predefined value:
public class SOOrderExt : PXCacheExtension<SOOrder> { public class Codes { public const string MediaCode = "MEDIACODE"; public class mEdiaCode : BqlType<IBqlString, string>.Constant<mEdiaCode> { public mEdiaCode() : base("mEdiaCode") { } } public const string OrdOrigin = "ORDORIGIN"; public class ordOrigin : BqlType<IBqlString, string>.Constant<ordOrigin> { public ordOrigin() : base("ORDORIGIN") { } } } [PXSelector(typeof(SearchFor<CSAnswers.value>.Where<CSAnswers.attributeID.IsEqual<Codes.ordOrigin>>))] [PXDBString(50)] public string SomeValue1 { get; set; } [PXSelector(typeof(SearchFor<CSAnswers.value>.Where<CSAnswers.attributeID.IsEqual<Codes.mEdiaCode>>))] [PXDBString(50)] public string SomeValue { get; set; } }
For me it was also interesting to note, that in the past it was common to use for Selector combination of PXSelector with Search, but in FBQL you'll need PXSelector with SearchFor.