Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have a server path (or paths) that we want to do selections on the server name only.
Example: \\server1\Folder Path
var1 - mid(Path, index(Path,'\\', 1) + 2) to remove the first two slashes
var2 - RTrim(Path) - ??
What's the best way to accomplish removing everything after the slash after server1 and be flexible to handle different string lengths?
Thanks in advance
you can use subfield
subfield(mid(Path, index(Path,'\\', 1) + 2) ,'\',1)
you can use subfield for the whole thing subfield(Path,'\',3) if you do not want to use the mid function
You can pick out the part of the path you want by using SubField()-function. This can be used both in a load script but also in the running application in the UI.
SubField( Path , '\' , 3 ) will pick out the server1
Since the first element is empty... the string starts with a backslash. The second part is empty - since there is nothing between the two first backslashes.
You can also index backwards by using a negative index. So SubField( Path , '\' , -1 ) will give you the text after the last backslash.
for server1
= subfield(replace('\\server1\Folder Path', '\\', ''), '\', 1)
folder path
trim(subfield(Replace( '\\server1\Folder Path','\\',''),'\',2))
server name
subfield(Replace( '\\server1\Folder Path','\\',''),'\',1)
hth
Sasi
Or using Textbetween()
=TextBetween('\\server1\Folder','\\','\')
=TextBetween(path ,'\\','\')