Automate

 View Only
Expand all | Collapse all

Query Returns Number of Records But Won't Pull Data

  • 1.  Query Returns Number of Records But Won't Pull Data

    Posted 04-30-2025 16:34

    Hi!

    I have written a query that, when I check the number of entries, pulls the correct number. However, when I run the query, it times out and will not return the records.

    Any suggestions as to what could be causing this?



    ------------------------------
    Michelle Briggs
    KIK Holdco Company Inc
    ------------------------------


  • 2.  RE: Query Returns Number of Records But Won't Pull Data

    Posted 05-01-2025 08:27

    I had the same problem before. Schedule the job to run in the background. Sometimes it's too large to run it, but if you schedule it to run it works.



    ------------------------------
    James Polley
    RAYTHEON COMPANY
    ------------------------------



  • 3.  RE: Query Returns Number of Records But Won't Pull Data

    Posted 05-01-2025 11:37

    Hi, James-

    I took your suggestion, and received this error message.

    Title of scheduled run: 
    Schedule for [Table_20250430_162118]Reason for run failure:
    An exception occurred while running the Query script as an SAP background process. For details, enable SAP trace in the Studio Options box, re-run the Query script, and review the trace file.



    ------------------------------
    Michelle Briggs
    KIK Holdco Company Inc
    ------------------------------



  • 4.  RE: Query Returns Number of Records But Won't Pull Data

    Employee
    Posted 05-01-2025 11:26

    If the data volume is really high, you might be hitting a timeout limit on the server, you can try checking the Data Chunk box - below is the documentation. 

    You can find it under Query Run Settings. 



    ------------------------------
    Jayasri Varyani
    SE
    Precisely Software Inc.
    ------------------------------



  • 5.  RE: Query Returns Number of Records But Won't Pull Data

    Posted 05-01-2025 11:38

    Hi, Jayasri-

    The record count is 552, so I don't know if that would be an issue.



    ------------------------------
    Michelle Briggs
    KIK Holdco Company Inc
    ------------------------------



  • 6.  RE: Query Returns Number of Records But Won't Pull Data

    Employee
    Posted 05-01-2025 11:48

    lol okay! :)

    Then it sounds like a bug to me, that it would not load 552 records. Please create a support ticket so they can look at the logs and possibly find out what is causing the behavior. 



    ------------------------------
    Jayasri Varyani
    SE
    Precisely Software Inc.
    ------------------------------



  • 7.  RE: Query Returns Number of Records But Won't Pull Data

    Posted 05-01-2025 11:58

    Will do! Thanks for the help.



    ------------------------------
    Michelle Briggs
    KIK Holdco Company Inc
    ------------------------------



  • 8.  RE: Query Returns Number of Records But Won't Pull Data

    Employee
    Posted 05-01-2025 13:25

    Hi Michelle 

    Can you do the preview run in Studio?

    Also if the dataset is large, you can try to set Throttling and Chunking - settings are here in the documentation; https://help.precisely.com/r/t/1016755938/2023-12-31/Automate-Studio/Connect/Latest/en-US/Automate-Studio-with-Studio-Administrator-User-Guide/Run-settings-for-Query

    Happy to look at the Query if you want to share it, as well.

    Best Regards,

    Sigrid



    ------------------------------
    Sigrid Kok
    *Precisely Software Inc.
    ------------------------------



  • 9.  RE: Query Returns Number of Records But Won't Pull Data

    Posted 05-01-2025 13:32

    Hi, Sigrid-

    I cannot do the preview run. It times out.

    The record count shows 552 (which is correct), so I'm not sure where the disconnect lies.



    ------------------------------
    Michelle Briggs
    KIK Holdco Company Inc
    ------------------------------

    Attachment(s)

    Qsq
    Table_20250430_162118.Qsq   361 KB 1 version


  • 10.  RE: Query Returns Number of Records But Won't Pull Data

    Employee
    Posted 05-01-2025 20:35
      |   view attached

    Hi Michelle

    That's quite a spider web of joins :) which I understand happens automatically. Nearly all joins are on key fields, which is great, except for the one non-key column condition record number, which you can't help.  And I know condition tables can grow to be quite large, adding in the Material table which can also get large.  

    I'd suggest:

    (1) not joining all of the SPRAS fields to each other in each table - you have conditions on each one already.

    (2) since you go from MARA to A843, which I'm assuming is a custom condition table, that you join KAPPL in that table to the other tables - not also to each other.  

    Try that - have attached a slightly cleaned up example,  but I cannot test it because I don't have your condition table.

    (3) If that still hangs, try to drop the text tables T685T and TVKGGT and try again.  if that works, add one of them and try again.

    When I create queries, I start with one table with fields and conditions.  Then I add another table with conditions and test, ensuring I'm getting data and no-duplicates.  # Records is good but I do a preview of the first 100 matches.  When that's good, I add the next one, and repeat.  That usually helps me uncover missing conditions or incomplete/incorrect joins or system hangs.  Sometimes the order in which you add the tables makes a difference, but not usually.

    I hope that helps a little.

    Best Regards,

    Sigrid



    ------------------------------
    Sigrid Kok
    *Precisely Software Inc.
    ------------------------------

    Attachment(s)

    Qsq
    Table_20250430_162118_sk.Qsq   356 KB 1 version


  • 11.  RE: Query Returns Number of Records But Won't Pull Data

    Posted 05-02-2025 09:49

    Hi, Sigrid-

    Removing the SPRAS joins fixed it.

    Thanks so much for the help, and have a great weekend!



    ------------------------------
    Michelle Briggs
    KIK Holdco Company Inc
    ------------------------------



  • 12.  RE: Query Returns Number of Records But Won't Pull Data

    Employee
    Posted 05-02-2025 10:05

    Excellent, Michelle!  Thanks for letting us know.

    Best Regards & TGIF! :)

    Sigrid



    ------------------------------
    Sigrid Kok
    *Precisely Software Inc.
    ------------------------------