Skip to main content
Question

Is there an easier way to add an attribute to a data view?

  • June 15, 2023
  • 2 replies
  • 252 views

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

Several times recently, I’ve had to add a simple attribute above a data view declaration. For a simple data view, this is as easy as redefining the data view and adding the attribute. However, if the data view has a data view delegate, and the data view delegate calls private methods, the amount of copy/paste code needed in order to add a single line of code is ridiculous.

Am I missing an easier way to do this? It feels like there should be an event or something to use, similar to adding an attribute to a DAC field on CacheAttached.

2 replies

Marco Villasenor
Jr Varsity II
Forum|alt.badge.img+2

Can you share an example of the View you want to modify and what you have already tried?

Depending on the specific View you need to modify there could be alternatives.

If you just need to add attributes like PXFilterable, then you can extend the Graph, override the View and would need to copy and paste the existing BQL (here you are right about the copy and pasting). That should be enough, since the Extension would invoke the Base view delegate.

If, for example, you need to add a condition, you can override the view delegate, call one of the PXView methods (WhereAnd, WhereNew, WhereNot, etc.) inside it to modify the Base view BQL and then return the Base delegate which should use the modified BQL. This may not work in all cases, as some delegates are more complex than others, but it's worth looking into.

 

 


darylbowman
Captain II
Forum|alt.badge.img+15
  • Author
  • February 22, 2024

It's usually the first one, adding PXFilterable, PXImport, PXCopyPasteHiddenFields, etc.

 

The original post is 8 months old. I don't remember what the situation was. I just searched for something similar and found it again, unanswered. I do recall wanting to add PXImport to a detail tab, which you can imagine was more complex than most.