KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Utility method to get structure file name
PRODUCT: 4D | VERSION: 15.1 | PLATFORM: Mac & Win
Published On: August 11, 2016

Below is an utility method that returns the name of the structure file.

// Method: StructureName
// Return: Name of structure file

C_TEXT($path;$0;$sep)
C_LONGINT($i)
C_BOOLEAN($found)
$path:=Structure file
$sep:=Folder separator
$found:=False
$i:=Length($path)
While (Not($found)) & ($i>0)
   If ($path[[$i]]=$sep)
      $found:=True
    Else
      $i:=$i-1
   End if
End while
$0:=Substring($path;$i+1)


Example:
$structName:=StructureName
//$structName = "MyDatabase.DB"

Commented by Vincent de Lachaux on August 16, 2016 at 8:57 AM
You can also do: $structName:=Replace string(Structure file(*);Get 4D folder(Database folder;*);"")