select ValueID from CSAttributeDetail where AttributeID = 'MFGPRPALLE';
I need to get same result like above sql query. How can I get the result using PXSelector?
select ValueID from CSAttributeDetail where AttributeID = 'MFGPRPALLE';
I need to get same result like above sql query. How can I get the result using PXSelector?
To be able to use the constant string value in the PXSelector attribute you need to create the constant Bql class:
public class AttributeConstants
{
public const string AttributeConstID = "MFGPRPALLE";
public class attributeConstID : BqlType<IBqlString,string>.Constant<attributeConstID>
{
public attributeConstID() : base(AttributeConstID) { }
}
}
After that, you can declare the field and put the PXSelector like the following:
public sealed class SOOrderExt : PXCacheExtension<SOOrder>
{
public static bool IsActive() => true;
#region UsrFakeField
[PXDBString(10)]
[PXUIField(DisplayName = "MFGPRPALLE")]
[PXSelector(typeof(Search<CSAttributeDetail.valueID,Where<CSAttributeDetail.attributeID,Equal<AttributeConstants.attributeConstID>>>),new Type[]
{
typeof(CSAttributeDetail.valueID),
typeof(CSAttributeDetail.description)
})]
public string UsrFakeField { get; set; }
public abstract class usrFakeField : BqlType<IBqlString, string>.Field<usrFakeField> { }
#endregion
}
Result:
Hi
You need to use below code snippet for selector
PXSelector(typeof(Search<CSAttributeDetail.valueID,
Where<CSAttributeDetail.attributeID, Equal<Required<defaultAttributeValue>>>>))]
and create a constant of default attribute as below.
public const string DefaultAttributeValue = "MFGPRPALLE";
public class defaultAttributeValue : PX.Data.BQL.BqlString.Constant<defaultAttributeValue>
{
public defaultAttributeValue()
: base(DefaultAttributeValue)
{
}
}
Hope, it helps!
Regards,
Sweta
Hi
You need to use below code snippet for selector
PXSelector(typeof(Search<CSAttributeDetail.valueID,
Where<CSAttributeDetail.attributeID, Equal<Required<defaultAttributeValue>>>>))]
and create a constant of default attribute as below.
public const string DefaultAttributeValue = "MFGPRPALLE";
public class defaultAttributeValue : PX.Data.BQL.BqlString.Constant<defaultAttributeValue>
{
public defaultAttributeValue()
: base(DefaultAttributeValue)
{
}
}
Hope, it helps!
Regards,
Sweta
This code also worked.
Thank you
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.