Skip to Content

Problem Regarding CheckBoxes

Dear All,

I am using an add-on for authorization purpose. In it I am to restrict the users for accessing limited Item Group Code.

ItemGrpCode is coming from OITB in my matrix. In matrix there is a column named assigned group & its type is Check-Box Type.

If I add the record then only those ItmGrpCode should be added in database against which Check Box is checked. Other should not be added in database.But I am unable to do so. What Can I Do Regarding this problem.? Kindly Help Me....

Add a comment
10|10000 characters needed characters exceeded

Related questions

3 Answers

  • Posted on Dec 13, 2011 at 05:50 AM

    Dear All,

    Plz. give me solution regarding this problem.....

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 13, 2011 at 02:05 PM

    Hi,

    May you post some codes you have tried so far?

    Thanks,

    Gordon

    Add a comment
    10|10000 characters needed characters exceeded

    • Hi Gordon.....

      Thanks for your reply. I was waiting for the reply. Here is the code that I have tried so far....

      _Method for picking ItemGroupCode and ItemGroupName from OITB table_

      private void FillItemGroupCode()

      {

      try

      {

      SAPbouiCOM.Matrix oMatrix = (Matrix)this.m_SBO_Form.Items.Item(enControlName.mtxDetails).Specific;

      SAPbouiCOM.Columns oColumns;

      SAPbouiCOM.Column oColumn;

      oColumns = oMatrix.Columns;

      oMatrix.Clear();

      string strsql;

      SAPbouiCOM.DataTable oDataT;

      strsql = "select ItmsGrpCod from OITB";

      if (this.m_SBO_Form.DataSources.DataTables.Count.Equals(0))

      {

      this.m_SBO_Form.DataSources.DataTables.Add("ItemGroupCode");

      }

      else

      {

      this.m_SBO_Form.DataSources.DataTables.Item("ItemGroupCode").Clear();

      }

      oDataT = this.m_SBO_Form.DataSources.DataTables.Item("ItemGroupCode");

      oDataT.Clear();

      oDataT.ExecuteQuery(strsql);

      if (oDataT.Rows.Count > 0)

      {

      oColumn = oColumns.Item("col_0");

      oColumn.DataBind.Bind("ItemGroupCode", "ItmsGrpCod");

      oMatrix.LoadFromDataSource();

      }

      else

      {

      this.SBO_Application.SetStatusBarMessage("No Data Found", SAPbouiCOM.BoMessageTime.bmt_Short, true);

      }

      }

      catch (Exception ex)

      {

      }

      }

      It is similar for ItemGroupName. Now here is Form Event.....

      public override void HANDLE_FORM_EVENTS(string FormUID, ref ItemEvent pVal, out bool BubbleEvent)

      {

      BubbleEvent = true;

      try

      {

      this.m_SBO_Form.Freeze(true);

      switch (pVal.BeforeAction)

      {

      case true:

      {

      switch (pVal.EventType)

      {

      case BoEventTypes.et_CLICK:

      {

      switch (pVal.ItemUID)

      {

      case enControlName.cmdOk:

      {

      if (pVal.ItemUID == "1" && pVal.FormMode == 3)

      {

      }

      if (pVal.ItemUID == "1" && pVal.FormMode == 0)

      {

      FillItemGroupCode();

      FillItemGroupName();

      }

      if (pVal.ItemUID == "1" && pVal.FormMode == 2)

      {

      }

      } break;

      }

      } break;

      }

      } break;

      case false:

      {

      if ((pVal.ItemUID == "1") && (pVal.FormMode == 3) && (pVal.EventType == BoEventTypes.et_ITEM_PRESSED))

      {

      GenerateNewCode();

      FillItemGroupCode();

      FillItemGroupName();

      }

      switch (pVal.EventType)

      {

      case BoEventTypes.et_CHOOSE_FROM_LIST:

      {

      switch (pVal.ItemUID)

      {

      case enControlName.txtUserName:

      {

      try

      {

      this.m_SBO_Form.Freeze(true);

      SAPbouiCOM.ChooseFromListEvent ocflEvent = default(SAPbouiCOM.ChooseFromListEvent);

      SAPbouiCOM.ChooseFromList oCFL = default(SAPbouiCOM.ChooseFromList);

      SAPbouiCOM.EditText oEdit = default(SAPbouiCOM.EditText);

      ocflEvent = (SAPbouiCOM.ChooseFromListEvent)pVal;

      string strUid = ocflEvent.ChooseFromListUID;

      oCFL = this.m_SBO_Form.ChooseFromLists.Item(strUid);

      SAPbouiCOM.DataTable oDataTable = ocflEvent.SelectedObjects;

      if (oDataTable == null)

      {

      return;

      }

      try

      {

      oEdit = (EditText)this.m_SBO_Form.Items.Item(enControlName.txtUserName).Specific;

      oEdit.Value = Convert.ToString(oDataTable.GetValue("U_NAME", 0));

      }

      catch (Exception ex)

      {

      }

      oEdit = (EditText)this.m_SBO_Form.Items.Item(enControlName.txtUserCode).Specific;

      oEdit.Value = Convert.ToString(oDataTable.GetValue("USER_CODE", 0));

      this.m_SBO_Form.Freeze(false);

      }

      catch (Exception ex)

      {

      this.SBO_Application.SetStatusBarMessage(ex.Message, SAPbouiCOM.BoMessageTime.bmt_Short, true);

      }

      } break;

      }

      } break;

      }

      } break;

      }

      this.m_SBO_Form.Freeze(false);

      }

      catch (Exception ex)

      {

      }

      }

      When my form comes in add mode, ItemGroupCode and ItemGroupName automatically binds with my matrix column. The checkbox that I have checked is shown as 'Y' in database but ItemGroupCode and ItemGroupName is NULL. I want that ItemGroupCode and ItemGroupName should not be NULL against which checkbox is checked.

      Kindly reply me regarding this.

      Edited by: ankitchauhanrajput on Dec 14, 2011 6:06 AM

      Edited by: ankitchauhanrajput on Dec 14, 2011 6:07 AM

  • author's profile photo Former Member
    Former Member
    Posted on Dec 14, 2011 at 04:32 PM
    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.