1 2 3 Previous Next 32 Replies Latest reply on Oct 31, 2012 5:33 PM by MaxwellRobin

    Record Restrictions



      Record Restrictions


           Hi All!

           So i have a records which have a drop down menu. the menu consists of 3 different options to choose from. the user can type anything into the field if they wish. what i would like is to restrict the amount of different items they can type. so in my case the three options in the drop down list are: "block, all fade, assert" they are allowed to enter one other custom value but only one. is there a way to make it so that this field can only accept 4 different values? they are allowed to have many records with the same value but they can only use 4 different values.


           if this makes any sense i would be much appreciated if anyone could help. thank you

        • 1. Re: Record Restrictions

               If you examine the options for a value list in the Inspector, you'll find that there is an "other" option that permits users to enter exactly one other value into the value list on a given record (but the value can be different on each record). Is that what you had in mind or do you want to limit that "other" value to only one other value over all the records in your table?

          • 2. Re: Record Restrictions

                 i would like to only have one other value over all the records in my table.

                 the three options i have are: "block" "all fade" and "assert"

                 they can use any, all, or none of these but can only use 4 different types in the whole table across all records

            • 3. Re: Record Restrictions

                   It might be simplest to define a table with 3 records, one for each of your three initial values. You can select the "use values from a field" option to use the values from this table for the value list.

                   Then you can add an "other" button that checks the number of records in this table. As long as there are 3 records in the table, a custom dialog with an input field can be opened for the user to enter a fourth value. If there are 4 records in this table, the script can tell the user that they can't add another value. With this method, the added value will automatically appear in the value list when the script uses the value from the custom dialog to create that one and only one extra record.

              • 4. Re: Record Restrictions

                     but what if the user would like "blackout" to be "block" as well as "BO" be "block"?

                • 5. Re: Record Restrictions

                       You'll need to explain what you mean by that.

                  • 6. Re: Record Restrictions

                         oh i misunderstood you. could you please elaborate on your first statement?

                    • 7. Re: Record Restrictions

                           Let's say we have a table with three records for use with your value list. Let's give it a single field, "value" with these records:

                           All Fade

                           Define your value list, let's call it "CueValues, with the "use values from a field" option to list these values.

                           I'm going to modify what I originally suggested by using a script trigger instead of a button on your layout. Let's say you have a layout based on the table: YourTable, with a field named "SelectedValue". Put YourTable::Selectedvalue on your layout and use the inspector to format it as a drop down list so that the user can select from the value list or enter a value into the field.

                           Use the OnObjectSave script trigger to perform this script:

                           Set Variable [$ValueList ; value: ValueListItems ( Get ( FileName ) ; "CueValues" )]
                           If [ IsEmpty ( FilterValues ( $ValueList ; YourTable::Selectedvalue ) ) // value entered is not in current value list ]
                              If [ ValueCount ( $ValueList ) < 3 // permit this new value to be added]
                                Freeze Window
                                Set Variable [$Value ; value: YourTable::Selectedvalue ]
                                Go to Layout [ CueValues (//must be layout based on table of values for value list)]
                                New Record/Request
                                Set Field [CueValues::Value ; $Value ]
                                Go to Layout [original layout]
                                 Show Custom Dialog [YourTable::Selectedvalue& " cannot be entered into this field"]
                                 Set Field [ YourTable::Selectedvalue ; "" ]
                              End If
                           End If


                      • 8. Re: Record Restrictions

                             AWESOME! IT WORKS GREAT!

                             just to add to this there is another step in the process id like to have

                             the list we have just created determines a set of check boxes in another table

                             in that other table there is a field which the user can write in and i would like to have a dialog window pop up if they enter one of the key words they have in the table we just created

                             so lets say they enter they keyword "Blackout" and select "Block" from the drop down menu in this table we successfully created

                             then when they type that keyword into a field on the other table a dialog will pop up saying would you like to check off "Block"

                             if yes it will do so, if no then it will just retuen back to the field

                             this should be active in the sense that any keyword they type in and its corrosponding word in its dropdown will activate the check box

                             the dialog should ask if the user would like to check the cooresponding drop down menu word to what they entered as a keyword and then check the correct cooresponding box.

                             if this makes any sense i would love some help.

                             thank you!

                        • 9. Re: Record Restrictions

                               Is this what you want: If you type in the word "Blackout" in the text field, the script asks if "Block" should be selected from the value list?

                               If so, how do you associate "Blackout" with "Block" in your database?

                               Do you want this to take place word by word as text is entered into the field or only after the user exits that field? (Word for word requires a pretty complex script.)

                          • 10. Re: Record Restrictions

                                 it should take place as the user is typing

                                 and the association is from the table we just created where the user types in the keyword and then selects a term it is related to

                            • 11. Re: Record Restrictions

                                   So you have one field for the value: Block and you add a second text field for the keyword: Blackout. Will there be just one keyword or could there be a list of them for a given value?

                                   This script isn't as complex as I feared.

                                   Define gKeyWord in YourTable and specify global storage for it.

                                   Define a new relationship:

                                   YourTable::gKeyWord = CueKeyWords::KeyWord (make CueKeyWords a new occurrence of the CueValues table.)

                                   Define a new value list as a way to get a list of all your keywords. Name it CueKeywords and set it to list values from the KeyWord field.

                                   You can set up the OnObjectKeystroke to process each key as it is pressed:

                                   Set Variable [$ValueList ; value: ValueListItems ( Get ( FileName ) ; "CueKeywords" )]
                                   Set Field [YourTable::gKeyWord; RightWords ( YourTable::YourTextField ; 1 ) & Get ( TriggerKeystroke ) ]
                                   If [ Not IsEmpty ( Filtervalues ( $ValueList ; YourTable::gKeyWord ) ) // Most recently entered word is in list of keywords ]
                                       If [ Not IsEmpty ( FilterValues ( Yourtable::CheckboxField ; YourTable::gKeyWord ) ) // value is not already selected in check boxes ]
                                             Show Custom Dialog ["Select " & CueKeyWords::Value & "?"]
                                             If [ Get ( LastMessageChoice ) = 1 // button 1 was clicked, make it OK or Yes ]
                                                Set Field [ YourTable::checkBoxField ; List (YourTable::checkboxField ; CueKeyWords::Value ) ]
                                             End If
                                      End If
                                   End IF

                              • 12. Re: Record Restrictions

                                     there could be multiple keywords for "block" and so on.

                                • 13. Re: Record Restrictions

                                       You can list those multiple keywords in the KeyWord table separated by returns. The relationships and this script then, will still work.


                                  • 14. Re: Record Restrictions

                                         it doesnt seem to be working. i think there is a mis communication between the tables being described. should i send you my "translation" of your script so you can see what my tables, fields and value lists are called? will this help.

                                         as of now when i type in the keyword it wont pop up the dialog.

                                    1 2 3 Previous Next