Is there other way to hide column(s) maybe by name or index?
Page 1 / 1
Hi @tomwhitfoot
I suggest you have a generic DAC with the supported maximum number of field attributes and then implement the control logic in your graph of how many dynamic columns are you handling on a specific context.
Suppose that your maximum is 10:
public class DAC : IBqlTable { ...
#region Attr0 PXDBDecimal] PXUIField(DisplayName = "Attr0", Visible = false)] public virtual string Attr0 { get; set; } public abstract class attr0 : PX.Data.BQL.BqlDecimal.Field<attr0> { } #endregion
... ...
#region Attr10 PXDBDecimal] PXUIField(DisplayName = "Attr10", Visible = false)] public virtual string Attr10 { get; set; } public abstract class attr10 : PX.Data.BQL.BqlDecimal.Field<attr10> { } #endregion
}
Then your logic just map them to the real attribute. This way you have access to the specific field and then applying your logic is possible:
I’m not sure if I can apply that, the number of columns is based on Attribute ID line items, it has an indefinite number, if I keep adding new lines to the attribute values, the columns in the matrix view will expand further and I can select other attribute that has their own different number of columns.
Also, the column values are in string array in the event,
I’m not sure if I’m handing this on the correct event.
Hi @tomwhitfoot. Same question for me to solve.
This is an OLD post, but it is now my problem. This is the only hit I had on google for this issue. If you know of another one, please let me know!
I’m not actually trying to use a grid though. I just need to put data in a summary table that will be used in a GI. So my need should be a lot simpler as I don’t have to worry about the UI.
@Leonardo Justiniano ‘s suggestion would work for me as long as the customer doesn’t go bananas adding more attributes to the Project. Right now they have 10. I could create 30 columns and that SHOULD cover me. I guess if they go bananas, I could always modify the project and increase the column count. I hate hard coding limitations, but I don’t see any other way to do it. When creating the GI, the user will need to have a cheat sheet to manually label the fields for the description of the attribute, but that is a one time setup.
The other issue is that different Attributes have different data types. When creating my fields in my summary table, I would need to make them ALL nvarchar and convert the values in the attributes to strings. For a drop down list, that will be a pain as I would have to loop through all the values in the multi-select list and “flatten” them into a single value. I’m sure Acumatica base code has some crazy complicated way they do this if you pull a record from CSAnswers into a GI, but I think that is beyond my skills.
I’m going to proceed with Leonardo’s suggestion. Honestly, I hope this is the only option so I don’t spend 3 days on this to find out there is a new easy way.
Hello @tomwhitfoot,
Here's how you can hide columns by name in the Attributes grid:
public void EntryMatrix_RowSelected(PXCache sender, PXRowSelectedEventArgs e) { var grid = this.MatrixView.GetGrid(); if (grid != null) { // Hide column by its caption PXGridColumn column = grid.Columnsr"Extra Small"]; if (column != null) { column.Visible = false; } } }
You can also hide columns by index:
public void EntryMatrix_RowSelected(PXCache sender, PXRowSelectedEventArgs e) { var grid = this.MatrixView.GetGrid(); if (grid != null) { // Hide column by index (assuming it's the 3rd column, index starts at 0) if (grid.Columns.Count > 2) { grid.Columns2].Visible = false; } } }
Hope this Helps!
Hi @Joe Schmucker
One way to solve this kind of problem is to build an inquiry screen instead of using a GI, and rely on the classic, proven approach of dynamically creating columns based on your needs. It might require some additional coding, but please take a look and see if this helps resolve your problem: https://asiablog.acumatica.com/index.php/2016/10/generate-grid-columns-dynamically/
Hi @davidnavasardyan I will look at that. Thanks for digging it up for me. My notion was that the GI would make it easier for me, but if I am wrong, that is a good thing. The solution I have is not too pretty right now.