2 Replies Latest reply on Nov 4, 2015 1:29 PM by disabled_rosalie

    Zero Found Count Dialogue

      Hello All,

       

      Below is the script that I'm working in finding my materials that are expiring next month; I want that If I don't have any materials expiring for next month it will pop up a dialogue saying that I don't Have any expiring materials for the next month.

       

      Can you please help me improve my script below.

       

      Enter Find Mode[]

       

      Set Field[Materials::Expiry Date,Month(Get(CurrentDate))+1

       

      Perform Find[]

       

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

       

      If[$found>0]

       

      Set Variable[$Counter;Value:1]

       

      Loop

       

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

       

      Exit Loop If [$counter=$found]

       

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

       

      End Loop

       

      If [Get (FoundCount) =0


      Show Custom Dialog ["Materials Expiring Next Month"] "Sorry, You don't have any Materials Expiring Next Month"

       

      Else

       

      Show Custom Dialog [Expiring Materials for the next month" Attention!! "ATTENTION!!!! NEXT MONTH EXPIRING Materials\"; \ & $names"

       

      End If

       

      If [Get (LastMessageChoice)=2

       

      Go to Layout [original layout]

       

      Exit Script

       

      End If

       

      Perform Script ["Prep to export']

       

      Enf If

       

       

      Thank you so much.

        • 1. Re: Zero Found Count Dialogue
          HortGroup

          Enter Find Mode[]

           

          Set Field[Materials::Expiry Date,Month(Get(CurrentDate))+1

           

          Set Error Capture [On] (This will stop any filemaker errors from popping up if there are no records.)

           

          Perform Find[]

           

          If [ Get (FoundCount)>0

           

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

           

          Set Variable[$Counter;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 [Expiring Materials for the next month" Attention!! "ATTENTION!!!! NEXT MONTH EXPIRING Materials\"; \ & $names"


          If [Get (LastMessageChoice)=2

           

          Go to Layout [original layout] (This script step won't do anything unless you specify to go to another layout in the beginning of the script.)

           

          Exit Script

           

          Else

           

          Perform Script ["Prep to export"]

           

          End If

           

          Else

           

          Show Custom Dialog ["Materials Expiring Next Month"] "Sorry, You don't have any Materials Expiring Next Month"


          End If

          • 2. Re: Zero Found Count Dialogue

            Thank you so much.