I am using Mule 4 and Anypoint Studio 7.
I am looking at renaming the file that I'm processing with the timestamp that it has been processed. So test.csv becomes test+2019-01-30T16:32:56.95Z.csv.
My issue is that it appears to work when I run the application but there is an error showing against the "Set Variable" component where I set the create filename to use by using the expression below:
#["myfolder/" ++ (payload.key splitBy("."))[0] ++ "+" ++ now() ++ "." ++ (payload.key splitBy("."))[1]]
The error message that I see on the "Set Variable" component is:
Unable to call any overload of function `splitBy` with arguments (String | Null, String) overloads:
- splitBy(text: String, separator: String) -> Array<String> reason:
- Expecting Type: String, but got: Null.
TIP: Try using `default` operator to avoid nullable objects.
TIP: Use `!` value selector modifier to assert that an optional field is always present.
- splitBy(text: String, regex: Regex) -> Array<String> reason:
- Expecting Type: String, but got: Null.
TIP: Try using `default` operator to avoid nullable objects.
TIP: Use `!` value selector modifier to assert that an optional field is always present.
- Expecting Type: Regex, but got: String.
How can I resolve this error? I have tried the tips to use default but the error still shows.
Thanks