Hi,
Tried to explain little more.I have to append a random number to "too many ids" 
present in my request.
Actual request consists of thousands of lines and there are many ids in it.
some ids are within array , some are direct elements.sample input : {  "id" : 
"1",   {    "id":"2"      }}
I think this could be achieved by doing following for each id present in 
request.
1.  by first acessing the id in a property say property1.2. Then generating the 
random Number in property2.3. Then creating third property, to where i assign 
value of "property1 + property2" to  property3.5. Then assign property 3 to 
first id in request using enrich mediator.
But I think this is not ideal way to do it. Since I have to do it for many id's 
in request.There should be some way to enrich request directly using one enrich 
mediator somewhat  like below
$body.Lookups.$id = $body.Lookups.$id +  get-property('randomNumber');
For below sample input 

Suppose in this loop the randomNumber generated is 100 and kept in property1.
{  "id" : "1",   {    "id":"2"      }   .   .   .   .   "id"="100"}
sample output should be like below :
{  "id" : "1100",   {    "id":"2100"      }   .   .   .   .   "id": "100100"}
i.e. original value + "100"
i.e. I need to add suffix at the end of each id in request.
Please guide.
Thanks,


 

    On Tuesday, 16 January 2018 12:17 PM, vikram nayak <[email protected]> 
wrote:
 

 Hi,
I have to add a random number to too many ids present in my request.
Actual request consists of thousands of lines and there are many ids in it.
some ids are within array , some are direct elements.
{  "id" : "1",   {    "id":"2"   }}
1. I can do this by first aceessing the id in a property say property1.2. Then 
generating the random Number in property2.3. Then creating third property, to 
where i assign value of property1 + property2 to  property3.5. Then assign 
property 3 to first id in request using enrich mediator.
But I think this is not ideal way to do it. Since I have to do it for many id's 
in request.There should be some way to enrich request directly using one enrich 
mediator
$body.Lookups.$id = $body.Lookups.$id +  get-property('randomNumber');
Thanks

   
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to