1 2 Previous Next 19 Replies Latest reply on Feb 5, 2015 9:37 PM by DustFairy

    Find Checkbox

    DustFairy

      Title

      Find Checkbox

      Post

       

      I have a script that has a Perform Find step that works well with a static Criteria.  I would like to have the script use the "Criteria" that is stored in a field.  I have seen several other posts that say I should use Enter Fide Mode then Set Field and then either Perform Find or Extend Found Set.  Neither works and I end up with an error message and the option to modify the find.

       

      I have tried changing my checkbox to global storage but then all the checkboxes are checked which is kind of pointless.

      Any suggestions.  Thanks in advance.

      A screen shot of my script is attached.

       

      Screen_Shot_2015-02-03_at_4.20.13_PM.png

        • 1. Re: Find Checkbox
          philmodjunk

          Seems that you missed a key detail with those methods. The criteria entered into that field is typically entered into a field with global storage. When your window enters find mode, regular fields become blank--so the user can enter data into them as search criteria, but the contents of a global field remain and the calculated result portion of the set field step can refer to a global field in a calculation that evaluates to produce the desired search criteria. The other approach that is also used is to copy the data into a variable before entering find mode. The contents of the variable is then accessible for use to produce search criteria when the script enters find mode.

          Other issues that I see in your script:

          You normally use Enter find mode [], not enter find mode [pause] which will leave your script paused in find mode until the user continues the script.

          And set field needs to be set up with two parameters, the target field and the calculated result that is evaluated and the result copied to the target field. When Setting up Set Field, there are two Specify buttons that must be clicked. To get Set Field [Table::Field ; Expression], add set field to your script and click the first button (specify target field). Select Table::Field from the list of fields. Do not click the specify button next to the repetition box. Click OK to close this dialog box. Now click the lower specify button (calculated result) and create the expression to the right of the semicolon (;). Do not try to type in the semicolon.

          For some numerous examples including a looping script that uses values selected in a global check box field, see: Scripted Find Examples

          • 2. Re: Find Checkbox
            DustFairy

            Thanks.  

            Not sure I totally grasp the Global Storage.  I made my Machine type field in Inspection Pt table Global and it filled in all the checkboxes which kind of defeats the purpose of a checkbox.

            • 3. Re: Find Checkbox
              philmodjunk

              I pointed out two options: Use a global field or set a variable to the value of the field before entering find mode. The global field option is for when you set this up so that a user specifies find criteria in the global field then performs the script that uses that criteria in the global field to set up the find requests and perform the find. Try setting a variable to the value of the field and then refer to the variable instead of the field once the script has entered find mode.

              • 4. Re: Find Checkbox
                DustFairy

                The variable is probably what I want.  I don't want the user to specify the criteria.  The criteria is the Machine type, a field in the Unit table, so each year when the Unit is inspected the criteria is the same.

                I have seen your instructions on setting variables.  I suppose I follow those same instructions?

                • 5. Re: Find Checkbox
                  philmodjunk

                  after nearly 70,000 comments posted, I'm not sure I recall the same instructions that you do.  wink

                  • 6. Re: Find Checkbox
                    DustFairy

                    Good point.  I'll try with what I've seen and hope for the best.

                    • 7. Re: Find Checkbox
                      DustFairy

                      This is what I have come up with:

                      Set Variable [$Machine type;Value:Unit::Machine type]

                      Enter Find[]         specify that as     Inspection Point::[Machine type]=$Machine type

                      Perform Find[]

                      Unfortunately that gets me the same 'no match' message.

                       

                      • 8. Re: Find Checkbox
                        philmodjunk

                        Actually, what I see should produce a "no criteria" message.

                        You need a set field step that puts data from the variable into a field after the script enters find mode just like you would manually enter criteria if you were doing a manual find.

                        • 9. Re: Find Checkbox
                          rkutcher

                          Let see if I understand what is supposed to happen inside my script.  It's hard to figure out what I'm doing wrong if I don't understand it.

                          Starting at Go to Layout["Inspection Point"(Inspection Point)       this navigates  to the "Inspection Point" table and the (Inspection Point) layout

                          Set Variable[$Machine type; Value:Unit::Machine type]   $Machine type - names the variable   Unit::Machine type (Unit is the table and Machine type is the field)

                          Enter Find Mode   In Specify I have - Inspection Point::Machine type:[=$Machine type]  means Inspection Point - table,  Machine type  - field  and $Machine type - variable

                          Set Field [Inspection Point::Machine type]        says look at the Machine type field in Inspection Point table

                          Perform Find [Restore]          When I click the Specify... button  the Specify Find Requests dialogue has a space for a list of find requests.  I only have one, the one above at the Enter Find Mode step.  Do I select it again??

                          I hope the above isn't too confusing.

                          • 10. Re: Find Checkbox
                            philmodjunk

                            Enter Find Mode   In Specify I have - Inspection Point

                            Don't specify criteria here. The subsequent script steps will overwrite this anyway. But the whole point to using Set Field here is to avoid hiding the criteria where you have to open another dialog to see what is specified.

                            Perform Find [Restore]          When I click the Specify... button

                            Don't do this either. If you look at the enter find mode and perform find script steps in the examples posted in that other thread, you'll always see empty brackets. That's because all the criteria are specified in the set field script steps.

                            Question, what kind of field is Machine Type? You mentioned a check box field and if this field is such a field, it makes a difference in how we script this.

                            Next question. What layout are you on when this script starts up? You are copying data from a table named "unit" into the variable and then specifying search criteria in a table named Inspection Point. On which of these two tables is your layout based? (I think we need to change layouts here as part of this script...)

                            • 11. Re: Find Checkbox
                              DustFairy

                              Yes Machine type is a Check-box field in the Inspection Point table.

                               

                              I am on the Inspection Layout based on the Inspection table.  That layout has a portal that shows all the Inspection points, that's why I started there (no other valid reason).  So actually I am not on Unit or Inspection Point layouts when the script starts.

                              Yes, the variable (Machine type) is a field in the Unit table.  I am trying to have the database find each Inspection Point with the matching checkbox selections and those Inspection points show in the Inspection layout.   

                              My Relationship graph is attached.

                              • 12. Re: Find Checkbox
                                philmodjunk

                                If you intend your script to find inspection point records, then it needs to be on a layout based on the inspection point table before entering find mode. It may start from your inspections layout but it can't perform the find there or it will be attempting to find inspection records instead of inspection point records.

                                The next problem is that you are trying to get the machine type from unit, but from what I see in your latest screen shot, your relationship from inspections to company to unit could match to many different records in unit, but your script will only access the machine type for the first such related record in the unit table--so this has me thinking that this is not correct here.

                                I am also puzzled at the role that "machine type" is supposed to play in your efforts to pull up a set of inspection point records as that portal where you can see all your inspection points does not use machine type in any way to determine what records appear in that portal. If you can always see the exact list of inspection points in your portal at the time you want to perform this script, you don't have to perform any find at all, you can simply use Go To Related Records to pull up a found set of those records on a layout based on Inspection points.

                                • 13. Re: Find Checkbox
                                  DustFairy

                                   

                                  Here's a shot of my Inspection Point records.  As you can see the various machines don't have all the  same inspection points.  I am trying to have the script display the records that apply to a particular machine type because I only consider those points when doing an inspection.

                                  Agreed the portal does not have a Machine type field but all records showing in the portal (if I can get the script to work) will be for the selected machine type.

                                  I guess I don't quite understand the way things work.  I thought the when the script starts and I select a Company then select a Unit that  the Machine type for that selected unit would be the one that becomes the $Machine type variable.

                                  • 14. Re: Find Checkbox
                                    philmodjunk

                                    I agree that you haven't yet figured out how things work. Are you attempting to perform a find in order to pull up records in that portal?

                                    That won't work with this approach. The results of a find cannot be directly displayed in a portal and your relationship is supposed to do that anyway. Your find, really should be a find performed to find the correct inspection or inspections for a given client. Your relationships should then allow you to pull up lists of inspection points.

                                    I believe that we've discussed this before and the main problem here is that this check box field shouldn't exist at all, but should be replaced by a join table instead.

                                    As I understand it each record in Inspection is supposed to document a single inspection of a specific machine. "Specific Machine" could be implemented  in two different ways. It can be "every machine of this specific make and model get's this inspection and it's list of inspection points". Or it can even be: "this is the inspection for this one specific machine, mfg serial number abc1234". Either approach works and sets up a relationship to a specific set of inspection point records. Neither approach seems to match what you have here.

                                    1 2 Previous Next