package Record;

import j4d.open.*;

class Examplet {

  /* doModifyRecord modify the second field of the second table where
  // the first field = John
  */
  public void doModifyRecord(opProcess process) throws opException{

    int mTargetTable = 2;
    int mTargetField = 1;
    opTable mTable = new opTable(mTargetTable);
    opData mData = new opData(ALPHANUMERIC,"John");

    try {
      //Search the record where the name is "John"
      opSearchArray mSearch = new opSearchArray(1);
      mSearch.mSearchArray[0] = new opSearch(NONE, mTargetTable, mTargetField, EQUAL, mData);
      opSelection mSelection = process.Search(mSearch);

      //Access to the second field of the record and change the value to 22
      opDataArray mArrayData = new opDataArray(2);
      mArrayData.mDataArray[1] = new opData(INTEGER,22);

      //Modify the record
      process.ModifyRecord(mTable, mArrayData);
    }
    catch (opException er){throw er;}
  }

}