--- title: "Using Selection Logic to Build SQL report" slug: "using-selection-logic-to-build-sql-report" updated: 2024-07-17T15:14:16Z published: 2024-07-17T15:14:16Z canonical: "docs.interprose.com/using-selection-logic-to-build-sql-report" --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.interprose.com/llms.txt > Use this file to discover all available pages before exploring further. # Logic Block Selection for SQL Reports This article demonstrates how to retrieve SQL code from Logic Blocks to generate reports in SQL Designer. ## Retrieving the SQL Code 1. Go to **Workflow → Logic Blocks** 2. Click on a Logic Block 3. Click on the Custom Heading Section 4. Click on the Clipboard Icon to copy the full SQL Code ![Click on the Clipboard icon to copy the full SQL](https://cdn.document360.io/6c7303ca-5ffc-4149-8868-8ea498eee635/Images/Documentation/clipboard%20icon.png?sv=2026-02-06&spr=https&st=2026-10-31T15%3A34%3A25Z&se=2026-10-31T16%3A34%3A25Z&sr=c&sp=r&sig=MJbQUmYOuDw9p11K18KnvgY1iWgk6NV6xOCoh0eVW4Q%3D)Image Displays Clipboard Icon ### Using the Selection Logic in SQL Reports 1. Go to **Reports → SQL Designer** 2. Click on New 3. Locate SQL Section, paste the SQL Code into the editor 4. Make necessary modifications based on your specific requirements 5. Ensure all variables and selection logic placeholders (e.g., ${DateRange: DateRange}) are appropriately filled. 6. Click on Test to run the report and see the results based on the selected criteria and data fields. ![](https://cdn.document360.io/6c7303ca-5ffc-4149-8868-8ea498eee635/Images/Documentation/Screenshot 2024-07-17 110318.png?sv=2026-02-06&spr=https&st=2026-10-31T15%3A34%3A25Z&se=2026-10-31T16%3A34%3A25Z&sr=c&sp=r&sig=MJbQUmYOuDw9p11K18KnvgY1iWgk6NV6xOCoh0eVW4Q%3D)Image Displays SQL Code in Editor ### Troubleshooting and Refining 1. If the report doesn't provide the desired output or encounters errors, review the SQL code for any potential issues or syntax errors. 2. Make necessary adjustments and repeat the testing process until the report functions as expected. ### **SQL Report Section** 1. Enter Label: Provide a descriptive label for the SQL report. 2. Enter Identifier: Input an identifier for the report (optional). 3. Enter Description: Optionally, add a description for the report. ### **Output Format Section** 1. Determine Output Format: Select the desired output format from the following options: - HTML - PDF - CSV - EXCEL - TSV - DELIMITED - XML - JSON - FIXED_LENGTH - PIVOT ### **Header Section** 1. Add Header Image (optional): If desired, include an image for the report header. 2. Add Header (optional): Optionally, add a header text for the report. ### **Locate Footer Section** 1. Add Footer (optional): If desired, include a footer text for the report. 2. Click the Save button with the specified settings for future use.