13.07.2015 Views

Reports & Queries - Source : www.pcsoft-windev-webdev.com

Reports & Queries - Source : www.pcsoft-windev-webdev.com

Reports & Queries - Source : www.pcsoft-windev-webdev.com

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

5. Enter the name and caption of the query.6. Select the Select queries that will be used in the Union query (left box).Note: The result items of the Union query will be the items of the first query run.7. Specify whether the duplicates must be kept or not ("Retain duplicates/Delete the duplicates").8. Sort the result of the query if necessary ("Sort" button).9. Validate the description window of the query. The graphic representation of the query is automaticallydisplayed in the query editor.10. Save the query ( among the quick access buttons of the ribbon).Note: To view the SQL code corresponding to this query, select "SQL code" from the popup menu of the query.If modifications are performed in the description of the query, these modifications will be automatically carriedover into the corresponding SQL code.2.7 Query in SQL codeThe previous paragraphs explained how to create a query with the wizard. The query editor also allows you tocreate a query in SQL code directly (if you are familiar with this language).ImportantThe following SQL <strong>com</strong>mands are not allowed in <strong>Reports</strong> & <strong>Queries</strong>:•INSERT•UPDATE•DELETE2.7.1 Creating a query in SQL codeTo create a query in SQL code:1. Start the wizard for creating queries:• click among the quick access buttons.• click "Query" in the wheel that is displayed.2. Specify that you want to create a query by entering the SQL code directly ("SQL code" option).3. If your project is not linked to a WinDev or WebDev analysis, specify the analysis to which the querymust be linked. Validate the wizard screen.4. Enter the name of the query (name of the ".WDR" file corresponding to the query). This name will beused to identify the query in your programs.5. Specify the caption of the query by briefly describing the purpose of the query. This caption will beused in the project documentation.Note: The name of the query is automatically defined from the caption.6. Validate the creation of the query. A code window is displayed.7. Enter the SQL code of your query. You have the ability to insert into the query:• <strong>com</strong>ments by writing the "--" or "//" character in front of them. Only the <strong>com</strong>ments about the selectionconditions will be taken into account during the reverse engineering of the query: the other <strong>com</strong>mentswill be automatically deleted. The <strong>com</strong>ments about the selection conditions with parameters will notbe proposed when running a GO of the query.• WLanguage functions. The WLanguage functions must be prefixed by "WL.". The assisted input isavailable. The WLanguage functions can be nested. Example:SELECT CUSTOMER.CustomerNum FROM CUSTOMERWHERE WL.Left(Customer.ZipCode,2)=758. Save the SQL code ( among the quick access buttons of the ribbon) and close the code editor. Agraphic representation of the SQL query is displayed.Part 2: Query editor 177

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!