Check if .text file name preceeded with oru or not

Question: my task is if file name contains oru*.txt then go to target other wise directly go to end activity

how can i do this?


Solution: I assume that you have put the coming filename in the process flow context.
set the coming filename in the context with ‘fileName’ variable and try using the below sample code(you can modify as per your requirement) in gateway java condition:

String fileName = context.get("fileName");
String prefixFileName = fileName.substring(0, 3);
int fileExtensionPositon = fileName.lastIndexOf(".");
String fileExtension = fileName.substring(fileExtensionPositon+1, fileName.length());
if(prefixFileName.equalsIgnoreCase("oru") && fileExtension.equalsIgnoreCase("txt"))
{
return true;
}
else {
return false;
}

Have more questions? Submit a request

0 Comments

Article is closed for comments.