Renaming multiple file names in the data collection stored in Current values but not in the Initial Values.

laepatrick

New Member
Does anyone know how i will be able to trim down a file name, let's say i want cut this files

- PSS_5_ITEM_O_02052019_0705 to this file name PSS_5_ITEM_O. I just want to discard the last 13 digits.
- PSS_5_SUPPLIER_O_02052019_0705 to this file name PSS_5_INVENTORY_O. Again discarding the last 13 digits.

These files are stored from a data collection.
 

Attachments

  • fyr.PNG
    24.6 KB · Views: 21

gil.silva

Active Member
Hello laepatrick,

The best option based on the BP functions is:
Data Item: filename (Text) Value: PSS_5_ITEM_O_02052019_0705
Calculation Stage with the Expression: Left(filename, Len(filename)-13)

Basically, with the Len() function you get the number of characters in the filename, then with the Left() function, you get the filename characters except for the last 13, in this case.

For more complex cases, with dynamic digits quantity, you can use Regex expressions.

Hope it helps.
 

laepatrick

New Member
Hello laepatrick,

The best option based on the BP functions is:
Data Item: filename (Text) Value: PSS_5_ITEM_O_02052019_0705
Calculation Stage with the Expression: Left(filename, Len(filename)-13)

Basically, with the Len() function you get the number of characters in the filename, then with the Left() function, you get the filename characters except for the last 13, in this case.

For more complex cases, with dynamic digits quantity, you can use Regex expressions.

Hope it helps.

IT WORKED!!!! THANKS TO YOU BROTHER
 

tiger19

Member
Hello laepatrick,

The best option based on the BP functions is:
Data Item: filename (Text) Value: PSS_5_ITEM_O_02052019_0705
Calculation Stage with the Expression: Left(filename, Len(filename)-13)

Basically, with the Len() function you get the number of characters in the filename, then with the Left() function, you get the filename characters except for the last 13, in this case.

For more complex cases, with dynamic digits quantity, you can use Regex expressions.

Hope it helps.

Hi,
Data Item: filename (Text) Value: PSS_5_ITEM_O_02052019_0705

The value need to be input? How can I rename directly from the data collection? Is that possible? Because everytime I download the will have multiple files with random numbers (filename_date_xxx). I would like to rename the dynamic files name without input manually.
 

gil.silva

Active Member
Hello tiger19,

You can use a Loop stage, in the calculation stage you should have something like Left(CollectionName.Filename, Len(CollectionName.Filename)-13)
 
Top