Monday, 24 December 2018

Use of SELECT statement in esql


                      Using ESQL SELECT statement



The SELECT function combines, filters, and transforms complex message and database data.



Input xml:
-------------
<Person>
 <Details>
  <ID>1</ID>
  <Name>Arun</Name>
 </Details>
 <Details>
  <ID>5</ID>
  <Name>Shyam</Name>
 </Details>
 <Details>
  <ID>1</ID>
  <Name>Arun</Name>
 </Details>
 <Details>
  <ID>3</ID>
  <Name>Priyesh</Name>
 </Details>
</Person>

Scenario :
------------
From above input we need name when ID=5.
To get this, the best approach in esql is bellow -

Solution :
------------

--Declare a reference to the root.
DECLARE InRef REFERENCE TO InputRoot.XMLNSC.Person;
--Now assign the value to output using select function 
SET OutputRoot.XMLNSC.Data.Person.Name = THE(select item fieldvalue(r.Name) from InRef.Details[] as r where r.ID = 5);




No comments:

Post a Comment

Sending file as multi-part MIME over http in ACE - esql

  How to send a file over http as a multipart mime? Below are the steps to do that - 1. Make sure you have the data encryption in place for ...