Skip to main content

In the following dataweave

 

%dw 2.0

output application/json

var location = attributes.headers.location default '' splitBy'/'

---

{

   id: location[sizeOf(location) -1],

   firstName: vars.userCreationJson.firstName,

   lastName: vars.userCreationJson.lastName,

   email: vars.userCreationJson.email,

   password: vars.password,

   requiredActions: ['UPDATE PASSWORD']

}

 

var location = attributes.headers.location default '' splitBy'/' has an error of Unable to resolve reference of splitBy.

 

 id: location[sizeOf(location) -1] has an error of Unable to resolve reference of sizeOf.

 

The output is a defined example, the input is not.

 

I am not sure if I am doing the dataweave wrong or it is just a "phantom" error since the dataweave itself returns what I am looking for. ie the last element in the url

 

Speaking of which is there a better way of getting the id from the end of a location url?

 

ie http://thisurl.com/something/something/25356653 <-id

2 respostas
  1. 6 de out. de 2020, 15:45

    Hi,

     

    Your dataweave logic is correct and its working.

    It might be a fatal error which you can ignore.

    Or

    just once check if all the inputs are passed correctly.

     

    Regards,

    Abhishek Bathwal

0/9000