Home General

Using SQL Query/datasource

edited April 2011 in General
I am using ReportBuilder 12.01. I have an Advantage query component with an
InfoPower datasource. They are linked to a data grid. During the course of
the application running, I change the "where" part of the SQL statement to
display different record sets in the grid.

I used the same data source as the data source for the pipeline in a report.
When the report runs, the grid shows the records I want, but when I execute
the report, no records display. I know I'm not supposed to use the same data
source for a grid and the pipeline, so I added a second query component and
data source and activate that query with the same select statement as the
first query component and use the second one for the pipeline. Still no
records display.

If I assign a select statement to the query as a property at the start and
don't modify it in the code, then records do show in the report.

What am I doing wrong in that the records won't show in the report when I
modify the select statement in the code?

thanks

Whitney Cox

Comments

  • edited April 2011
    Hi Whitney,

    When are you making changes to the SQL code? Are these alterations
    happening before you make a call to Report.Print?

    You say when you assign the Select statement as a property, the report
    displays correctly. This leads me to believe that you are modifying the
    SQL statement too late for it to have an effect on the report.


    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited April 2011
    Hello Nico,

    I have a button on a form that I click that modifies the SQL statement,
    executes it and then the records I want to see are displayed in the grid.

    I then click another button after that executes the report.

    When I initially built the report, the SQL component had nothing in its SQL
    property. That was assigned at execution time when I clicked a button. So
    when I built the report, ReportBuilder did not list any field names for the
    pipeline connected to the query component. In order to see the query/tables
    field names, I put a "Select * from tablename" statement in the SQL property
    of the query component, In the design mode then, Report Builder could see
    the table field names. When I then previewed the report, record data
    displayed. I then deleted the SQL text from the query component, ran the
    report, clicked the button to build the SQL statement and it worked. But
    again, when I clicked the button to execute the report, no record data
    displayed

    Whitney



  • edited April 2011
    Hi Whitney,

    For some reason once you add your own SQL statement in code,
    ReportBuilder is not able to access the data. I tested something
    similar using the DBDEMOS database and it functioned correctly.

    Does your pipeline have it AutoCreateFields property set to True? Are
    you certain when you run the report, the pipeline is properly connected
    to the datasourse and report objects? Is the query object opened after
    the SQL is edited?


    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
This discussion has been closed.