Continuing on Error

In cases where no value is found by a Query, you can use the NotFound parameter to control the consequent behavior of the script. The value of NotFound can be one of:

Error: the default value, causing an error and script execution to cease

Continue: execution continues, and no error is issued. A warning message is sent to the Execution Log window.


The following example attempts to insert an XML fragment into an XML string, but the query fails because it cannot find the tag /acme_org/department/employee. The script would terminate at this point if the default NotFound behavior of Error was in effect. However, the lr.xmlInsert call specifies NotFound=Continue, and script execution continues to the next statement, lr.outputMessage.

#include "as_web.h"

char *xml_input =
          " <name>John Smith</name>"

Action() {

     lr.saveString(xml_input, "XML_Input_Param");

     lr.xmlInsert("XML={XML_Input_Param}", "ResultParam=Result",
          "NotFound=Continue", LAST );

     lr.outputMessage("Reached here");

     return 0;

Example: Output:
Action.c(15): Warning: "lr.xmlInsert" found no matches
Action.c(21): Reached here