Results 1 to 12 of 12
  1. #1
    Join Date
    Apr 2013
    Posts
    226

    Unanswered: Checking Folder Names

    Hi,

    Does anyone know if there is a way of checking existing folder names? I want a menu item that allows a user to create a new folder. One requirement of my application is that this folder name must be unique. So ideally I would set up a variable asking the user for the name for the new folder and then do a check if that name already exists before then using the add folder action. Any ideas?

    Cheers

    Matty

  2. #2
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    495
    Provided Answers: 24
    Use FileSystemObject for all folder/file functions...

    Code:
    Public Function DirExists(ByVal pvDir) As Boolean
    Dim FSO
    Set FSO = CreateObject("Scripting.FileSystemObject")
    DirExists = FSO.FolderExists(pvDir)
    Set FSO = Nothing
    End Function

  3. #3
    Join Date
    Apr 2013
    Posts
    226
    Hi,

    Sorry I think there is some confusion here. I am referring to Brilliant Database's own folders, not file system folders.

    Matty

  4. #4
    Join Date
    Sep 2011
    Location
    Australia
    Posts
    264
    Provided Answers: 2
    Hi Matty
    Just an unproven idea but could you have text file just for folder names which is used by BD just to record names - on each line?
    Script would read file, then a for each line action would compare your new name. If not exists then create new folder and rewrite file with new list- else warn user.
    Maybe even a dedicated folder to hold names could be used or even a static variable might be possible with out using file above.
    Regards
    David
    Last edited by tamcind; 05-29-14 at 18:12.

  5. #5
    Join Date
    Apr 2013
    Posts
    226
    Hi David,

    Thanks, some interesting ideas there, will investigate.

    Have also noticed that when you have a user input variable, there seems to be no built-in way of picking up if cancel has been clicked. Bit of a pain as requires messy workarounds in the code. I think the same applies for selecting a file. It's odd as with "Show Message" you can pick up what button was pressed.

    Matty

  6. #6
    Join Date
    Oct 2013
    Location
    Philippines
    Posts
    103
    Hi Matty,

    I am also interested in this feature, but for now, you can create a form to store folder names. In that way, BD can check if the folder exists or not. I believe BD has an internal variable which records the folder names, maybe BD support can provide answers.

    Ernie
    Last edited by mcmichael; 05-30-14 at 06:02.

  7. #7
    Join Date
    Sep 2011
    Location
    Australia
    Posts
    264
    Provided Answers: 2
    Hi Matty
    If you enter a value and cancel or enter no value then the user input variable should be blank. A "if-else" check should allow a choice of actions. Just tried the $is_ok system variable but no joy - only for popup forms cancel I think.
    Regards
    David

  8. #8
    Join Date
    Apr 2013
    Posts
    226
    Hi David,

    Yeah I can do that but sometimes you want to check for the empty variable. If you are asking for a name of a new folder say and the user clicks on OK without entering anything, ideally you want to say something like "a blank name is not allowed, please try again" rather than just exiting the script. Trouble with that is, clicking the cancel button will now give them that message too. So at the moment I will just exit out in both cases, but not what I would ideally like.

    Matty

  9. #9
    Join Date
    Jul 2012
    Location
    Ireland
    Posts
    815
    Provided Answers: 17
    Have an idea so I will try write this.

    Regards
    James

  10. #10
    Join Date
    Jul 2012
    Location
    Ireland
    Posts
    815
    Provided Answers: 17
    Ran into a problem. I found a bug in Brilliant Database while writing this.

    The ability to select a folder based on a variable does not seem to work.

    Have a look at the attached file for example. The code from lines 7 to 14 are the controls that check for the duplicated folder name but because brilliant database will not seem to run line 9, the code won't work.

    Regards
    James
    Attached Files Attached Files

  11. #11
    Join Date
    Apr 2013
    Posts
    226
    Yes, I see. I think I have come up against that problem before.

  12. #12
    Join Date
    Apr 2013
    Posts
    226
    I forget exactly what my issue was before but I only seemed to be able to select a folder if using it's id rather than name. I think I may have been using cur field name and instead had to use cur field id. What might work is if you could request the id of a folder by folder name. If no id returned you know it doesn't exist Which comes back to another question I've asked, how do you find the folder id if you know the name and vice versa. I'm not sure it's possible.
    Last edited by matty1965; 05-30-14 at 12:34.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •