4 Replies Latest reply on Mar 7, 2010 3:32 PM by FentonJones

    Exporting found records from global field

    newlyuser

      Title

      Exporting found records from global field

      Post

      All,

      When I export found records from the global field, it's exporting the found records multiple times. This is how my script it set:

      Set Field (Test::g_field; "")
      Enter Find Mode
      Set Field (Test::Status1; "X")
      New Record/Request
      Set Field (Test::Status2; "X")
      New Record/Request
      Set Field (Test::Status3; "X")
      New Record/Request
      Set Field (Test::Status4; "X")
      Perform Find
      Go to Record/Request/Page[First]
      Loop
      If (Test::Status1 = "X")
      Set Field (Test::g_Field; Test::g_Field &"q" & Test::ID & "," & Test::Name & "," Test::Type
      End If
      If (Test::Status2 = "X")
      Set Field (Test::g_Field; Test::g_Field &"q" & Test::ID & "," & Test::Name & "," Test::Type
      End If
      If (Test::Status3 = "X")
      Set Field (Test::g_Field; Test::g_Field &"q" & Test::ID & "," & Test::Name & "," Test::Type
      End If
      If (Test::Status4 = "X")
      Set Field (Test::g_Field; Test::g_Field &"q" & Test::ID & "," & Test::Name & "," Test::Type
      End If
      Go to Record/Request/Page [Next; Exit after last]
      End Loop
      Export Records [Windows (ANSI)]

      When the export runs, if the found records is 10, the global g_Field have 10 records X 10 times but I only need to see those 10 records one time.

      I have tried Omit Record and Show Omiitted Only from the Found Records, but that does not work either.

      Can anybody provide me some guidance? Thanks!

















        • 1. Re: Exporting found records from global field
          FentonJones

          A global field has only 1 value for all records. But that does not mean it only exists once; it exists once for every record, like any other field.

           

          You would only want to export 1 record (or use Export Field Contents, which is always from only the current record, but is UTF-16 encoded).

           

          Your Omit, Show Omitted Only is on the right track. But to isolate a single record with this method, you need to Show All Records first.* Because when you have a found set it means there is at least 1 record in the "not found" set; in which case omitting a record just adds it to the existing "not found" set, and Show Omitted Only will show more than 1 record.

           

          *Show All Records remains on the record, so it will not be lost.

          • 2. Re: Exporting found records from global field
            newlyuser

            Thank you for the quick response.

             

            Based on your recommendation, I have added the following script in Bold:

             

            Show All Records

            Set Field (Test::g_field; "")
            Enter Find Mode
            Set Field (Test::Status1; "X")
            New Record/Request
            Set Field (Test::Status2; "X")
            New Record/Request
            Set Field (Test::Status3; "X")
            New Record/Request
            Set Field (Test::Status4; "X")
            Perform Find
            Go to Record/Request/Page[First]
            Loop
            If (Test::Status1 = "X")
            Set Field (Test::g_Field; Test::g_Field &"q" & Test::ID & "," & Test::Name & "," Test::Type
            End If
            If (Test::Status2 = "X")
            Set Field (Test::g_Field; Test::g_Field &"q" & Test::ID & "," & Test::Name & "," Test::Type
            End If
            If (Test::Status3 = "X")
            Set Field (Test::g_Field; Test::g_Field &"q" & Test::ID & "," & Test::Name & "," Test::Type
            End If
            If (Test::Status4 = "X")
            Set Field (Test::g_Field; Test::g_Field &"q" & Test::ID & "," & Test::Name & "," Test::Type
            End If
            Go to Record/Request/Page [Next; Exit after last]
            End Loop

            Omit Record

            Show Omitted Only
            Export Records [Unicode (UTF-16)]

            I tried the above changes and still seeing the found records multiple times. Any suggestions or if you can send me the script I should change based on my example. Eg:

             

            123, John Doe, Document1

            456, John Smith, Document2

            789, John Paul, Document3

             

            123, John Doe, Document1

            456, John Smith, Document2

            789, John Paul, Document3

             

             













            • 3. Re: Exporting found records from global field
              newlyuser

              Actually, I changed it to and it worked:

               

              Show All Records

              Omit Records

              Show Omitted Only

               

               

              • 4. Re: Exporting found records from global field
                FentonJones

                Yes, that's what I meant, put the Show All Record right before the Omit; so it is the only record not in the found set. 

                 

                If you (and the receiving applications) happy with UTF-16, then you could just use the Export Field Contents step (which only outputs its specified field from the current record). Then you would not need the whole "omitted" business.