cancel
Showing results for 
Search instead for 
Did you mean: 

DynamicAttributeChangeBean Clarification - Determine the target folder based on the dynamic values contained in the file name

former_member213558
Active Participant
0 Kudos

Hi All.

i'm referring and i achieved my renaming the passthrough scenario with a help of the DACB module. and i would link to appreciate the effort of Eng swee Yeoh.

and i have some other scenario as well. can any one please suggest is below feature is available or not.

in mentioned link  Scenario 5, if my case is Partner1_002_InvoiceNumber123.xml (ie invoice number) is unique, what setup has do be done, i tried it but not getting, if give the default prefix and post-fix only it's taking.

my requirement is

expected file name

WPS_SOUTH_388_SH010060030008.xml.asc

WPS_SOUTH_389_SH010060030009.xml.asc

WPS_NORTH_388_SH010060030009.xml.asc

WPS_NORTH_389_SH010060030010.xml.asc

target folder is

/Target/file/SOUTH   (both WPS_SOUTH_388_SH010060030008.xml.asc and WPS_SOUTH_389_SH010060030009.xml.asc file  to be placed)

/Target/file/NORTH   (both WPS_NORTH_388_SH010060030009.xml.asc and WPS_NORTH_389_SH010060030010.xml.asc file  to be placed)

if i give regex: WPS_(\d+)_388_SH010060030008.xml.asc only the file which has the same prefix and postfix is taking. i tried with wild (*)char as well it's not working.

how can i route to this, can you please suggest whether it can be achieved or not.

Regards

Ramesh

Accepted Solutions (1)

Accepted Solutions (1)

engswee
Active Contributor
0 Kudos

Hi Ramesh

Yes, the "regex" mode can be used to achieve your requirement. Instead of giving you the fish and have you come back for more later, I'd prefer to teach you to fish instead. As such, I'd suggest that you read up on regex, i.e. regular expressions. There are even sites below that you can use to test your regex as well as provide you cheatsheets for commonly used regex expressions.

Regex Tester - Javascript, PCRE, PHP

RegExr: Learn, Build, & Test RegEx

Several hints for you

  • \d is for matching digits and will not match SOUTH or NORTH
  • Try to not hard code the trailing section of your filename (i.e. 388_SH010060030008.xml.asc) but instead represent it as a dynamic regular expression.

Regards

Eng Swee

former_member213558
Active Participant
0 Kudos

Hi Eng.

suggested link helps me to get the proper regex.

Below  is the regex which is suites for my requirement .

WPS_(\D+)_[a-z,A-Z,0-9].*

thanks for your guidance. 

Answers (0)