Solved

Lookup does not show any columns

  • 27 September 2022
  • 13 replies
  • 123 views

Userlevel 4
Badge +1

Hi,

I have created a lookup to display SOAddresses. However I could not see any columns in the lookup and the only column there in the column configuration is AddressId(when I select it, it also gives an error). 

Any idea about this? Below are the related screenshots.

 

 

Thanks

 

icon

Best answer by darylbowman 28 September 2022, 12:37

View original

13 replies

Badge +11

Could you post the selector code?

Userlevel 4
Badge +1

@darylbowman 

    #region UsrAddresses
    [PXDBString(300)]
    [PXSelector(typeof(Search<SOAddress.addressID>))]
    [PXUIField(DisplayName="Addresses")]

    public virtual string UsrAddresses { get; set; }
    public abstract class usrAddresses : PX.Data.BQL.BqlString.Field<usrAddresses> { }
    #endregion

Badge +11

There’s a number of things wrong with how you’re defining it.

Firstly, you’re storing the address as a string instead of the int? addressID. I wouldn’t recommend this.

Secondly, there aren’t any other columns because you haven’t defined any other columns.

 

I would change custom field to an int? (nullable int) in both your code and the database. Then use this, or something like it:

        #region UsrAddresses
[PXDBInt]
[PXSelector(typeof(Search<SOAddress.addressID>),
typeof(SOAddress.addressLine1),
typeof(SOAddress.addressLine2),
typeof(SOAddress.city),
typeof(SOAddress.state),
typeof(SOAddress.postalCode),
DescriptionField = typeof(SOAddress.addressLine1))]
[PXUIField(DisplayName = "Addresses")]

public virtual int? UsrAddresses { get; set; }
public abstract class usrAddresses : PX.Data.BQL.BqlInt.Field<usrAddresses> { }
#endregion

You can read more about options for defining selectors here.

Userlevel 3

Hi @charithalakshan49 ,

I agree @darylbowman, and you should store the addressID as an Int type at DB.

In addition, I want to highlight that you should define which are the columns being displayed in the selector.

 
Regards,

Badge +11

In addition, I want to highlight that you should define which are the columns being displayed in the selector.

 

I’m not sure where you got that, but according to the Acumatica wiki article, which I linked, that isn’t necessary.

Userlevel 4
Badge +1

@darylbowman @deybanperez83  Thanks for the responses.

@darylbowman I tried your code, but the same results as follows. AddressLine1 is the only column there. 

 

In Column configuration, I can add AddressId Column but it gives this error.

 

Badge +11

Could you post your code again? It seems like something still doesn’t match because it mentions a string.

Userlevel 4
Badge +1

@darylbowman       

 #region UsrAddresses
        [PXDBInt]
        [PXSelector(typeof(Search<SOAddress.addressID>),
                    typeof(SOAddress.addressLine1),
                    typeof(SOAddress.addressLine2),
                    typeof(SOAddress.city),
                    typeof(SOAddress.state),
                    typeof(SOAddress.postalCode),
                    DescriptionField = typeof(SOAddress.addressLine1))]
        [PXUIField(DisplayName="Addresses")]
        public virtual int? UsrAddresses { get; set; }
        public abstract class usrAddresses : PX.Data.BQL.BqlInt.Field<usrAddresses> { }
        #endregion

____________________________________________________________________

And I want to mention that if I use a table like InventoryItem, this problem does not occur anymore. if I code like below, all the columns of inventoryItem table shows in my lookup.

        [PXDBInt]
        [PXSelector(typeof(Search<InventoryItem.inventoryID>))]
        [PXUIField(DisplayName="Addresses")]
        public virtual int? UsrAddresses { get; set; }
        public abstract class usrAddresses : PX.Data.BQL.BqlInt.Field<usrAddresses> { }

Badge +11

Works for me:

 

 

You could try deleting the custom form field and re-making it?

Userlevel 4
Badge +1

@darylbowman  I tried recreating it, but I got the same result. It seems to be a problem in my Acumatica Instance. Could you please tell me what is the acumatica version that you are using? 

Badge +11

I am using 22R1, but I wouldn’t expect that to be a problem.

 

Before you give up hope, confirm / try the following:

  • Make sure the database field was changed from nvarchar or whatever it was to int
  • Unpublish the customization packages
  • Republish the customization packages
  • Make sure you tried deleting the selector element from the UI and adding it again after the new code was published
Badge +11

If none of that works, you can try publishing the package I uploaded here.

Userlevel 4
Badge +1

@darylbowman Thanks for helping me. I’ll tryout the things that you said. 

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