File type name without extension name

Hello ,
I am trying to display a file name in a table record, which I have saved in database, but the file name is saving name with its file extension (example - file name.jpeg). So I when I am showing the data on screen in a list record, i want to display file name without the extension name. (example(filename)

Hi,

You can try this one (with VarText is your Filename): 

Substr(VarText,0,Index(VarText,".",startIndex:,searchFromEnd:,ignoreCase:))


Hope this helps,

Khuong


Hi again,

Adding the check logic if there is no extension (just filename without extension):

If(Index(TextVar,".",startIndex:,searchFromEnd:True,ignoreCase:) > -1,Substr(TextVar,0,Index(TextVar,".",startIndex:,searchFromEnd:True,ignoreCase:)), TextVar)

Could you please explain further as i am new to outsystems ,

My file name is ,   Test Document.jpeg


Hi,

1. Use Index built-in function to check if the filename contains character "." or not. It will return index of ".", if not found it will return -1.

2. Use Substr to get the sub-string of filename. In this case get sub-string from 0 to last index of ".". As you can see searchFromEnd: TRUE.

3. Use IF to check if filename contains ".", then sub-string, ELSE just display filename.

Cheers,

Khuong 

Please take a look at this Index and this SubStr functions for more detail information.


Hi,

My suggestion is we'd better store both file name( without extension) and full file name (with extension), so whatever we want to show, we always can show it without any logic. Currently, if you only store file name with extension, you can use Khuong's suggestion that use Index and Substr to split the file name.

mvp_badge
MVP

Hi,

Alternatively to the previously suggested solutions you could the very well valued FileSystem Forge component, it has the Pat_GetFileNameWithoutExtension method for you.

Regards,

Daniel


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