FlexPro
HistoryBase
Engineering
Training
Downloads
FlexPro Support
Knowledge
Community
About us
References
Jobs
General Contact
List Of Retailers
FlexPro Support
EN
DE
FR
Placeholder
Products and Solutions
Support and Downloads
Company
Magazine
Contact Us
Language
MyWeisang

Account settings

Topic

String as a folder name

Home page Community FPScript String as a folder name

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #33405

    There is a string in FlexPro formula. How can I ask if there is a folder that has this string as name?In VBA I use is Nothing operator in such cases.

    #33403

    There is a string in FlexPro formula. How can I ask if there is a folder that has this string as name?In VBA I use is Nothing operator in such cases.

    #33404
    Bernhard Kantz
    Participant

    A possible solution could be the following: Create a new formula, rename it to [b]IsFolder[/b] and paste the following text into the formula editor:
    [code]
    arguments strFolder
    dim Err

    try
    $strFolder : “.FLD”$.Name
    catch Err
    return FALSE
    End

    return TRUE
    [/code]
    Then you could call this helper formula like this:
    [code]
    If IsFolder(“Folder”) Then …
    If IsFolder(“AFolderAnotherFolder”) Then …
    [/code]
    The formula [b]IsFolder[/b] tries to convert the object name into a reference to the object. If the object exists this is possible and accessing the [b]Name[/b] property of the folder is a valid operation. Otherwise an error will occur which will be catched by the [b]catch[/b] statement. The variable [b]Err[/b] contains the error message as a string, but we do not need it here.

    Support
    support@weisang.com

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.