Skip to main content

Hello, 

I’ve added an attribute to the Customer screen and an attribute to the Location screen.

Attributes on the Customer screen. 

Attributes on the Location screen.

I’ve finding that the attribute data is being saved to two different places.
The customer attributes are saved to the CSAnswers table. I can access this easily. 
The location attributes are saved to the LocationKvExt table. I don’t know how to access data in these KvExt tables.

PXGraph p = new PXGraph();
Location location = p.Select<Location>().FirstOrDefault(x => x.LocationID == ardoc.CustomerLocationID);
CSAnswers cSAnswersLocationANACode = p.Select<CSAnswers>().FirstOrDefault(x => x.RefNoteID == location.NoteID && x.AttributeID == "CHGLLOCEAN");

I use the code above to access the attribute from the CSAnswers table - does anyone know how to access the data from LocationKvExt?

You can access these attributes via GetValueExt / SetValueExt functions.

I supposed your attribute’s name is “EAN”. Please note the “Attribute” prefix in the code sample.

PXGraph p = new PXGraph();
Location location = p.Select<Location>().FirstOrDefault(x => x.LocationID == ardoc.CustomerLocationID);

var attributeValue = (PXStringState)p.Cachesetypeof(Location)].GetValueExt(location, "AttributeEAN");

 


Thank you @Zoltan Febert 

Golden answer. Works perfectly. Thank you for sharing your knowledge. 

I had figured out a workaround, and although it worked, it was pretty horrendous. Your one line solution is far, far cleaner.

Thank you 


Reply