### Genero BDL: Defining and Generating Reports Source: https://4js.com/online_documentation/fjs-genero-3.21.09-manual-tutorial-html Explains the structure of Genero BDL reports, including the DEFINE, ORDER BY, and FORMAT sections, and provides an example of a customer report. ```BDL -- Example: Customer Report Definition REPORT CustomerReport DEFINE -- Define variables and fields here v_customer_name string ENDDEFINE ORDER BY name FORMAT -- Define the report layout and content PAGE HEADER PRINT "Customer Report" ENDPAGE HEADER DETAIL PRINT customer_id, name, email ENDDETAIL PAGE TRAILER PRINT "Page " + page_number ENDPAGE TRAILER ENDFORMAT ENDREPORT ``` -------------------------------- ### Genero BDL: Enhancing Forms with Toolbars and Menus Source: https://4js.com/online_documentation/fjs-genero-3.21.09-manual-tutorial-html Provides examples of how to add interactive elements like toolbars and top menus to Genero forms, improving user interface and navigation. ```BDL -- Example: custform.per (Adding a Toolbar) TOOLBAR BUTTON "New" ACTION new_customer BUTTON "Save" ACTION save_customer ENDTOOLBAR -- Example: custform.per (Adding a Topmenu) TOPMENU MENU "File" ITEM "Open" ACTION open_file ITEM "Save" ACTION save_file SEPARATOR ITEM "Exit" ACTION exit_program ENDMENU ENDTOPMENU ``` -------------------------------- ### Genero BDL: Implementing Query-by-Example Source: https://4js.com/online_documentation/fjs-genero-3.21.09-manual-tutorial-html Details the implementation of a Query-by-Example feature in Genero BDL, including steps for constructing SQL statements and handling user input for query criteria. ```BDL -- Example module: custquery.4gl (Function get_cust_cnt) function get_cust_cnt() returns integer define v_count integer -- Construct the SQL statement based on user input construct v_sql_query from "select count(*) from customers where name like ?" prepare stm from v_sql_query execute stm using v_customer_name fetch stm into v_count return v_count end function ``` -------------------------------- ### Genero BDL: Connecting to a Database Source: https://4js.com/online_documentation/fjs-genero-3.21.09-manual-tutorial-html Illustrates how to establish a connection to a database using Genero BDL. This program is essential for data-driven applications. ```BDL program connectdb -- Connect to the database (e.g., using connection string) connect to database 'mydatabase' user 'myuser' password 'mypass' if status = 0 then display "Successfully connected to the database." else display "Failed to connect to the database." end if -- Disconnect from the database disconnect end program ``` -------------------------------- ### Genero BDL: Compiling and Executing a Simple Program Source: https://4js.com/online_documentation/fjs-genero-3.21.09-manual-tutorial-html Demonstrates the process of compiling and executing a basic Genero BDL program. This is a foundational step for any BDL development. ```BDL program simple_program main display "Hello, Genero!" end program ``` -------------------------------- ### Genero BDL: Using Cursors for Data Retrieval Source: https://4js.com/online_documentation/fjs-genero-3.21.09-manual-tutorial-html Explains how to use cursors in Genero BDL to fetch data from the database row by row. This is crucial for processing large result sets efficiently. ```BDL -- Example module: custquery.4gl (function cust_select) function cust_select() declare c_customer cursor for select customer_id, name, email from customers open c_customer -- Process rows using fetch fetch c_customer into v_cust_id, v_cust_name, v_cust_email while SQLCODE = 0 -- Process the fetched row fetch c_customer into v_cust_id, v_cust_name, v_cust_email end while close c_customer end function ``` -------------------------------- ### Genero BDL: Error Handling with WHENEVER ERROR Source: https://4js.com/online_documentation/fjs-genero-3.21.09-manual-tutorial-html Demonstrates how to implement robust error handling in Genero BDL using the WHENEVER ERROR statement to manage database errors and exceptions. ```BDL program error_handling -- Define error handling block whenever error display "An error occurred: " + SQLERRMESSAGE -- Close cursor if open if cursor_is_open(c_mycursor) then close c_mycursor end if -- Exit program or perform other error recovery exit program end whenever -- Database operations that might cause errors -- ... end program ``` -------------------------------- ### Genero BDL: Displaying Data in Screen Arrays (TABLE) Source: https://4js.com/online_documentation/fjs-genero-3.21.09-manual-tutorial-html Explains how to use screen arrays and TABLE containers in Genero BDL forms to display multiple rows of data, enhancing the presentation of tabular information. ```BDL -- Example: manycust.per (Form definition with TABLE) FORM -- ... other form elements ... TABLE many_customers COLUMNS 3 WIDTH 100 ROW HEIGHT 1 HEADER "ID", "Name", "Email" DATA customer_id, name, email ENDTABLE -- ... other form elements ... ENDFORM ``` ```BDL -- Example Library module: cust_lib.4gl (Loading the Array) function load_customer_array() define v_cust_record like customers.* define i integer -- Clear the array before loading remove many_customers.* -- Fetch data and populate the array foreach v_cust_record in customers let i = i + 1 let many_customers[i].customer_id = v_cust_record.customer_id let many_customers[i].name = v_cust_record.name let many_customers[i].email = v_cust_record.email end foreach end function ``` -------------------------------- ### Genero BDL: Retrieving and Displaying Customer Data Source: https://4js.com/online_documentation/fjs-genero-3.21.09-manual-tutorial-html Shows how to retrieve customer data from a database and display it in a window using Genero BDL. It involves opening windows, interacting with the user, and querying data. ```BDL program dispcust -- Open the main window and the customer form open window 1 from "custform.per" open form 1.1 from "custform.per" -- Retrieve and display customer data query cust.* display cust.* -- Handle user interaction (e.g., closing the form) accept close form 1.1 close window 1 end program ``` -------------------------------- ### Genero BDL: Adding, Updating, and Deleting Records Source: https://4js.com/online_documentation/fjs-genero-3.21.09-manual-tutorial-html Covers the essential operations of adding new records, updating existing ones, and deleting records from database tables using Genero BDL's INPUT and SQL statements. ```BDL -- Example: Module custquery.4gl (function insert_cust) function insert_cust(v_cust_id integer, v_name string, v_email string) -- Insert a new customer record insert into customers (customer_id, name, email) values (v_cust_id, v_name, v_email) end function -- Example: Module custquery.4gl (function update_cust) function update_cust(v_cust_id integer, v_name string, v_email string) -- Update an existing customer record update customers set name = v_name, email = v_email where customer_id = v_cust_id end function -- Example: Deleting a Row -- ... SQL DELETE statement ... ``` -------------------------------- ### Genero BDL: Array Input for Data Modification Source: https://4js.com/online_documentation/fjs-genero-3.21.09-manual-tutorial-html Details the INPUT ARRAY statement in Genero BDL, allowing users to efficiently input and modify multiple records displayed in a screen array. ```BDL -- Example: Function inparr_custall in custquery.4gl function inparr_custall() -- Input data into the screen array input array many_customers -- Process changes after input if status = 0 then call store_num_ok() end if end function ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.