Árvore de páginas

Versões comparadas

Chave

  • Esta linha foi adicionada.
  • Esta linha foi removida.
  • A formatação mudou.
HTML

<div id="main-content" class="wiki-content group">
	<p>
		Data update in Protheus is also performed via WebServices as seen in
		the validation using the <strong>afterProcessFinish</strong> process
		event that is run at the end of the request.
	</p>
	<p>&#160;</p>
	<blockquote>
		<p>
			function <strong>afterProcessFinish</strong>(processId){
		</p>
		<p>var wsService = ServiceManager.getService("WSCLIENTE");</p>
		<p>var serviceHelper = wsService.getBean();</p>
		<p>var serviceLocator =
			serviceHelper.instantiate("localhost.WSCLIENTELocator");</p>
		<p>var service = serviceLocator.getWSCLIENTESOAP();</p>
		<p>var SA1 = new XML("&lt;SA1/>");</p>
		<p>&#160;</p>
		<p>SA1.A1_COD = hAPI.getCardValue("A1_COD");</p>
		<p>SA1.A1_LOJA = hAPI.getCardValue("A1_LOJA");</p>
		<p>SA1.A1_TIPO = hAPI.getCardValue("A1_TIPO");</p>
		<p>SA1.A1_PESSOA = hAPI.getCardValue("A1_PESSOA");</p>
		<p>SA1.A1_NOME = hAPI.getCardValue("A1_NOME");</p>
		<p>SA1.A1_NREDUZ = hAPI.getCardValue("A1_NREDUZ");</p>
		<p>SA1.A1_END = hAPI.getCardValue("A1_END");</p>
		<p>SA1.A1_MUN = hAPI.getCardValue("A1_MUN");</p>
		<p>SA1.A1_EST = hAPI.getCardValue("A1_EST");</p>
		<p>&#160;</p>
		<p>try {</p>
		<p>
			&#160;&#160; ret = service.<strong>INCLUIR</strong>(new
			java.lang.String(SA1.toXMLString()).getBytes());
		</p>
		<p>}</p>
		<p>catch(erro){</p>
		<p>&#160;&#160; throw erro.message</p>
		<p>}</p>
		<p>}</p>
	</blockquote>
	<h1 id="id-2.4AtualizaçãodoProtheus-MVC">MVC</h1>
	<p>
		The validation process of a MVC routine is also performed using the
		FWWSMODEL WebService (<a
			href="http://hostexemplo:8080/ws/fwwsmodel.apw?wsdl"
			class="external-link" rel="nofollow">http://hostexemplo:8080/ws/fwwsmodel.apw?wsdl</a>)
		with the invocation of the <strong>GETXMLDATADETAIL</strong> method
		that returns the XML of the model to populate the data and the <strong>PUTXMLDATA</strong>
		method to save the XML.
	</p>
	<p>&#160;</p>
	<blockquote>
		<p>
			function <strong>afterProcessFinish</strong>(processId){
		</p>
		<p>var wsService = ServiceManager.getService("TOTVS_FWMVC");</p>
		<p>var serviceHelper = wsService.getBean();</p>
		<p>var serviceLocator =
			serviceHelper.instantiate("br.com.totvs.webservices.fwwsmodel_apw.FWWSMODELLocator");</p>
		<p>var service = serviceLocator.getFWWSMODELSOAP();</p>
		<p>
			var err = {message:"", <a href="http://emptytrue"
				class="external-link" rel="nofollow">empty:true</a>};
		</p>
		<p>var ret, xml;</p>
		<p>&#160;</p>
		<p>try {</p>
		<p>
			&#160;&#160; ret = service.<strong>GETXMLDATADETAIL</strong>([],"MATA030_MVC");
		</p>
		<p>&#160;&#160; xml = new XML(new String(new
			java.lang.String(ret)).replace(/&lt;\?.*\?>/g,""));</p>
		<p>}</p>
		<p>catch(erro){</p>
		<p>&#160;&#160; throw erro.message;</p>
		<p>&#160;&#160; return;</p>
		<p>}</p>
		<p>&#160;</p>
		<p>updateXMLFields(xml,err);</p>
		<p>&#160;</p>
		<p>eval("xml.@Operation = 3");</p>
		<p>try{</p>
		<p>
			&#160;&#160; service.<strong>PUTXMLDATA</strong>([],"MATA030_MVC",new
			java.lang.String(xml.toXMLString()).getBytes());
		</p>
		<p>} catch(e){</p>
		<p>&#160;&#160; throw e.message;</p>
		<p>}</p>
		<p>}</p>
		<p>&#160;</p>
		<p>function updateXMLFields(node,err){</p>
		<p>var list = node.children();</p>
		<p>var name,value;</p>
		<p>&#160;</p>
		<p>for (var i=0;i&lt;list.length();i++){</p>
		<p>&#160;&#160; switch
			(Trim(eval("list[i][email protected]()"))){</p>
		<p>&#160;&#160;&#160;&#160;&#160; case "FIELDS":</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;
			updateXMLFields(list[i],err);</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; break;</p>
		<p>&#160;&#160;&#160;&#160;&#160; default:</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; name =
			list[i].name().localName;</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; value =
			hAPI.getCardValue(name);</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if (value !=
			null)</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;
			list[i].value = convertValue(name,list[i],value,err);</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; break;</p>
		<p>&#160;&#160; }</p>
		<p>&#160;&#160; if (err.message.length > 0)</p>
		<p>&#160;&#160;&#160;&#160;&#160; break;</p>
		<p>}</p>
		<p>}</p>
		<p>&#160;</p>
		<p>function convertValue(name,struct,value,err){</p>
		<p>var y,m,d,n,len,str,reg</p>
		<p>var setYear = new
			Date().getFullYear().toString().substring(0,2);</p>
		<p>var setDate = "dd/mm/yyyy";</p>
		<p>var yCount = setDate.match(/yyyy/) ? 4 : 2;</p>
		<p>var hasErr = false;</p>
		<p>&#160;</p>
		<p>value = value.trim();</p>
		<p>&#160;</p>
		<p>switch (eval("[email protected]()")){</p>
		<p>case "D":</p>
		<p>&#160;&#160; if (value.replace("/","").trim() != ""){</p>
		<p>&#160;&#160;&#160;&#160;&#160; len = value.length();</p>
		<p>&#160;&#160;&#160;&#160;&#160; d = setDate.indexOf("d");</p>
		<p>&#160;&#160;&#160;&#160;&#160; m = setDate.indexOf("m");</p>
		<p>&#160;&#160;&#160;&#160;&#160; y = setDate.indexOf("y");</p>
		<p>&#160;</p>
		<p>&#160;&#160;&#160;&#160;&#160; if (d + 2 > len || m + 2 > len
			|| y + yCount > len){</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; hasErr = true;</p>
		<p>&#160;&#160;&#160;&#160;&#160; }</p>
		<p>&#160;&#160;&#160;&#160;&#160; else{</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; str =
			value.substr(m,2) + value.substr(d,2);</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if (yCount ==
			4)</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;
			str = value.substr(y,4) + str;</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; else</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;
			str = setYear + value.substr(y,2) + str;</p>
		<p>&#160;</p>
		<p align="left">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;
			if
			(str.match(/((((19|20)(([02468][048])|([13579][26]))0229))|((19|20)[0-9][0-9])((((0[1-9])|(1[0-2]))((0[1-9])|(1\d)|(2[0-8])))|((((0[13578])|(1[02]))31)|(((0[1,3-9])|(1[0-2]))(29|30)))))/g))</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;
			value = new java.lang.String(str);</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;else</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;
			hasErr = true;</p>
		<p>&#160;&#160;&#160;&#160;&#160; }</p>
		<p>&#160;</p>
		<p>&#160;&#160;&#160;&#160;&#160; if (hasErr)</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; err.message =
			"The field "+eval("struct.@info")+" ("+name+") has an invalid date";</p>
		<p>&#160;&#160;&#160;&#160;&#160; else</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; err.empty =
			false;</p>
		<p>&#160;&#160; }</p>
		<p>&#160;&#160; break;</p>
		<p>case "N":</p>
		<p>&#160;&#160; len = eval("[email protected]().split(',')");</p>
		<p>&#160;&#160; if (len[1] == "0"){</p>
		<p>&#160;&#160;&#160;&#160;&#160; reg = new
			RegExp("^[0-9]{1,"+len[0]+"}$");</p>
		<p>&#160;&#160;&#160;&#160;&#160; str = value.replace(",","");</p>
		<p>&#160;&#160;&#160;&#160;&#160; if(!reg.test(str)){</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; str =
			value.replace(".","");</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;
			if(!reg.test(str)){</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;
			err.message = "The field "+eval("struct.@info")+" ("+name+") has an
			invalid number (value or size)"</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;
			hasErr = true;</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;
			break;</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</p>
		<p>&#160;&#160;&#160;&#160;&#160; }</p>
		<p>&#160;</p>
		<p>&#160;&#160;&#160;&#160;&#160; if (!hasErr){</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; n =
			parseInt(str);</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if
			(!isNaN(n)){</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;
			value = new java.lang.String(str);</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;
			if (n > 0)</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;
			err.empty = false;</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</p>
		<p>&#160;&#160;&#160;&#160;&#160; }</p>
		<p>&#160;&#160; }</p>
		<p>&#160;&#160; else{</p>
		<p>&#160;&#160;&#160;&#160;&#160; reg = new
			RegExp("^0$|^0\.[0-9]{1,"+len[1]+"}$|^[0-9]{0,"+len[0]+"}(\.[0-9]{1,"+len[1]+"})?$");</p>
		<p>&#160;&#160;&#160;&#160;&#160; str =
			value.replace(".","").replace(",",".");</p>
		<p>&#160;&#160;&#160;&#160;&#160; if(!reg.test(str)){</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; str =
			value.replace(",","");</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;
			if(!reg.test(str)){</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;
			err.message = "The field "+eval("struct.@info")+" ("+name+") has an
			invalid number (value or size)"</p>
		<p>&#160;&#160;&#160;&#160;&#160;
			&#160;&#160;&#160;&#160;&#160;&#160;hasErr = true;</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;
			break;</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</p>
		<p>&#160;&#160;&#160;&#160;&#160; }</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;</p>
		<p>&#160;&#160;&#160;&#160;&#160; if (!hasErr){</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; n =
			parseFloat(str);</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if
			(!isNaN(n)){</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;
			value = new java.lang.String(str);</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;
			if (n > 0)</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;
			err.empty = false;</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</p>
		<p>&#160;&#160;&#160;&#160;&#160; }</p>
		<p>&#160;&#160; }</p>
		<p>&#160;&#160; break;</p>
		<p>default:</p>
		<p>&#160;&#160; if (value != "")</p>
		<p>&#160;&#160;&#160;&#160;&#160; err.empty = false;</p>
		<p>&#160;&#160; break;</p>
		<p>}</p>
		<p>return value;</p>
		<p>}</p>
		<p>function Trim(str){return str.replace(/^\s+|\s+$/g,"");}</p>
	</blockquote>
	<p>&#160;</p>
	<h1 id="id-2.4AtualizaçãodoProtheus-RotinaAutomática(Modelo1)">Automatic
		Routine (Model 1)</h1>
	<p>
		Since automatic routines perform the update after validation, instead
		of using the <strong>afterProcessFinish event, use the
			beforeTaskSave event when the process is in the end activity. In
			addition to the MVC WebService, also use </strong>the <strong>FWWSMODEL</strong>
		(<a href="http://hostexemplo:8080/ws/fwwsecm.apw?wsdl"
			class="external-link" rel="nofollow">http://hostexemplo:8080/ws/fwwsecm.apw?wsdl</a>)
		by calling the <strong>PUTDATA</strong> method.
	</p>
	<p>&#160;</p>
	<blockquote>
		<p>#include "totvs.ch"</p>
		<p>User Function WSMVC()</p>
		<p>Local cName := "TOTVS_FWWSECM"</p>
		<p>
			Local cURL := "<a href="http://hostname:8080/ws/fwwsecm.apw?wsdl"
				class="external-link" rel="nofollow">http://hostname:8080/ws/fwwsecm.apw?wsdl</a>"
		</p>
		<p align="left">Local cDescription := "TOTVS Microsiga Protheus
			service for integrating automatic routines with ECM"</p>
		<p>Local aService := FWWFGetService(cName)</p>
		<p>&#160;</p>
		<p>
			If Empty(aService) .and. <strong>FWWFPutService(cName,cUrl,cDescription)</strong>
		</p>
		<p>&#160;&#160; MsgInfo("Service successfully registered")</p>
		<p>EndIf</p>
		<p>Return</p>
		<p>&#160;</p>
		<p>
			<strong>beforeTaskSave</strong> event:
		</p>
		<p>&#160;</p>
		<p>
			function <strong>beforeTaskSave</strong>(colleagueId,nextSequenceId,userList){
		</p>
		<p>var wsService = ServiceManager.getService("TOTVS_FWMVC");</p>
		<p>var serviceHelper = wsService.getBean();</p>
		<p align="left">var serviceLocator =
			serviceHelper.instantiate("br.com.totvs.webservices.fwwsmodel_apw.FWWSMODELLocator");</p>
		<p>var service = serviceLocator.getFWWSMODELSOAP();</p>
		<p>
			var err = {message:"", <a href="http://emptytrue"
				class="external-link" rel="nofollow">empty:true</a>};
		</p>
		<p>var ret, xml;</p>
		<p>&#160;</p>
		<p>try {</p>
		<p>
			&#160;&#160; ret = service.<strong>GETXMLDATADETAIL</strong>([],"MATA030_MVC");
		</p>
		<p>&#160;&#160; xml = new XML(new String(new
			java.lang.String(ret)).replace(/&lt;\?.*\?>/g,""));</p>
		<p>}</p>
		<p>catch(erro){</p>
		<p>&#160;&#160; throw erro.message;</p>
		<p>&#160;&#160; return;</p>
		<p>}</p>
		<p>&#160;</p>
		<p>updateXMLFields(xml,err);</p>
		<p>&#160;</p>
		<p>if (err.message.length > 0){</p>
		<p>&#160;&#160; throw err.message;</p>
		<p>}</p>
		<p>else if (err.empty){</p>
		<p>&#160;&#160; throw "Fill out form";</p>
		<p>}</p>
		<p>else{</p>
		<p>&#160;&#160; wsService =
			ServiceManager.getService("TOTVS_FWWSECM");</p>
		<p>&#160;&#160; serviceHelper = wsService.getBean();</p>
		<p align="left">&#160;&#160; serviceLocator =
			serviceHelper.instantiate("br.com.totvs.webservices.fwwsecm_apw.FWWSECMLocator");</p>
		<p>&#160;&#160; service = serviceLocator.getFWWSMODELSOAP();</p>
		<p>&#160;</p>
		<p>&#160;&#160; eval("xml.@Operation = 3");</p>
		<p>&#160;&#160; try{</p>
		<p>
			&#160;&#160;&#160;&#160;&#160; service.<strong>PUTDATA</strong>([],"SA1","MATA030",new
			java.lang.String(xml.toXMLString()).getBytes());;
		</p>
		<p>&#160;&#160; } catch(e){</p>
		<p>&#160;&#160;&#160;&#160;&#160; throw e.message;</p>
		<p>&#160;&#160; }</p>
		<p>}</p>
		<p>}</p>
		<p>&#160;</p>
		<p>function updateXMLFields(node,err){</p>
		<p>var list = node.children();</p>
		<p>var name,value;</p>
		<p>&#160;</p>
		<p>for (var i=0;i&lt;list.length();i++){</p>
		<p>&#160;&#160; switch
			(Trim(eval("list[i][email protected]()"))){</p>
		<p>&#160;&#160;&#160;&#160;&#160; case "FIELDS":</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;
			updateXMLFields(list[i],err);</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; break;</p>
		<p>&#160;&#160;&#160;&#160;&#160; default:</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; name =
			list[i].name().localName;</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; value =
			hAPI.getCardValue(name);</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if (value !=
			null)</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;
			list[i].value = convertValue(name,list[i],value,err);</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; break;</p>
		<p>&#160;&#160; }</p>
		<p>&#160;&#160; if (err.message.length > 0)</p>
		<p>&#160;&#160;&#160;&#160;&#160; break;</p>
		<p>}</p>
		<p>}</p>
		<p>&#160;</p>
		<p>function convertValue(name,struct,value,err){</p>
		<p>var y,m,d,n,len,str,reg</p>
		<p>var setYear = new
			Date().getFullYear().toString().substring(0,2);</p>
		<p>var setDate = "dd/mm/yyyy";</p>
		<p>var yCount = setDate.match(/yyyy/) ? 4 : 2;</p>
		<p>var hasErr = false;</p>
		<p>&#160;</p>
		<p>value = value.trim();</p>
		<p>&#160;</p>
		<p>switch (eval("[email protected]()")){</p>
		<p>case "D":</p>
		<p>&#160;&#160; if (value.replace("/","").trim() != ""){</p>
		<p>&#160;&#160;&#160;&#160;&#160; len = value.length();</p>
		<p>&#160;&#160;&#160;&#160;&#160; d = setDate.indexOf("d");</p>
		<p>&#160;&#160;&#160;&#160;&#160; m = setDate.indexOf("m");</p>
		<p>&#160;&#160;&#160;&#160;&#160; y = setDate.indexOf("y");</p>
		<p>&#160;</p>
		<p>&#160;&#160;&#160;&#160;&#160; if (d + 2 > len || m + 2 > len
			|| y + yCount > len){</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; hasErr = true;</p>
		<p>&#160;&#160;&#160;&#160;&#160; }</p>
		<p>&#160;&#160;&#160;&#160;&#160; else{</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; str =
			value.substr(m,2) + value.substr(d,2);</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if (yCount ==
			4)</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;
			str = value.substr(y,4) + str;</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; else</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;
			str = setYear + value.substr(y,2) + str;</p>
		<p>&#160;</p>
		<p align="left">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;
			if
			(str.match(/((((19|20)(([02468][048])|([13579][26]))0229))|((19|20)[0-9][0-9])((((0[1-9])|(1[0-2]))((0[1-9])|(1\d)|(2[0-8])))|((((0[13578])|(1[02]))31)|(((0[1,3-9])|(1[0-2]))(29|30)))))/g))</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;
			value = new java.lang.String(str);</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; else</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;
			hasErr = true;</p>
		<p>&#160;&#160;&#160;&#160;&#160; }</p>
		<p>&#160;</p>
		<p>&#160; &#160;&#160;&#160;&#160;if (hasErr)</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; err.message =
			"The field "+eval("struct.@info")+" ("+name+") has an invalid date";</p>
		<p>&#160;&#160;&#160;&#160;&#160; else</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; err.empty =
			false;</p>
		<p>&#160;&#160; }</p>
		<p>&#160;&#160; break;</p>
		<p>case "N":</p>
		<p>&#160;&#160; len = eval("[email protected]().split(',')");</p>
		<p>&#160;&#160; if (len[1] == "0"){</p>
		<p>&#160;&#160;&#160;&#160;&#160; reg = new
			RegExp("^[0-9]{1,"+len[0]+"}$");</p>
		<p>&#160;&#160;&#160;&#160;&#160; str = value.replace(",","");</p>
		<p>&#160;&#160;&#160;&#160;&#160; if(!reg.test(str)){</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; str =
			value.replace(".","");</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;
			if(!reg.test(str)){</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;
			err.message = "The field "+eval("struct.@info")+" ("+name+") has an
			invalid number (value or size)"</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;
			hasErr = true;</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;
			break;</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</p>
		<p>&#160;&#160;&#160;&#160;&#160; }</p>
		<p>&#160;</p>
		<p>&#160;&#160;&#160;&#160;&#160; if (!hasErr){</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; n =
			parseInt(str);</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if
			(!isNaN(n)){</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;
			value = new java.lang.String(str);</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;
			if (n > 0)</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;
			err.empty = false;</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</p>
		<p>&#160;&#160;&#160;&#160;&#160; }</p>
		<p>&#160;&#160; }</p>
		<p>&#160;&#160; else{</p>
		<p>&#160;&#160;&#160;&#160;&#160; reg = new
			RegExp("^0$|^0\.[0-9]{1,"+len[1]+"}$|^[0-9]{0,"+len[0]+"}(\.[0-9]{1,"+len[1]+"})?$");</p>
		<p>&#160;&#160;&#160;&#160;&#160; str =
			value.replace(".","").replace(",",".");</p>
		<p>&#160;&#160;&#160;&#160;&#160; if(!reg.test(str)){</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; str =
			value.replace(",","");</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;
			if(!reg.test(str)){</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;
			err.message = "The field "+eval("struct.@info")+" ("+name+") has an
			invalid number (value or size)"</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;
			hasErr = true;</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;
			break;</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</p>
		<p>&#160;&#160;&#160;&#160;&#160; }</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;</p>
		<p>&#160;&#160;&#160;&#160;&#160; if (!hasErr){</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; n =
			parseFloat(str);</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if
			(!isNaN(n)){</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;
			value = new java.lang.String(str);</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;
			if (n > 0)</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;
			err.empty = false;</p>
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</p>
		<p>&#160;&#160;&#160;&#160;&#160; }</p>
		<p>&#160;&#160; }</p>
		<p>&#160;&#160; break;</p>
		<p>default:</p>
		<p>&#160;&#160; if (value != "")</p>
		<p>&#160;&#160;&#160;&#160;&#160; err.empty = false;</p>
		<p>&#160;&#160; break;</p>
		<p>}</p>
		<p>return value;</p>
		<p>}</p>
		<p>function Trim(str){return str.replace(/^\s+|\s+$/g,"");}</p>
	</blockquote>
	<p>&#160;</p>
	<p>&#160;</p>
	<p>&#160;</p>
</div>