Idea ID: 1771094

Add error messages to return from RAD format.ctrl.exec

Status : Delivered
over 2 years ago

When running format control from JS – need to return bad validations messages to results, now messages from fc only appears in messages.

      cFormatControls = {}; 
      var cRetStructure = {"exit": null, "file": null, "message": null}
      cFormatControls["device"] = new SCFile("formatctrl", SCFILE_READONLY);
      cFormatControls["device"].doSelect("name=\"device\""); 
cFormatControls["device"]["validation.popup"]=false;

      var argNames = new SCDatum(); argNames.setType(8);
      var argVals = new SCDatum(); argVals.setType(8);
      var argTypes = new SCDatum(); argTypes.setType(8);
      var results = new SCDatum(); results.setType(8);

            argNames.push("file");  // fFile
            argVals.push(fDeviceFile);
            argTypes.push(6);

            argNames.push("record"); // file Format Control
            argVals.push(fFormatCtrl1);
            argTypes.push(6);

            argNames.push("target.file"); // file Master Format Control
            argVals.push(cFormatControls["device"]);
            argTypes.push(6);

            argNames.push("name"); // Action
            argVals.push("update");
            argTypes.push(2);

            argNames.push("text"); // result
            argVals.push(null);
            argTypes.push(2);

            argNames.push("second.file"); // old file
            argVals.push();
            argTypes.push(6);

            results.push("text");
            results.push("file");
            results.push("messages");

      var radResults = lib.RAD.run("format.ctrl.exec", argNames, argVals, argTypes, results);
      
      cRetStructure["exit"] = system.functions.val(radResults.results[0], 2); //"badval";//
      cRetStructure["file"] = radResults.results[1];
      cRetStructure["message"] = radResults.messages; // this object empty, add messages here