63
Views
10
Comments
Solved
Rename filename
Question
Application Type
Reactive

Hi,

How do i rename a file name which user had uploaded, example

Uploaded filename: CustomerA.doc

Filename to be saved: AA_001.doc

I had tried to directly pass in "AA_001" to the filename input, but it is saving without the extension. So after downloading the file "AA_001", it is not able to be opened, as the computer doesn't know what type of file this it


Thank you

2022-01-13 11-06-04
Neha Sheikh
Champion
Solution

You should get the file extension in String_split.List[1].text.value 

2022-01-13 11-06-04
Neha Sheikh
Champion

Hello,


What type will it be?

Is it going to be doc always?

We need to add extension along with the name in the action.


Regards,

Neha

2022-05-01 03-47-53
Jun Mun Chan

Hi,

it can be any type, not necessarily just doc  files

2022-01-13 11-06-04
Neha Sheikh
Champion

In that case you can 

1. take the file name 

2. extract the extension and 

3. save that in a variable. 

4. concatenate the variable with your name  ("AA_001" + ext_variable )and 

5. then download the file.


You ca use string_split to get the extension string after ".".


and then take the extension

Hope this helps.


thanks,

Neha


2022-05-01 03-47-53
Jun Mun Chan

i had tried this method too, but i'm getting the actual file name instead of the extension.

Let me try "xxx.List[0]xxx" method as you had suggested

2022-01-13 11-06-04
Neha Sheikh
Champion
Solution

You should get the file extension in String_split.List[1].text.value 

2023-06-06 10-13-52
Rishabh Chawda

Hi @Jun Mun Chan 

You may prefer to use the OML file below.

I hope this will work for you.

Best Regards,

Rishabh Chawda

RenameFileName.oml
2022-05-01 03-47-53
Jun Mun Chan

For some reasons unknown to me, i couldn't publish and view it in the browser. They had prompted me to refresh dependencies. I tried both ways, as in don't refresh and refresh

And still couldn't open it. So sorry about this

2020-09-15 13-07-23
Kilian Hekhuis
 
MVP

Hi Jun,

An extension always starts with a ".", followed by some text. You can use the built-in Index function to search for the dot, setting searchFromEnd to True so you get the last occurence, then use Substr to extract the extension, and add it to the file name.

2022-05-01 03-47-53
Jun Mun Chan

i was actually trying to work along this idea, but seems like i just couldn't get it to work

2023-11-20 06-53-17
Neha Rathore

Hi @Jun Mun Chan,

If this issue still not resolved, you can share OML with us so that we can understand the issue and help you out.

Thanks
Neha

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.