cancel
Showing results for 
Search instead for 
Did you mean: 

Grid with Grouping - Select checkbox

gpam
Explorer
0 Kudos
277

Dear Good Morning, query how to select the checkboxes in a group query that is displayed in a grid, photo attached.

When I select the checks and want to print which checks have been marked, I get the following error:  "Add-on 9000037 failed with an exception. Event type: 6"

I attached code:

for (int k = 0; k < oGrid.Rows.Count-1; k++)
{

string IsSelected = oGrid.DataTable.GetValue("Select", k).ToString();

System.Diagnostics.Debug.WriteLine(IsSelected);

}

Note: In this  string IsSelected = oGrid.DataTable.GetValue("Select", k).ToString(); Error Offset de registro no válido [131-183]

With this I load the grid


cadena = "select CardCode , 'SelectRow' as 'Select',DocEntry, DocNum, CardName, DocDate, DocTotal, DocStatus from OPCH where CANCELED='N' and DocDate between '" + EditText0.Value + "' and '" + EditText1.Value + "' and DocStatus <>'C' group by CardCode,CardName,DocEntry, DocNum,DocDate, DocTotal, DocStatus --and DocType='S' ";
oForm.DataSources.DataTables.Item(0).Clear();
oForm.DataSources.DataTables.Item(0).ExecuteQuery(cadena);
oGrid.DataTable = oForm.DataSources.DataTables.Item("DT_0");

oForm.Freeze(true);
oForm.DataSources.DataTables.Item(0).ExecuteQuery(cadena);
oGrid.CollapseLevel = 1;
oForm.Freeze(false);
oEditColumn = ((SAPbouiCOM.EditTextColumn)(oGrid.Columns.Item("Select")));
oEditColumn.Type = BoGridColumnType.gct_CheckBox;

 

oGrid.AutoResizeColumns();
oEditColumn = ((SAPbouiCOM.EditTextColumn)(oGrid.Columns.Item("CardCode")));
oEditColumn.LinkedObjectType = "2";
oEditColumn = ((SAPbouiCOM.EditTextColumn)(oGrid.Columns.Item("DocEntry")));
oEditColumn.LinkedObjectType = "18";


// Set columns size
oGrid.Columns.Item(0).Width = 50;
oGrid.Columns.Item(1).Width = 60;
oGrid.Columns.Item(2).Width = 130;

Please your support.

Kind regards


View Entire Topic
ANKIT_CHAUHAN
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi gpam,

Can you try something like below?

 

oGrid = (SAPbouiCOM.Grid)SBO_Application.Forms.Item(pVal.FormUID).Items.Item("grid").Specific
int dtrow = oGrid.GetDataTableRowIndex(pVal.Row)
if(dtrow <> -1)
oGrid.DataTable.GetValue(pVal.ColUID, dtrow)

 

Kind regards,

ANKIT CHAUHAN

SAP Business One Support