Skip to main content
Solved

Lookup does not show any columns

  • September 27, 2022
  • 13 replies
  • 186 views
  • Translate All

Forum|alt.badge.img+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

 

Best answer by darylbowman

Works for me:

 

 

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

View original

13 replies

darylbowman
Captain II
Forum|alt.badge.img+17

Could you post the selector code?

Translate

Forum|alt.badge.img+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

Translate

darylbowman
Captain II
Forum|alt.badge.img+17

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.

Translate

deybanperez
Jr Varsity III
  • Jr Varsity III
  • September 27, 2022

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,

Translate

darylbowman
Captain II
Forum|alt.badge.img+17

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.

Translate

Forum|alt.badge.img+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.

 

Translate

darylbowman
Captain II
Forum|alt.badge.img+17

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

Translate

Forum|alt.badge.img+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> { }

Translate

darylbowman
Captain II
Forum|alt.badge.img+17

Works for me:

 

 

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

Translate

Forum|alt.badge.img+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? 

Translate

darylbowman
Captain II
Forum|alt.badge.img+17

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
Translate

darylbowman
Captain II
Forum|alt.badge.img+17

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

Translate

Forum|alt.badge.img+1

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

Translate