Solved

How to bound a multi-part Identifier based on matching condition?

  • 17 February 2022
  • 5 replies
  • 592 views

Userlevel 3
Badge +1

Hi guys How can I bond multi-part identifier .I need to get data from magnifier based on Matching condition

I tried PXRestrictor but couldn’t work out

Could you please help….

Thanks in advance.

 #region FIELD1
[PXDBString(30, IsUnicode = true)]
[PXUIField(DisplayName = "Template ID", Required = true)]
[PXDefault]
[PXSelector(typeof(Search<DAC.FIELD1>),
typeof(DAC1.FIELD1),
typeof(DAC1.FIELD2),
typeof(DAC1.FIELD3),
SubstituteKey = typeof(DAC1.FIELD1),
DescriptionField = typeof(DAC1.FIELD2))]
[PXRestrictor(typeof(Where<DAC2.FIELD1, NotEqual<Current<DAC1.FIELD1>>,
Or<DAC2.FIELD1, IsNull>>), SSS.SSP.Helper.Messages.Getmes)]

 

icon

Best answer by MoulaliShaik79 18 February 2022, 07:33

View original

5 replies

Userlevel 4
Badge +1

Hi @ShahidaValiSyed04 

Please check the below code, hope it works for you.

 [PXSelector(typeof(Search<SSPAgreeTemplate.templateCode, 
            Where<SSPAgreeTemplate.validFor, 
                Equal<Current<agreeType>>, Or<Current<agreeType>,IsNull>>>),
               typeof(SSPAgreeTemplate.templateCode),
          typeof(SSPAgreeTemplate.descr),
          typeof(SSPAgreeTemplate.validFor),
          SubstituteKey = typeof(SSPAgreeTemplate.templateCode),
          DescriptionField = typeof(SSPAgreeTemplate.descr))]

 

 

Note:  make AutoRefresh="true" to the TemplateCode field in Aspx file.

 

 

Thanks,

Moulali Shaik.

Userlevel 7
Badge +17

Hi @ShahidaValiSyed04  Since you wanted restrict the based on the dynamic value i.e. AgreeType.

You might need to join the both tables (DAC 1 and DAC 2). Can you do join and verify.

Userlevel 3
Badge +1

Hi @Naveen B Could you please checkout my code

#region TemplateCode
[PXDBString(30, IsUnicode = true)]
[PXUIField(DisplayName = "Template ID", Required = true)]
[PXDefault]
[PXSelector(typeof(Search<SSPAgreeTemplate.templateCode>),
typeof(SSPAgreeTemplate.templateCode),
typeof(SSPAgreeTemplate.descr),
typeof(SSPAgreeTemplate.validFor),
SubstituteKey = typeof(SSPAgreeTemplate.templateCode),
DescriptionField = typeof(SSPAgreeTemplate.descr))]
[PXRestrictor(typeof(Where<SSPAgreeTemplate.validFor, NotEqual<Current<SSPAgreement.agreeType>>,
Or<SSPAgreeTemplate.validFor, IsNull>>), SSS.SSP.Helper.Messages.templateId)]
public virtual string TemplateCode { get; set; }
public abstract class templateCode : PX.Data.BQL.BqlString.Field<templateCode> { }
#endregion

Error will be Like

The multi-part identifier "SSPAgreement.AgreeType" could not be bound.

Userlevel 7
Badge +17

@ShahidaValiSyed04 For more understanding about the error and code, please share the real DAC field.

If not possible, please refer to the above example given by Jini

Userlevel 7
Badge +11

Hi @ShahidaValiSyed04 

You are using different DAC associations with Selector and Restrictor. Can you please recheck the condition once? 

 #region FIELD1
        [PXDBString(30, IsUnicode = true)]
        [PXUIField(DisplayName = "Template ID", Required = true)]
        [PXDefault]

        [PXSelector(typeof(Search<DAC1.FIELD1>),
          typeof(DAC1.FIELD1),
          typeof(DAC1.FIELD2),
          typeof(DAC1.FIELD3),
          SubstituteKey = typeof(DAC1.FIELD1),
          DescriptionField = typeof(DAC1.FIELD2))]

        [PXRestrictor(typeof(Where<DAC2.FIELD1, NotEqual<Current<DAC1.FIELD1>>,
    Or<DAC2.FIELD1, IsNull>>), SSS.SSP.Helper.Messages.Getmes)]


Refer to the below sample code.
#region SiteID
        [PXDBInt()]
        [PXUIField(DisplayName = "Warehouse")]
        [PXSelector(typeof(INSite.siteID),
                    SubstituteKey = typeof(INSite.siteCD),
                    DescriptionField = typeof(INSite.descr))]
        [PXRestrictor(typeof(Where<INSite.siteID, NotEqual<SiteAttribute.transitSiteID>, And<INSite.active, Equal<True>>>),
                             PX.Objects.IN.Messages.TransitSiteIsNotAvailable)]

        [PXDefault()]
        public override int? SiteID { get; set; }
        public abstract class siteID : PX.Data.BQL.BqlInt.Field<siteID> { }
        #endregion

Reply


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2024  Acumatica, Inc. All rights reserved