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?
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.
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.
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.
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.
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.
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.
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.