任务:ESQL中字符串处理
1.继续沿用上次的工程,注意修改两个Label节点的Label Name为汉字形式,并改写Compute节点的ESQL如下:
CREATE COMPUTE MODULE flow_Compute
CREATE FUNCTION Main() RETURNS BOOLEAN
BEGIN
DECLARE Address CHARACTER;
DECLARE Addresses CHARACTER InputRoot.XML.mail.address;
DECLARE I INTEGER 0;
DECLARE J INTEGER;
DECLARE LEN INTEGER LENGTH(Addresses);
WHILE (I<LEN) DO
SET OutputRoot = InputRoot;
SET J=I+1;
SET Address=SUBSTRING(Addresses FROM J FOR 2);
SET OutputLocalEnvironment.Destination.RouterList.DestinationData[1].labelName = Address;
PROPAGATE;
SET I=J+2;
END WHILE;
RETURN FALSE;
END;
END MODULE;
2.将以下文本传入InQ:
<mail><id>0001</id><address>大连/上海</address></mail>
3.OutQ和OutQ1都将收到信息,如下图显示。
4.本例工程下载地址
http://www.blogjava.net/Files/heyang/InputOutputTest0919.rar-The End-