cancel
Showing results for 
Search instead for 
Did you mean: 

capture filename from azure storage adapter

mvalicpi40
Explorer
0 Kudos

Hi Team,

can anyone throw some thoughts on how to retain the filename coming from AzureStorage sender adapter and send it to S4 (SFTP)

i tried using content modifier and groovy scripts but not able to get the expected result.

Under Exchange properties i am getting as below

 

Lock NameMass_Order_Participant_19gfpaqj9fptegx7vbaacpbh/MassOrderUpload/testtxtfile.txt

i need to capture testtxtfile.txt 

Any thoughts?

View Entire Topic
alex_bundschuh
Product and Topic Expert
Product and Topic Expert
0 Kudos

try this groovy script assuming that the complete file name path is stored in the exchange property completePath

import com.sap.gateway.ip.core.customdev.util.Message;
import java.util.HashMap;
def Message processData(Message message) {
//Body
def body = message.getBody();
//Properties
def properties = message.getProperties();
completePath = properties.get("completePath");

//split fullname
String[] vCompletePath;
vCompletePath = completePath.split('/');
//set properties
message.setProperty("filename", vCompletePath[vCompletePath.length-1]);

return message;

}

Alex

mvalicpi40
Explorer
0 Kudos

Hi Alex,

your solution worked thank you.

I have another question , what if the blob path places different filenames like below

1234_massorder.txt

5678_massorder.txt

how to define my path in content modifier exchange property.

as of now i defined as Mass_Order_Participant_19gfpaqj9fptegx7vbaacpbh/MassOrderUpload/testtxtfile.txt

Input 

Mass_Order_Participant_19gfpaqj9fptegx7vbaacpbh/MassOrderUpload/1234_massorder.txt

Mass_Order_Participant_19gfpaqj9fptegx7vbaacpbh/MassOrderUpload/5678_massorder.txt

Output

1234_massorder.txt

5678_massorder.txt

 

 

mvalicpi40
Explorer
0 Kudos

Hi Alex,

can you help with above request?