KB Article #: KB0016499

Topic/Category: Format Conversion

Issue: When attempting to use the Format Conversion plugin to remove any Alphabetic characters and replace them with EMPTY. This feature doesn’t work.

Root Cause: This is a bug and will be fixed in v4.5.

Solution: Use ScriptExtraction.java script for this functionality. cleanUpFields() is the method in the script to replace characters with EMPTY string.

Please follow the steps below as a work around.

  1. Go to <ephesoft installation>\SharedFolders\<batch class ID>\scripts
  2. Take back up of ScriptExtraction.java file then edit file.
  3. Add highlighted line in execute method.
    public Object execute(Document documentFile, String methodName, String docIdentifier) {
                          Exception exception = null;
                          try {
                                          LOGGER.info("*************  Inside ScriptExtraction scripts.");
                                          LOGGER.info("*************  Start execution of the ScriptExtraction scripts.");
                                          cleanUpFields(documentFile);
                                          if (null == documentFile) {
                                                          LOGGER.error("Input document is null.");
                                          }
                                          boolean isWrite = false;
    
                          // Write the document object to the xml file. Currently following IF block is commented for performance improvement.
                          /*if (isWrite) {                                                                    
                                          writeToXML(documentFile);
                                          LOGGER.info("*************  Successfully write the xml file for the ScriptExtraction scripts.");
                                          LOGGER.info("*************  End execution of the ScriptExtraction scripts.");
                          }*/
                          } catch (Exception e) {
                                          LOGGER.error("*************  Error occurred in scripts." + e.getMessage());
                                          exception = e;
                          }
                          return null;
          }
    

    This is new method that needs to be added in script. Replace ‘-‘ with the character you want to replace with empty.

    private void cleanUpFields(Document document) { 
                    Element root = document.getRootElement();
                    List docList = root.getChild("Documents").getChildren("Document");
                    for (Element doc : docList) {
                                    List dlf = doc.getChild("DocumentLevelFields").getChildren("DocumentLevelField");
                                    for (int i = 0; i < dlf.size(); i++) {
                                                    Element field = dlf.get(i);
                                                    if (field != null) {
                                                                    Element valueE = field.getChild("Value");                                                                              
                                                                    if (valueE != null) {
                                                                                    String valueT = valueE.getText();                                                                                               
                                                                                    if (!valueT.isEmpty()) {                                                                                                   
                                                                                                    valueT = valueT.replaceAll("-", "");
                                                                                                    valueE.setText(valueT);                                                                                                    
                                                                                    }
                                                                    }
                                                    }
                                    }
                    }
    }

  4. Save file and restart batch.

 

 

Documentation Main Page | How To Articles | Downloads and Updates |

 

Was this article helpful to you?

Kip Path

Comments are closed.