6 Replies Latest reply: Mar 22, 2012 1:12 PM by 920711 RSS

    How to fetch Child form data in OIM 11g

    920711
      Hi All,

      Can any one help me in fetching child form data in OIM 11g. I have the multi valued attribute in child table. Currently I am using the following code snippet to fetch the child form data but am not successful. I am getting only first record. Please let me know where I am going wrong.

      long formDefKey = formInstanceOperationsIntf.getProcessFormDefinitionKey(processKeyInstance);
      int iVersion = formInstanceOperationsIntf.getProcessFormVersion(processKeyInstance);

      tcResultSet childFormDefs = formInstanceOperationsIntf.getChildFormDefinition(formDefKey, iVersion);

      for (int i = 0; i < childFormDefs.getRowCount(); i++) {
      childFormDefs.goToRow(i);
      tcResultSet childForm = formInstanceOperationsIntf.getProcessFormChildData(childFormDefs.getLongValue("Structure Utility.Child Tables.Child Key"), processKeyInstance);
      String[] childColumnName = childForm.getColumnNames();
      try {
      for (int index = 0; index < childColumnName.length; index++) {
      System.out.println("name:" + childColumnName[index]);
      System.out.println(childForm.getStringValue(childColumnName[index]));
      }
      } catch (tcColumnNotFoundException columnNotFoundException) {
           throw new Exception("Error occurred while setting child column names:"+ columnNotFoundException);
      }


      Thanks in Advance.
        • 1. Re: How to fetch Child form data in OIM 11g
          Gyanprakash Pandey
          Hi,

          Refer code below:

          long formDefKey = formInstanceOperationsIntf.getProcessFormDefinitionKey(processKeyInstance);
          int iVersion = formInstanceOperationsIntf.getProcessFormVersion(processKeyInstance);

          tcResultSet childFormDefs = formInstanceOperationsIntf.getChildFormDefinition(formDefKey, iVersion);

          for (int i = 0; i < childFormDefs.getRowCount(); i++) {
          childFormDefs.goToRow(i);

          long childFormKey = childFormDefs.getLongValue("Structure Utility.Child Tables.Child Key");
          int version = childFormDefs.getIntValue("Structure Utility.Child Tables.Child Version");

          tcResultSet formFields = formDefinitionIntf.getFormFields(childFormKey, version);
          try {
          for (int index = 0; index < formFields.length; index++) {
          /*
          Now print value of this result set to get child form data
          */
          }
          } catch (tcColumnNotFoundException columnNotFoundException) {
          throw new Exception("Error occurred while setting child column names:"+ columnNotFoundException);
          }

          regards,
          GP
          • 2. Re: How to fetch Child form data in OIM 11g
            920711
            I am getting the form fields(Columns) but how can i get the values (column data) from the child form.

            I used the below code to fetch the values but this code is not fetching the data.

            tcResultSet childForm = formInstanceOperationsIntf.getProcessFormChildData(childFormDefKey, childIVersion);
            String[] childColumnName = childForm.getColumnNames();
            try {
            for (int index = 0; index < childColumnName.length; index++) {
            System.out.println("name:" + childColumnName[index]);
            System.out.println("*********values*******************:"+ childForm.getStringValue(childColumnName[index]));
            }
            }catch (tcColumnNotFoundException columnNotFoundException) {
            throw new ProvisionServiceException("Error occurred while setting child column names in oimToHPML:"+ columnNotFoundException);
            }

            Appreciate your help in advance

            Thanks
            • 3. Re: How to fetch Child form data in OIM 11g
              Gyanprakash Pandey
              < for (int index = 0; index < childColumnName.length; index++) {
              System.out.println("name:" + childColumnName[index]);
              System.out.println("*********values*******************:"+ childForm.getStringValue(childColumnName[index]));
              } >

              /*Print result set.*/
              printResultSet(childForm );

              }
              /*Add this method*/
              public static void printResultSet(tcResultSet result) throws tcAPIException, tcColumnNotFoundException{
              for(int i = 0; i < result.getRowCount(); i++){
              result.goToRow(i);
              String column[] = result.getColumnNames();
              for(int j = 0; j < column.length; j++){
              String columnName = column[j];
              String value = result.getStringValue(columName);
              /*Print column name and values now*/
              }
              }
              }

              regards,
              GP
              • 4. Re: How to fetch Child form data in OIM 11g
                920711
                Hi GP,

                I did the same but am not getting the values.. dont know where am going wrong.
                There are 3 values (records) in child table but am not getting those values. I am only first record value.
                Any other clues please

                Thanks
                • 5. Re: How to fetch Child form data in OIM 11g
                  idm731
                  Try this code. pass the 'processInstanceKey' from your adapter and test :)
                  Also change the columns of the child table (UD_ADUSRC_KEY, UD_ADUSRC_VALUE etc ) to the values that you want.


                  ===============================
                  tcFormInstanceOperationsIntf formIntf = OimServiceManager.getTcFormInstanceOperationsIntf();
                  long pFormDefinitionKey = formIntf.getProcessFormDefinitionKey(processInstanceKey);
                  int pFormVersion = formIntf.getProcessFormVersion(processInstanceKey);

                  // Get the child form definition...
                  tcResultSet formChildDefRS = formIntf.getChildFormDefinition(pFormDefinitionKey, pFormVersion);

                  // Get the child form definition key
                  long pchildFormDefKey = 0;
                  if (formChildDefRS != null) {
                  formChildDefRS.goToRow(0);
                  try {
                  pchildFormDefKey = formChildDefRS.getLongValue("Structure Utility.Child Tables.Child Key");
                  } catch (tcColumnNotFoundException e) {
                  logger.info("tcColumnNotFoundException occurred in formChildDefRS.getLongValue");
                  }
                  }

                  tcResultSet adChildFormData = formIntf.getProcessFormChildData(pchildFormDefKey, processInstanceKey);

                  for (int i = 0; i < ((tcResultSet)adChildFormData).getRowCount(); i++) {
                  ((tcResultSet)adChildFormData).goToRow(i);
                  long adUsrcKey = adChildFormData.getLongValue("UD_ADUSRC_KEY");
                  String adUsrcGroupName = adChildFormData.getStringValue("UD_ADUSRC_GROUPNAME");
                  logger.info("adUsrcKey : " + adUsrcKey + "\t adUsrcGroupName :" + adUsrcGroupName);
                  }
                  ===============================
                  • 6. Re: How to fetch Child form data in OIM 11g
                    920711
                    Thanks a lot.
                    Issue resolved :)