Wickerman Posted March 16, 2009 Posted March 16, 2009 I'm baffled by a simple (I thought) script I've set up to create new 'Keywords' in a Lexicon Table that holds a record for each Keyword that the user can use to 'tag' various media items via a join field. Each Keyword involves 3 fields (Word/Category/Authority) and I've set up global fields for their entry and a script that takes these values and creates a new Keyword record based upon them. This has been working fine. But I want to make sure the user can't create a new Keyword with any of the three fields empty. So at the beginning of the script I did a triple "IF" condition: IsEmpty ( CFA_Lexicon::NewKeyword_g ) or IsEmpty ( CFA_Lexicon::Lexicon_Authority ) or IsEmpty ( CFA_Lexicon::Lexicon_Category ) -- whereupon you get a dialogue box scolding the user to fill in all three fields, and Exit Script. So, here's the odd thing: when the Lexicon Window where all this action goes on is first opened, the script allows me to create a Keyword with empty fields . . . ONCE. Thereafter the script enforces field entry as I planned. Or, if I create the flawed record and then delete it the script allows me to do it again. My record creation script clears the three global fields after creating a new record, and I've added the same global-clearing commands to the script that opens the Lexicon Window too, for good measure --- - SetField[GlobalField1;""] etc. I'm having a hard time pinning down exactly when it allows the flaw. I've tried the process with the data viewer watching the global fields and stepping through with the debugger -- and sure enough, at these times the script allows me to step *right through* the IsEmpty test even though I can see that the Global Fields are empty in the data viewer! Whatever can the matter be? Albert
RalphL Posted March 16, 2009 Posted March 16, 2009 I've set up global fields for their entry and a script that takes these values and creates a new Keyword record based upon them. This has been working fine. But I want to make sure the user can't create a new Keyword with any of the three fields empty. So at the beginning of the script I did a triple "IF" condition: IsEmpty ( CFA_Lexicon::NewKeyword_g ) or IsEmpty ( CFA_Lexicon::Lexicon_Authority ) or IsEmpty ( CFA_Lexicon::Lexicon_Category ) I see CFA_Lexicon::NewKeyword_g is indicated to be a global but the other 2 fields look like regular fields. Could this be your problem? I use a custom dialog box for this so i don't need to have the field on a layout.
Wickerman Posted March 16, 2009 Author Posted March 16, 2009 Oh . . . FOR CRYING OUT LOUD! I can't believe I wasted nearly an hour and ruined my lunch overlooking that simple error -- thanks Ralph!. Albert
Recommended Posts
This topic is 5732 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now