9 Replies Latest reply on Oct 28, 2010 10:48 AM by thong127

    dialogue box

    thong127

      Title

      dialogue box

      Post

      Hi All,

      In my database I have a field Materials Name, Quantity Received, Quantity Used and Quantity Balance. I like that when I open my database it will automatically popup a dialogue box "saying these materials are having low balances" (Based on 50% of the amount of materials Quantity Received).

      Can you please help me to build a script regarding to my issue. Because now I'm relying to the color of my reorder level field based from conditional formatting.

      Thank you very much.

       

        • 1. Re: dialogue box
          philmodjunk

          Enter Find Mode[]
          set Field [YourTable::Quantity Balance ; "< " & .5 ]
          Set Error capture [on]
          Perform Find[]
          If [ Get (FoundCount ) > 0 ]
             Show Custom Dialog ["These materials have a low balance..."]
          End If

          You can use File | File Options to set this script to run each time it is opened.

          • 2. Re: dialogue box
            thong127

            Hi Phil,

            thank you for your reply. I tried your script but It was unsuccesful... I made my own script because iI forgot to mention that I would like also to appear the names of the materials in the dialouge box. but I based from your own..the script goes like this

            Enter find Mode[]

            set Field [Materials::Quantity Balance; " ≤ "  & .5]

            Perform Find []

            Set Variable[$found; Value:Get (FoundCount)]

            If [$found >0]

            Set Variable [coounter; Value:1]

            Loop

            Set Variable [$names & GetNthRecord(Materials::Materials Name; $counter ) & "¶"]

            Exit Loop If ($counter = $found)

            Set Variable [$counter; Value:$counter + 1]

            End Loop

            Show Custom Dialog ["Low Balance"; Materials with low balances: ¶" & $names]

            End If

            But still I'm unsuccessful...kindly improve and correct my script.

            thank you very much.

            • 3. Re: dialogue box
              philmodjunk

              How is it unsuccessful? That will clue me in on what we need to do differently here. Does the find work to find your records?

              If you are not finding the reocrds you expected to find, is quantity balance a number field, calcuation field or a summary field?

              • 4. Re: dialogue box
                thong127

                Hi Phil,

                Sorry I forgot to mention, the Quantity Balance field is a Calculation field (Quantity Balance...Calculation...Indexed, Quantity Received - Quantity Used). It was unsuccessful in the sense that it only shows those materials having zero balances.

                 

                • 5. Re: dialogue box
                  philmodjunk

                  Ok, you mentioned a 50% re-order level, so I incorrectly assumed this was a percentage, hence the 0.5 entered as criteria. You need one more calculation field: Quantity Balance / Quantity Received to compute the percentage on hand. Use your script to enter "< " & 0.5 in this field instead of Quantity Balance.

                  • 6. Re: dialogue box
                    thong127

                    Thank you very much Phil, I got It.

                    • 7. Re: dialogue box
                      thong127

                      Hi Phil,

                      Another additional help & favor...how about if I want only to see those materials having low balances excluding those materials having zero balance. thank you so much.

                      • 8. Re: dialogue box
                        philmodjunk

                        Add these steps after the Set Field step:

                        New Record/Request
                        Set Field [Materials::Quantity Balance ; 0 ]
                        Omit Record

                        Omit record in find mode selects the Omit option just like clicking that button does in a manual find.

                        • 9. Re: dialogue box
                          thong127

                          Hi Phil,

                          I got it..youre a Great help to the forum specially like us who are new to filemaker...Thank you very much.