Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 3132

Retrieving Bound Matrix Data in a System Form

$
0
0

Hello there, I'm a newer developer to SAP Business One, and have been working on an AddOn written in C# that utilizes the UI and DI APIs for a short while, now. I am having an issue obtaining the information bound to several matrix columns. Currently, I can obtain the information from the majority of columns, save for columns like Total (LC), Unit Price, and Tax Code.

 

Firstly, the issue I am having with Total (LC) and Unit Price is that I cannot obtain the information from a DBDataSource as I can with most of the other columns. I was originally getting the information directly from the cell.Specific item, but that was proving to be somewhat sluggish. I opted for pulling the data from a DBDataSource, using the DataBind information (Alias and TableName) like so:

 

                            Matrix matrix = (Matrix)refItem.Specific;

                            Column col = matrix.Columns.Cast<Column>().First(c => c.Title == colTitle);

 

                            DBDataSource glDataSource = IntegratedForm.DataSources.DBDataSources.Item(col.DataBind.TableName);

                            string value = glDataSource.GetValue(col.DataBind.Alias, SelectedGLRow - 1);

 

Here, SelectedGLRow is a one-indexed indicator for the currently selected row, refItem is the Item interface object obtained using UID 38 from the Form interface object IntegratedForm, and colTitle is the string representation of the column title.

 

This works wonders for nearly every column, save for a few. For columns like Unit Price, Total (LC), and Blanket Agreement No. on the Sales Order Form (by default), col.DataBind.TableName is null and col.DataBind.Alias returns a value akin to "SYS_##". I am absolutely uncertain as to what I should be doing with this "SYS_##" value, I can't find anywhere in the database that this value exists. I did find, however, that Unit Price seems to be made up of the "Price" column and the "Currency" column, simply concatenated. Similarly, the Total (LC) value seems to come from "Line Total" concatenated with "Currency".

 

There has to be a simpler way of obtaining these values rather than going to the database and crawling through to find the columns that make up the value shown to the user. What am I missing here?

 

Furthermore, the column Tax Code is giving me a slightly different issue. I was originally obtaining the value from the grid by directly accessing the specific items, like I mentioned above, using this code:

 

                                Cell cell = col.Cells.Item(SelectedGLRow);

                                switch (col.Type)

                                {

                                    case BoFormItemTypes.it_COMBO_BOX:

                                        ComboBox comboBox = (ComboBox)cell.Specific;

                                        fieldVal += comboBox.Selected.Description;

                                        break;

                                    case BoFormItemTypes.it_STATIC:

                                        StaticText staticText = (StaticText)cell.Specific;

                                        fieldVal += staticText.Caption;

                                        break;

                                    case BoFormItemTypes.it_LINKED_BUTTON:

                                    case BoFormItemTypes.it_EDIT:

                                    case BoFormItemTypes.it_EXTEDIT:

                                        EditText editText = (EditText)cell.Specific;

                                        fieldVal += editText.Value;

                                        break;

                                }

 

The Tax Code column seems to be of type it_COMBO_BOX, but I get no value from that code whatsoever, and I don't see any other possible values while debugging that I could use. I then tried using the former block, using a datasource, but the value returned from the datasource is always an empty string, even though I can clearly see the values on the GUI (PA, NY, etc.). I feel like I'm missing something small here as well, but can't quite find it.

 

Any help is immensely appreciated.

 

EDIT: I neglected to mention, I am using SAP Business One 32-Bit 9.1.150.


Viewing all articles
Browse latest Browse all 3132

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>