|
| how to call "On No Match" hook |
 |
Mon, 17 Dec 2007 11:25:09 +010 |
Hello,
I am unable to call "On No Match" hook from my Script Connector (it
calls
SAP RFC) in Lookup mode. If there is no entry it returns one row, if there
is one ore more entries witch suits link criteria it returns two or more
rows. But there is no difference in summary of Assembly Line, and "On No
Match" hook is never used - but .
Please help.
Thank you
Script Connector snippet:
var response = new
java.lang.String(result.getAttribute("response"));
var ary_resp = response.split("\\|*item[0-9]{1,}:");
var len = ary_resp.length;
// no data
if (len < 2) {
task.logmsg("No entry");
return;
}
task.getConnector("LookupSAP").connector.clearFindEntries();
// one entry
if (len == 2) {
var ary_cols = ary_resp[1].split("\\|");
for (i = 0; i < ary_cols.length; i++) {
var ary_row = ary_cols[i].split(":");
if (ary_row[1]) {
entry.setAttribute(ary_row[0],ary_row[1]);
}
}
return(entry);
}
|
| Post Reply
|
| Re: how to call "On No Match" hook |
 |
Thu, 17 Jan 2008 18:46:01 +010 |
Milos,
to trigger 'on no match' your scripted connector should not do a
return;
as you do, but instead a
result.setStatus(0);
and optionnaly, for example:
result.setMessage("Not found");
This is detailled in the reference guide, in the section about
developping your own connectors.
Cheers,
Christian
Milo¹ Hurdálek wrote:
> Hello,
>
> I am unable to call "On No Match" hook from my Script Connector
(it calls
> SAP RFC) in Lookup mode. If there is no entry it returns one row, if there
> is one ore more entries witch suits link criteria it returns two or more
> rows. But there is no difference in summary of Assembly Line, and "On
No
> Match" hook is never used - but .
>
> Please help.
>
> Thank you
>
> Script Connector snippet:
>
> var response = new
java.lang.String(result.getAttribute("response"));
> var ary_resp = response.split("\\|*item[0-9]{1,}:");
> var len = ary_resp.length;
>
> // no data
> if (len < 2) {
> task.logmsg("No entry");
> return;
> }
>
> task.getConnector("LookupSAP").connector.clearFindEntries();
>
> // one entry
> if (len == 2) {
> var ary_cols = ary_resp[1].split("\\|");
> for (i = 0; i < ary_cols.length; i++) {
> var ary_row = ary_cols[i].split(":");
> if (ary_row[1]) {
> entry.setAttribute(ary_row[0],ary_row[1]);
> }
> }
> return(entry);
> }
>
|
| Post Reply
|
|
|
|
|
|
|
|
|
|