Note Formatting For String Variables

Altair Forum User
Altair Forum User
Altair Employee
edited October 2020 in Community Q&A

I'm trying to find a way to include the result file name in my plot window without showing the full path. When I first create the .MVW file it looks fine, but when I save it and later reload the note shows the full path, which is typically very long and gets truncated.

I'm using the default:

'Result : {window.resultfilename} '

Which originally prints out something like this:

'Result: BracketModification1.odb'

But after a save and reload ends up looking like this:

Result: /mnt/home/bspeirs/projects/SomeProject/FEA/Install...'

Is there anyway to eliminate the full path? I just want the file name printed.

Or is there a way to have it truncate the leading portion of the path and keep the most relevant part?

Like this

'Result: ...omeProject/FEA/Installation/BracketModification1.odb'

Thanks.

Tagged:

Answers

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited April 2012

    This line of templex might do the trick (assuming that the actual file name is shorter than 100 characters):

    {mid({window.resultfilename},strrchr({window.resultfilename},'/')+1,100)}

    Regards

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited April 2012

    That is EXACTLY what I wanted. Thanks!