1 Reply Latest reply: May 15, 2014 10:02 AM by Grant Perkins RSS

    Conditional Trap

    Tourneau - Jim

      Working with a file that has corresponding lines for some records and none for others...


      Each Item could have no associated serial numbers or many.


      Vendor's                   Item    

      Item Num         Loc    Number  


      451902T           10   BOXT45192


      WJF1153.          10   HEU0164281





      Any ideas on how to show results as seen below?


      451902T           10   BOXT45192

      WJF1153.          10   HEU0164281   06189880

      WJF1153.          10   HEU0164281   06451934



      Been trying everything (Footer field with Advanced: Preceding String #, Stop at blank)



        • Conditional Trap
          Grant Perkins

          Hi Jim and welcome to the forum.


          I see this is mostly an output format requirement issue - is that how you see it?


          The word 'many' relating to serial numbers stops me looking for a fancy solution. (probably just as well ...!)


          I think I would be looking to process this in several steps.


          Something like;


          1. Process for serial number items only.


          Detail = serial number,  Append 1= Item number line, append 2 = Vendor info.



          2. Process for lines without serial numbers only.


          Detail = Item line, Append 1 = Vendor info.


          3. Process the Vendor Info line only.


          Make it a detail and select nothing else to go with it.


          Ensure that all three outputs have the same format (you may need to 'cheat' with some dummy fields for the second one) and export them to the same file. (A fixed column width report file may be best ....)


          In a new session open the newly created file (this will likely work as a database read if you have Monarch Pro) and generate a SUMMARY sorted in the order


          Vendor info, Item info, serial number.


          This shoulr result in


          A line for a Vendor number

          A line for vendor and item detasils

          Lines with vendor, item and serial number details.


          Set the Vendor related field(s) in the summary to SUPPRESS duplicates.


          Export the result.


          You should now be quite close to what you need other than all the deatilas under each vendor info will be offset to the right.


          If you need to fix that you could export the result to a TEXT file (i.e. a report file) then re-read THAT file in another Monarch session and smply select every line making each line a single field. If you then TRIM (or LTRIM) the lines (using a new calculated field ) you can remove the leading spaces and get the format you require.


          The process can be automated with a batch file.


          Caveat: I have not checked which version of Monarch you have. V8 onwards should (iirc) allow you to export directly to a common file using the append option. Earlier versions may require you to export to separate fiels and then concatentate them by one of several methods - open all three ion the same Monarch session for example.


          I do assume here that you can create the trapping rules necessary to separate the 3 different data sections. If that is not possible we may need to look for an alternative approach.



          If you can see a way to set an easily identifiable  'psuedo' serial number for non-serial number records then the process can be reduced to 2 steps - or even one step if the format requirement for a solus vendor detail line can be dropped.


          Does this help at all?