Problem faced in using 'with' in eScript.
Hi All,
Following is the piece of code written in applet server script preinvoke event.
I have checked the logs, in the above script, search spec is formed correctly. Ouery triggered in the log returns 1 row. So FirstRecord() should return "true" right?? But the value obtained in "isRec" is "false".
And if I remove "with" and use the normal way object.method()", then FirstRecord() returns true.
Following is the piece of code written in applet server script preinvoke event.
function WebApplet_PreInvokeMethod (MethodName)
{
{
if(MethodName == "ApplyCC")
{
{
var bcDiscMtrx=TheApplication().GetBusObject("Adj ustment Group").GetBusComp("Product-Based Adjustment");
with(bcDiscMtrx)
{
with(bcDiscMtrx)
{
ClearToQuery();
SetViewMode(AllView);
ActivateField("Field1");
ActivateField("Field2");
strSearchVar= "<valid search spec>";
SetSearchExpr(strSearchVar);
ExecuteQuery(ForwardOnly);
var isRec=FirstRecord();
if(!isRec)
{
TheApplication().RaiseError("ERROR_MESSAGE_1");
}
SetViewMode(AllView);
ActivateField("Field1");
ActivateField("Field2");
strSearchVar= "<valid search spec>";
SetSearchExpr(strSearchVar);
ExecuteQuery(ForwardOnly);
var isRec=FirstRecord();
if(!isRec)
{
TheApplication().RaiseError("ERROR_MESSAGE_1");
}
}
}}
I have checked the logs, in the above script, search spec is formed correctly. Ouery triggered in the log returns 1 row. So FirstRecord() should return "true" right?? But the value obtained in "isRec" is "false".
And if I remove "with" and use the normal way object.method()", then FirstRecord() returns true.
0