### Example: Open Window Painter with Output Logging Source: https://docs.appeon.com/pb2017r3/pbug/ch02s01 This command starts PowerBuilder, opens the Window painter for the 'Client' library within the 'Math' workspace, and directs the session's output to 'math.log'. All files are assumed to be in the current directory. ```bash pb170 /w Math.pbw /l Client.pbl /p window /out math.log ``` -------------------------------- ### PowerScript Trace Data Collection Example Source: https://docs.appeon.com/pb2017r3/pbug/ch32s02 This PowerScript code example demonstrates how to collect trace data. It includes opening a trace file with a specified timer kind, enabling various trace activities, starting and ending trace blocks with labels, disabling specific activities, and finally closing the trace file. Error handling for TraceOpen is shown, and it's noted that return values from other trace calls should also be checked for errors. ```PowerScript ErrorReturn le_err integer li_key TimerKind ltk_kind CHOOSE CASE ddlb_timerkind.Text CASE "None" ltk_kind = TimerNone! CASE "Clock" ltk_kind = Clock! CASE "Process" ltk_kind = Process! CASE "Thread" ltk_kind = Thread! END CHOOSE // Open the trace file and return an error message // if the open fails le_err = TraceOpen( sle_fileName.Text, ltk_kind ) IF le_err <> Success! THEN & of_errmsg(le_err, 'TraceOpen failed') RETURN END IF // Enable trace activities. Enabling ActLine! // enables ActRoutine! implicitly TraceEnableActivity(ActESQL!) TraceEnableActivity(ActUser!) TraceEnableActivity(ActError!) TraceEnableActivity(ActLine!) TraceEnableActivity(ActObjectCreate!) TraceEnableActivity(ActObjectDestroy!) TraceEnableActivity(ActGarbageCollect!) TraceBegin("Trace_block_1") // first block of code to be traced // this block has the label Trace_block_1 … TraceEnd() // disable trace activities not needed for // second block TraceDisableActivity(ActLine! ) TraceDisableActivity(ActObjectCreate!) TraceDisableActivity(ActObjectDestroy!) TraceDisableActivity(ActGarbageCollect!) TraceBegin("Trace_block_2") // second block of code to be traced … TraceEnd() TraceClose() ``` -------------------------------- ### PowerBuilder Command-Line Build and Deploy Example Source: https://docs.appeon.com/pb2017r3/pbug/ch01s09 This example demonstrates how to initiate a build and deploy process for a PowerBuilder workspace from the command line. It specifies the workspace file, triggers a deployment, and logs the output to a file. Ensure the PowerBuilder executable is in your system path. ```shell pb170 /w D:\CDShop\CDShop.pbw /d /out D:\tmp\cdshop.out ``` -------------------------------- ### XML Import: Example with Empty Elements Source: https://docs.appeon.com/pb2017r3/pbug/ch28s06 This XML example shows how empty elements are handled during default data import. Elements with no content, or only whitespace, are imported as empty values. Attributes on empty elements are ignored. ```xml 105 Matthew Cobb 04/12/1960 148 Jordan 6175557835 11/12/1951 ``` -------------------------------- ### MobiLink Synchronization Server: ODBC Connection String Example Source: https://docs.appeon.com/pb2017r3/pbug/ch15s13 An example of an ODBC connection string for the SQL Anywhere demonstration database used when configuring the MobiLink Synchronization Server Options. Ensure no extraneous spaces are included. ```sql DSN=SQL Anywhere 11 Demo;UID=dba;PWD=SQL ``` -------------------------------- ### XML Comment Example Source: https://docs.appeon.com/pb2017r3/pbug/ch28s04 An example of an XML comment. Comments are used to include explanatory text within an XML document that is ignored by the parser. Comments must start with , and cannot contain double hyphens '--'. ```xml ``` -------------------------------- ### AutoScript Partial Name Resolution Example Source: https://docs.appeon.com/pb2017r3/pbug/ch06s05 Illustrates AutoScript's behavior with partial name resolution when a local variable is typed. AutoScript can automatically paste a unique completion if it's the only match starting with the typed characters. ```PowerBuilder long ll_rtn. ll ``` -------------------------------- ### Example: Open DataWindow Object Source: https://docs.appeon.com/pb2017r3/pbug/ch02s01 This command launches PowerBuilder, opens a specified workspace, and then opens a particular DataWindow object ('d_emp_report') from that workspace using the Database painter. ```bash pb170 /w D:\pbws\Emp.pbw /P dataw /O d_emp_report ``` -------------------------------- ### Referencing Window Properties and Methods Source: https://docs.appeon.com/pb2017r3/pbug/ch13s06 Demonstrates how to refer to a window and its properties or methods using the window's name. It shows examples of moving a window and changing its state. Dependencies include having a window object defined in the application. ```PowerBuilder window.property w_cust.Move(300, 300) w_cust.WindowState = Minimized! ``` -------------------------------- ### Right Outer Join Syntax Example Source: https://docs.appeon.com/pb2017r3/pbug/ch17s06 An example of generated SQL syntax for a right outer join, illustrating how PowerBuilder constructs the query when the 'rows from department that have no employee' condition is selected. ```sql SELECT employee.dept_id, department.dept_id FROM {oj "employee" RIGHT OUTER JOIN "department" ON "employee"."dept_id" = "department"."dept_id"} ``` -------------------------------- ### PB Window Open Event Initialization Source: https://docs.appeon.com/pb2017r3/pbug/ch32s02 Initializes default values for the trace window when it opens. Sets the timer kind, captures the initial text of the start/stop button, and sets a default trace file name. ```powerscript application lapp_current lapp_current = getapplication() itk_kind = Clock! is_starttext = cb_startstop.text sle_filename.text = classname(lapp_current)+'.pbp' ``` -------------------------------- ### Example String Display Format Mask Source: https://docs.appeon.com/pb2017r3/pbug/ch21s04 An example of a string format mask used to display phone numbers. The '@' character represents a placeholder for a string character. ```PowerBuilder (@@@) @@@-@@@@ ``` -------------------------------- ### PowerBuilder Resource File (PBR) Sample Source: https://docs.appeon.com/pb2017r3/pbug/ch33s07 This is a sample PowerBuilder resource file (PBR). A PBR file is an ASCII text file used to list resources (like ICO, BMP, PNG files) and DataWindow objects that PowerBuilder will compile into the executable or a dynamic library. Each resource name should be on a new line. This method ensures resources are available directly at runtime without needing to be in the search path. ```text ct_graph.ico document.ico codes.ico button.bmp next1.bmp prior1.bmp background.png ``` -------------------------------- ### PowerBuilder Command Line Syntax Source: https://docs.appeon.com/pb2017r3/pbug/ch02s01 This is the general syntax for starting PowerBuilder from the command line. It allows specifying the PowerBuilder executable, workspace, target, painter, and output file. ```bash directory\pb170.exe {/workspace workspacepath} {/target targetpath} {/painter paintername} {/output outputpath} ``` -------------------------------- ### OrcaScript: Start and End Session Source: https://docs.appeon.com/pb2017r3/pbug/apbs03 Initiates and terminates an OrcaScript session. This is a prerequisite for most OrcaScript operations. Sessions can be started and ended multiple times within a batch file. ```OrcaScript start session end session ``` -------------------------------- ### Extended Options Example for MobiLink Synchronization Source: https://docs.appeon.com/pb2017r3/pbug/ch15s12 Demonstrates how to specify extended options for MobiLink synchronization, including host and port settings. Single quotes are required for values needing quotation marks, and multiple options must be separated by semicolons. This format is crucial for correctly configuring client-side synchronization parameters. ```text scn=on;adr='host=localhost;port=2439' ``` -------------------------------- ### Instantiate and Configure WSConnection Object (PowerBuilder) Source: https://docs.appeon.com/pb2017r3/pbug/ch17s10 This code snippet demonstrates how to instantiate a WSConnection object, set user credentials, endpoint, and authentication mode, and then associate it with a DataWindow control for establishing a connection to a Web service. It handles potential return values from the SetWSObject method. ```PowerBuilder int ii_return wsconnection ws_1 ws_1 = create wsconnection ws_1.username = "johndoe" ws_1.password = "mypassword" ws_1.endpoint = "myendpoint" ws_1.authenticationmode = "basic" ws_1.usewindowsintegratedauthentication = true ii_return = dw_1.setwsobject (ws_1) ``` -------------------------------- ### Defining GROUP BY Criteria with SQL Example Source: https://docs.appeon.com/pb2017r3/pbug/ch17s06 This snippet demonstrates how to define GROUP BY criteria in a SQL SELECT statement, which is used to group retrieved rows. The example shows grouping by 'dept_id' and calculating the sum and average salary for each department. ```sql SELECT dept_id, sum(salary), avg(salary) FROM employee GROUP BY dept_id ``` -------------------------------- ### AutoScript List Display Example Source: https://docs.appeon.com/pb2017r3/pbug/ch06s05 Shows how AutoScript displays a comprehensive list of properties, events, functions, variables, and statements that begin with a specific character when typed in a script. ```PowerBuilder d ``` -------------------------------- ### ANSI Nested Outer Join Example with Escape Notation Source: https://docs.appeon.com/pb2017r3/pbug/ch17s06 An example demonstrating nested ANSI outer joins using escape notation {oj ...}. This syntax is typically parsed by the driver and replaced with DBMS-specific grammar for execution. ```sql SELECT Table1.col1, Table2.col1, Table3.col1 FROM {oj {oj Table1 LEFT OUTER JOIN Table2 ON Table1.col1 = Table2.col1} LEFT OUTER JOIN Table3 ON Table2.col1 = Table3.col1} ``` -------------------------------- ### Custom Validation Error Message Example Source: https://docs.appeon.com/pb2017r3/pbug/ch21s11 An example of a custom error message for a validation rule. This message provides specific instructions to the user when the validation fails, in this case for a 'Salary' column. ```PowerScript Please enter a salary greater than $10,000. ``` -------------------------------- ### PB Instance Variables for Trace Window Source: https://docs.appeon.com/pb2017r3/pbug/ch32s02 Defines instance variables used within the 'w_starttrace' window for managing tracing options and state. Includes TimerKind, trace file name, and button text. ```powerscript TimerKind itk_kind string is_title = 'Trace Options ' string is_starttext ```