1 2 Previous Next 15 Replies Latest reply on Oct 16, 2013 12:59 PM by dg3321

    How to show found results in a custom dialogue box

    dg3321

      Title

      How to show found results in a custom dialogue box

      Post

           I have a script that triggers a dialogue box when a due date for a bill matches the current date.  I crafted a message that takes certain information from the found record (name, amount owed etc) and shows that information as part of the custom message.  

           My problem is that i cannot get the fields from the found record to show in the custom dialogue box.  It's only showing the name of the field, not the results in it, along with other text i added.

            

        • 1. Re: How to show found results in a custom dialogue box
          philmodjunk

               Are you finding a single record or a group of records?

               If you are finding a single record, referring to a field in the custom dialog should show the data in that field. If you are finding multiple records, you'll get the data from whatever record in the found set is the current record--and that might show results different from what you want.

          • 2. Re: How to show found results in a custom dialogue box
            dg3321

                 i'm finding a single record...

                 How do i script the following

                 (Field 1) owes (Field 2) for (Field 3) today.

                 ...assuming each of those fields are from the found record.

            • 3. Re: How to show found results in a custom dialogue box
              philmodjunk

                   Click the specify button to open the specify calculation dialog. That way, it'll trap many syntax errors instead of treating everything you enter as quoted text.

                   You want an expression patterned after this example:

                   YourTable::Field1 & " owes " & YourTable::Field2 & " for " & YourTable::Field3 & " today."

              • 4. Re: How to show found results in a custom dialogue box
                dg3321

                     That worked perfectly, thank you.

                     Is there any reason why one field would show up in the custom dialogue and another won't?  I have a company name and a contact name for each of these records and for some reason i can get the company name to show up no problem in the custom dialog box but not the contact name.

                     Lastly, one of the fields that i'm having shown in the custom dialog box is a number field (the amount of the payment that is due; note, this is a calculation field).  In the layout, it is formatted to show as a currency, however in the custom dialog is simply shows as 1000 instead of $1000.00

                     Any way to fix that?

                • 5. Re: How to show found results in a custom dialogue box
                  philmodjunk
                       

                            Is there any reason why one field would show up in the custom dialogue and another won't?

                       There are any number of possible reasons, the reference to the field in your calculation could be incorrect; a relationship could be invalid, the field might be the wrong data type for the data entered into it...

                       

                            in the custom dialog it simply shows as 1000 instead of $1000.00

                       Your expression in your custom dialog refers directly to the data in the table, any formatting specified for it on your layout will not affect what you see in the custom dialog. You'd need to either create a calculation that applies the needed currency formatting or not use Show Custom dialog.

                       Instead of Show Custom Dialog, it's possible to use New Window to display the same information in small modal window, but now you would set up a layout to use with this window and that could be formatted like you would any other FileMaker layout.

                  • 6. Re: How to show found results in a custom dialogue box
                    dg3321

                         Ok, thank you.

                    • 7. Re: How to show found results in a custom dialogue box
                      dg3321

                           One last question.  This custom dialog is part of a bigger script that i can't quite finish up.  Essentiallyl i want the script to go to the found record and show the custom dialog if the due date matches the current date (this part i have working fine).  It's the rest of the script that isn't quite working out.

                           If the due date does not = the current date, i want it to continue on to a different layout. - this is the part that isn't working; i'm just getting an error message saying that 'no records match this find criteria'.

                           Here is what i have:

                           If [due date] = [Current Date]

                           Go to layout (Project A]

                           Show all records

                           Perform Find (due date = //)

                           Show custom dialog 

                           Else if [due date] ≠ [todays date]

                           Go to layoug {Layout A]

                           End if

                           -------------

                           How do i end this script so that if the first criteria isn't met, it goes to 'Layout A'?

                            

                      • 8. Re: How to show found results in a custom dialogue box
                        philmodjunk

                             You can remove Show All Records. It has no effect on how your script functions.

                             Use Set Error Capture [on]

                             to keep the "no records found" error dialog from interrupting your script. Put it in before your perform Find step.

                             Then use a if step such as:

                             If [ Get ( FoundCount ) ]

                             to detect that a record was found.  The Else step can then be used to specify the layout you want when no records are found.

                        • 9. Re: How to show found results in a custom dialogue box
                          dg3321

                               Almost got it, it got rid of the error dialog but its still not going to the layout i want, its going to the 'project A' layout showing 0 records.

                               Here is what i have:

                                

                               If [due date] = [Current Date]

                               Go to layout (Project A]

                               Set Error Capture [on]

                               Perform Find (due date = //)

                               If [Get ( FoundCount )]

                               Show custom dialog 

                               Else if [due date] ≠ [todays date]

                               Go to layoug {Layout A]

                               End if

                               ----------------

                          • 10. Re: How to show found results in a custom dialogue box
                            philmodjunk

                                 Just use Else, not Else if, there's no need for that.

                                 Your script uses Go To Layout to go to a layout named "layout A" so it would appear to be doing exactly what you set it up to do. If you want a different layout than "Layout A", you'll need to specify that other layout. And a change in layouts will not change the found set on that layout, additional scripting would be needed if you want such a change.

                            • 11. Re: How to show found results in a custom dialogue box
                              dg3321

                                   Now its working perfectly, thank you!!

                                   Yet, one last question.  I noticed that if an amount due say for example is $1433.33...the custom dialog is showing it as 1433.3333333

                                   How do i create a calculation that applies the needed currency formatting of only 2 decimal places?

                                   Thank you.

                              • 12. Re: How to show found results in a custom dialogue box
                                philmodjunk

                                     Round ( yourtable::yourField ; 2 )

                                • 13. Re: How to show found results in a custom dialogue box
                                  dg3321

                                       Perfect, thanks!  Just for future reference, is there any way to take that a step further to have a comma for the numbers in the thousands?

                                  1 2 Previous Next