Complex SQL queries

I need to modify the SQL statement before to FR executes it. Parameters it is not enough.

In FR4, I replaced some tags before the preview. For example my SQL statement is:

SELECT * FROM Customer /*WHERE %%MyFilterTag%% ORDER BY %%MyOrderTag%% */

Then, from the source, I replaced %%MyFilterTag%% by my custom filter and %%MyOrderTag%% by my custom sort.
The /* .....*/ is because if I still do not have the tags, the preview window can work without replacing the tags.

It has been working very well in FR4. Now, in FR.Net I have a problem: It deletes the SQL statement.
I mean, I enter the SQL statement, I save the report, I open it again and if I edit the SQL, it has disappeared.

I am using a Firebird connection.

Is there a solution?

Comments

  • edited 6:07AM
    Hello,

    I was not able to reproduce this. Do you have a step-by-step instructions?
  • edited 6:07AM
    Well, playing a little more I have isolated the problem, nothing related with my tag question. It seems that it occurs when there I add more than one line in the SQL. It seems to work with other connections, but not in Firebird.

    For example:

    1-Enter
    SELECT * FROM Customers
    WHERE Id=5

    as sql

    2-Save the report and close the designer

    3-Open the designer and load the report

    4-If you go to see the sql, it is empty.

    If I enter "SELECT * FROM Customers WHERE Id=5", in one line, it works fine.


  • edited 6:07AM
    Here is what I did in the demo.exe:

    - start the report designer;
    - make a new report;
    - select "Data/Add Data Source..." menu item;
    - add new Firebird connection to the demo database which comes with firebird (initial catalog="C:\Program Files\Firebird\Firebird_2_1\examples\empbuild\EMPLOYEE.FDB";user id=sysdba;password=masterkey);
    - press "Add SQL query" button;
    - write the following SQL:
    select * from employee
    where emp_no > 20
    - finish the data wizard;
    - save the report;
    - close the designer;
    - open the designer;
    - load the report;
    - switch to the Data window, select the table and press Edit;
    - the query text is here.

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.