5 Replies Latest reply: May 15, 2014 9:53 AM by Grant Perkins RSS

    Variable criteria trap

    EAS _

      Hi - new member here, thanks for looking at my question.

       

      How do I set up a trap to look for variable criteria?

       

      For example, I have a field that has either one of two different criteria listed - it will either be called "Vendor" or "Remit to".

       

      How can I set up a single trap to return certain data based on either of these criteria?

       

      Thanks!!!!

        • Variable criteria trap
          Data Kruncher

          While you can't define a truly variable trap in that manner, there are alternative methods to extracting that data.

           

          Can you post a sample of your report layout? That would help analyze your situation immensely. Remember to use the CODE button to make your sample align properly in your post.

           

          Kruncher

          • Variable criteria trap
            EAS _

            /size[quote]code:[/size]JOURNAL    DATE     BCH ENTRY         DEBITS       CREDITS  DESCRIPTION                                                                               

            10 - OPERATIONS COST OF SUPP SOLD                                                                               

            MM.COMP    09/30/06 2   15                          400.00  V# V00001 PO# 0000077 ACCRUAL   

                                                                        Vendor: ABC INDUSTRIES      

            MM.COMP    09/30/06 2   23                          160.89  V# V00009 PO# 0000109 ACCRUAL   

                                                                        Vendor: ABC, INC.     

            MM.COMP    09/30/06 2   98                           26.55  V# V00006 PO# 0000320 ACCRUAL   

            GEN.COMP   03/06/07 4   7-14          282.93                RECORD MISC DEPARTMENT ISSUES                                                             Vendor: XYZ, INC.     

            MM.COMP    09/30/06 2   112                         111.30  V# V00001 PO# 0000345 ACCRUAL   

                                                                        Vendor: ABC INDUSTRIES      

            AP.COMP    10/12/06 1   57             53.10                V# V00009 I# 732294             

                                                                        Vendor: ABC, INC.     

            AP.COMP    10/13/06 2   7             163.71                V# V00009 I# 720855 R# 0000109  

                                                                        Remit to: ABC, INC.   

              /QUOTEIn this example, some of the vendor names start with the "Remit to" criteria and some with "Vendor".

             

            There are also instances where only one line is represented by a journal entry (ie:  general journal - "GEN.COMP".

            • Variable criteria trap
              joey
              • Variable criteria trap
                Data Kruncher

                Just when I was about to posted my solution, I noticed that Joey beat me to it, with about the same method. Textline is the key here, along with the None of the above optional End field on setting.

                 

                The only other item I'd mention is that you have two potential vendor name locations (GL items have the vendor on the same line if your sample is accurate). So you'll want to capture the alternate vendor field, then use an If in a calculation to use either one or the other in your table or summary, something along the lines of:

                 

                [font="courier"]if(vendor1="",vendor2,vendor1)  /font[/quote]naming this calculated field Vendor.

                 

                HTH,

                Kruncher

                • Variable criteria trap
                  Grant Perkins

                  EAS,

                   

                  I see the A team has already been in action for you ...

                   

                  If you want to try something else and file the idea for future reference another option would be to create an append template using the same trap as you detail template. Paint a field for the 'Vendor:" led second lines (starts at a different point to the "Remit to:" lines). In the field's advanced properties set the 'Start field on' value to a preceding string  - "vendor:". End field on - one of the options available that suits the purpose.

                   

                  Add another append in the same way but paint the field for the "remit to:" preceding string position this time and use that as the preceding string.

                   

                  To get whatever value appears in either of those fields to populate a single field simply concatenate the text in a new calculated field and trim out blanks or use a simple IF() formula based on the fact that one field will be populated and the other empty.

                   

                  Your sample allows all of these approaches to work (and there may well be other good approaches too) but sometimes only one of the methods will work fully so it's worth familiarising with all of them given the opportunity!

                   

                  HTH.

                   

                   

                  Grant