### Import and Start Form with TypeScript Source: https://github.com/prioritysoftware/prioritysoftware.github.io/blob/master/_api/1.introduction.md Import necessary types and functions from the SDK to start a form. This example demonstrates basic form initialization and type hinting for TypeScript projects. ```typescript import { formStart, Form } from 'priority-web-sdk' let myForm : Form; startForm('CUSTOMERS',...).then((form: Form) => { // do something }) ``` -------------------------------- ### Example: INSTITLE for version 34 from Hebrew to English Source: https://github.com/prioritysoftware/prioritysoftware.github.io/blob/master/_sdk/Customizations-Language-Dictionaries.md This example shows how to generate an upgrade file for version 34, specifically extracting titles from a Hebrew installation to an English target. ```sql EXECUTE INSTITLE -l', '3', '..\..\system\upgrades\34.sh', '..\..\system\upgrades\34-inst.sh '; ``` -------------------------------- ### File Listing Example Source: https://github.com/prioritysoftware/prioritysoftware.github.io/blob/master/_sdk/Interact-with-External-Systems.md An example procedure that lists files in a directory, filters them, and then copies and loads them using COPYFILE and DBLOAD. ```SQL :DIR = STRCAT(SYSPATH('SYNC', 1),'tmpDir'); SELECT SQL.TMPFILE INTO :ST6 FROM DUMMY; SELECT SQL.TMPFILE INTO :MSG FROM DUMMY; EXECUTE FILELIST :DIR,:ST6,:MSG; /* In the linked file of the STACK6 table, you will find all files and folders under the input directory :DIR. */ LINK STACK6 TO :ST6; GOTO 99 WHERE :RETVAL <= 0; DECLARE NEWFILES CURSOR FOR SELECT TOLOWER(NAME) FROM STACK6 WHERE TOLOWER(NAME) LIKE ' loadorder*'; OPEN NEWFILES; GOTO 90 WHERE :RETVAL <= 0; :FILENAME = ''; :TOFILENAME = STRCAT(SYSPATH('LOAD', 1), 'Example.load'); LABEL 10; FETCH NEWFILES INTO :FILENAME; GOTO 85 WHERE :RETVAL <= 0; :PATH = STRCAT(:DIR,'/',:FILENAME); /* now the variable :path holds the filename */ /* there are 2 options to execute the DBLOAD */ /* option 1: */ EXECUTE COPYFILE :PATH, :TOFILENAME; /* here you need to make sure you define the load Example.load */ EXECUTE DBLOAD '-L', 'Example.load'; /* option 2: add two more parameters to the DBLOAD program; these parameters tell the DBLOAD program to load the file that comes after the -i option */ EXECUTE DBLOAD '-L', 'Example.load', -i, :PATH; LOOP 10; LABEL 85; CLOSE NEWFILES; LABEL 90; UNLINK STACK6; LABEL 99; ``` -------------------------------- ### Example: INSTITLE for version 34 Source: https://github.com/prioritysoftware/prioritysoftware.github.io/blob/master/_sdk/Customizations-Language-Dictionaries.md This example demonstrates the SQL command to generate an upgrade file for version 34, including all translated titles. ```sql EXECUTE INSTITLE '..\..\system\upgrades\34.sh', '..\..\system\upgrades\34-inst.sh'; ``` -------------------------------- ### WINHTML Direct Mode Example (Standard Table) Source: https://github.com/prioritysoftware/prioritysoftware.github.io/blob/master/_sdk/WINHTML.md Example of running WINHTML in direct mode for a standard table without linked files. ```sql EXECUTE WINHTML '-d', 'WWWSHOWORDER', '', '', ``` -------------------------------- ### Get File Size Example Source: https://github.com/prioritysoftware/prioritysoftware.github.io/blob/master/_sdk/Interact-with-External-Systems.md Example of using GETSIZE in a procedure step to retrieve and process a file's size. ```SQL LINK STACK TO :$.STK; ERRMSG 500 WHERE :RETVAL <= 0; EXECUTE GETSIZE 'path/file_name', :$.STK; :FILESIZE = 0; SELECT ELEMENT INTO :FILESIZE FROM STACK WHERE ELEMENT > 0; UNLINK STACK; ``` -------------------------------- ### Get File Date Example Source: https://github.com/prioritysoftware/prioritysoftware.github.io/blob/master/_sdk/Interact-with-External-Systems.md Example of using GETDATE in a procedure step to retrieve and process a file's date. ```SQL LINK STACK TO :$.STK; ERRMSG 1 WHERE :RETVAL <= 0; EXECUTE GETDATE 'path/file_name', :$.STK; :FILEDATE = 0; SELECT ELEMENT INTO :FILEDATE FROM STACK WHERE ELEMENT > 0; UNLINK STACK; ``` -------------------------------- ### ODBC URL Transformation Example Source: https://github.com/prioritysoftware/prioritysoftware.github.io/blob/master/_general/ODBC.md This example shows how to transform a standard URL into an ODBC URL for connection. ```text www.example.com/prirotiy/odata/Priority/tabula.ini/comp Would become: www.example.com/prirotiy/odbc ``` -------------------------------- ### Install Bundler and Dependencies Source: https://github.com/prioritysoftware/prioritysoftware.github.io/blob/master/README.md Installs the Bundler gem and then installs all project dependencies required to run the Jekyll site locally. Ensure you are in the repository's root directory. ```bash $ cd path/to/this/repository $ gem install bundle $ bundle install ``` -------------------------------- ### Example: Debugging Sales Orders BPM Flow Chart Source: https://github.com/prioritysoftware/prioritysoftware.github.io/blob/master/_sdk/BPM-Debugging.md An example command to debug the 'BPM Flow Chart -- Sales Orders' in Windows, specifying the debug file path. ```bash BPM O -g ..\..\bpm_O.dbg ``` -------------------------------- ### activateStart Source: https://github.com/prioritysoftware/prioritysoftware.github.io/blob/master/_api/5.form.md Starts an Action, which is a Procedure. This function is used to initiate a process or report execution. ```APIDOC ## activateStart(ename, type, progressCallback) ### Description Starts an Action, which is defined as a [Procedure](../procedure/#procedure). This function is used to initiate the execution of a report or a procedure. ### Method Not specified (assumed to be a JavaScript function call) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters - **ename** (string) - The name of the procedure or report to be started. - **type** (string) - Specifies the type of action: 'R' for reports, 'P' for procedures. - **progressCallback** ([`ProcProgressCallback`](#../procedure/#ProcProgressCallback)) - A callback function that is invoked periodically to indicate progress, typically for displaying a progress bar when the activation takes time. ### Returns - **Promise** - Fulfills with an `Object` upon successful start. - **Reject**: `Object`. See [`ProcErrorCallback`](#../procedure/#ProcErrorCallback) for error details. ``` -------------------------------- ### Using STACK_ERR for Multi-Interface Error Handling Source: https://github.com/prioritysoftware/prioritysoftware.github.io/blob/master/_sdk/STACKERR.md This SQL example demonstrates how to use the '-stackerr' option to manage errors from multiple sequential interfaces. It shows the setup of temporary files, linking and unlinking interfaces, inserting data, executing interfaces with '-stackerr', and finally linking and selecting from the STACK_ERR table to view detailed error messages for each interface. ```sql SELECT SQL.TMPFILE INTO :G1 FROM DUMMY; SELECT SQL.TMPFILE INTO :G2 FROM DUMMY; SELECT SQL.TMPFILE INTO :S1 FROM DUMMY; SELECT SQL.TMPFILE INTO :S2 FROM DUMMY; LINK GENERALLOAD ORD TO :G1; GOTO 99 WHERE :RETVAL <= 0; LINK GENERALLOAD DOC TO :G2; GOTO 99 WHERE :RETVAL <= 0; INSERT INTO GENERALLOAD ORD(LINE,RECORDTYPE,TEXT2) SELECT SQL.LINE, '1', CPROFNUM FROM CPROF WHERE PDATE = SQL.DATE8; EXECUTE INTERFACE 'OPENORDBYCPROF', SQL.TMPFILE, '-L', :G1, '-stackerr', :S1; INSERT INTO GENERALLOAD DOC(LINE,RECORDTYPE,TEXT1) SELECT SQL.LINE, '1', ORDNAME FROM ORDERS, GENERALLOAD ORD WHERE ORD.LOADED = 'Y' AND ORDERS.ORD = ATOI(ORD.KEY1); UNLINK GENERALLOAD ORD; EXECUTE INTERFACE ' OPENDOC', SQL.TMPFILE, '-L', :G2, '-stackerr', :S2; UNLINK GENERALLOAD DOC; LINK STACK_ERR S1 TO :S1; GOTO 99 WHERE :RETVAL <= 0; SELECT * FROM STACK_ERR S1 FORMAT; UNLINK STACK_ERR S1; LINK STACK_ERR S2 TO :S2; GOTO 99 WHERE :RETVAL <= 0; SELECT * FROM STACK_ERR S2 FORMAT; UNLINK STACK_ERR S2; LABEL 99; ``` -------------------------------- ### Include Buffer Example Source: https://github.com/prioritysoftware/prioritysoftware.github.io/blob/master/_sdk/Include-Triggers.md This example shows how to include a shared buffer trigger, TRANSTRIG/BUF10, which contains common SQL statements for checking 'CANCEL' and 'FINAL' statuses in various document sub-level forms. ```SQL #INCLUDE TRANSTRIG/BUF10 /* Check CANCEL and FINAL */ ``` -------------------------------- ### Word Templates Array Example Source: https://github.com/prioritysoftware/prioritysoftware.github.io/blob/master/_api/7.procedure.md Shows an example object from the 'wordTemplates' array within documentOptions. Each object indicates if a template is selected, its ID, and its title. ```javascript selected: 1 template: -3 title: "Predefined Template" ``` -------------------------------- ### Detailed Driver Log Entry Example Source: https://github.com/prioritysoftware/prioritysoftware.github.io/blob/master/_general/ODBC.md An example of a detailed log entry from the Priority ODBC driver, showing a connection error with a 'Bad Gateway' status and Chilkat log details. ```log 14-03-2024 17:44:44,396[ERROR][ST584][4848]: connection error (502): got response from https://st584.ceshbel.co.il/odbc/ExecDirect with error: 'ChilkatLog: PostJson2: DllDate: Jul 25 2023 ChilkatVersion: 9.5.0.95 UnlockPrefix: PRTYSF UnlockStatus: 2 Architecture: Little Endian; 64-bit Language: Visual C++ 2022 / x64 VerboseLogging: 0 url: https://st584.ceshbel.co.il/odbc/ExecDirect contentType: application/json jsonUtf8Size: 150 fullRequest: a_synchronousRequest: generateRequestHeader: sbHost0: st584.ceshbel.co.il httpRequestGenStartLine: genStartLine: startLine: POST /odbc/ExecDirect HTTP/1.1 --genStartLine --httpRequestGenStartLine --generateRequestHeader fullHttpRequest: domain: st584.ceshbel.co.il port: 443 ssl: True openHttpConnection: Opening connection directly to HTTP server. httpHostname: st584.ceshbel.co.il httpPort: 443 tls: True HTTPS secure channel established. --openHttpConnection connectTime: Elapsed time: 31 millisec sendRequestHeader: sendHeaderElapsedMs: 0 --sendRequestHeader sendRequestBody: sendBodyElapsedMs: 0 --sendRequestBody statusCode: 502 statusText: Bad Gateway --fullHttpRequest success: 1 --a_synchronousRequest success: True --fullRequest Success. --PostJson2 urlObject_loadUrl: --urlObject_loadUrl --ChilkatLog ``` -------------------------------- ### ODBC Connection String Example Source: https://github.com/prioritysoftware/prioritysoftware.github.io/blob/master/_general/ODBC.md Use this connection string format to connect to the ODBC data source directly from your code. ```text Driver=Priority ODBC Unicode Driver;Server=;Tabulaini=tabula.ini;Database=;Lang=3;User=;Pwd= ``` -------------------------------- ### Start a Report Procedure Source: https://github.com/prioritysoftware/prioritysoftware.github.io/blob/master/_api/8.procedure_example.md Initiates a specific report procedure, identified by its name and a parameter. This is the first step in running a report. ```javascript let procStepResult = await priority.procStart('ABCRAW', 'P'); ``` -------------------------------- ### Run MS-Word using WINAPP Source: https://github.com/prioritysoftware/prioritysoftware.github.io/blob/master/_sdk/Interact-with-External-Systems.md Executes Microsoft Word using the WINAPP command. This example specifies the path to the executable. ```sql EXECUTE WINAPP 'C:\Program Files\Microsoft Office\Office', 'WINWORD.EXE'; ``` -------------------------------- ### Initialize and Login to Priority Source: https://github.com/prioritysoftware/prioritysoftware.github.io/blob/master/_api/8.procedure_example.md Sets up the configuration and logs in to the Priority system. Ensure your configuration object reflects your environment. ```javascript "use strict"; const priority = require('priority-web-sdk'); const conf = { username: 'me', password: 'xxxx', url: 'https://www.eshbelsaas.com', tabulaini: 'tabula.ini', language: 3, company: 'ui' }; (async () => { try { await priority.login(conf); ``` -------------------------------- ### Batch Operation Response Payload Example Source: https://github.com/prioritysoftware/prioritysoftware.github.io/blob/master/_restapi/6.restModify.md This is an example of a multipart/mixed response payload for a batch operation. It includes the results of the individual requests, such as the HTTP status and the JSON body for a successful GET operation. ```json --batchresponse_8e86ef59-cb2c-4e46-b442-c8919a2826e9 Content-Type: multipart/mixed; boundary=changesetresponse_8917b75c-eae7-42a0-bbd8-443db93f1ca6 --changesetresponse_8917b75c-eae7-42a0-bbd8-443db93f1ca6 Content-Type: application/http Content-Transfer-Encoding: binary Content-ID: g1-r1 HTTP/1.1 200 OK Content-Type: application/json; odata.metadata=minimal; odata.streaming=true OData-Version: 4.0 {"@odata.context":"https://www.eshbelsaas.com/ui/odata/Priority/tabmob.ini/usdemo/$metadata#FAMILY_LOG/$entity","FAMILYNAME":"765","FAMILYDESC":"My OData Family","EFAMILYDES":null,"TECHFLAG":null,"DEBITFLAG":null,"PROJPROCESS":null,"TECHNICIANLOGIN":null,"FTCODE":null,"FTNAME":null,"DISTRFLAG":null,"DUTYPERCENT":0.00,"DUTYPERCENT1":0.00,"DUTYPERCENT2":0.00,"DUTYPERCENTTYPE":null,"SELLFLAG":null,"NEGBALFLAG":null,"FORECAST":null,"PARTNAME":null,"PARTDES":null,"STORAGETYPECODE":null,"STORAGETYPEDES":null,"SERIALMONTHEXPIRY":null,"ISMFAMILY":null,"MFAMILYNAME":null,"MFAMILYDES":null,"INACTIVE":null,"METERFLAG":null,"FAMILY":198} --changesetresponse_8917b75c-eae7-42a0-bbd8-443db93f1ca6-- --batchresponse_8e86ef59-cb2c-4e46-b442-c8919a2826e9 Content-Type: application/http Content-Transfer-Encoding: binary ``` -------------------------------- ### Complex GET Request with Combined Query Options Source: https://github.com/prioritysoftware/prioritysoftware.github.io/blob/master/_restapi/5.restQuery.md This example demonstrates a single GET request combining $filter, $expand, and $select options to retrieve detailed order information, including nested subforms and their specific fields. ```http GET serviceRoot/ORDERS?$filter=CUSTNAME eq '1011'&$expand=ORDERITEMS_SUBFORM($filter=PRICE gt 3;$select=CHARGEIV,KLINE,PARTNAME,PDES,TQUANT,PRICE; $expand=ORDISTATUSLOG_SUBFORM),SHIPTO2_SUBFORM, ORDERSTEXT_SUBFORM&$select=CUSTNAME,CDES,ORDNAME ``` -------------------------------- ### Execute Report with WINACTIV Source: https://github.com/prioritysoftware/prioritysoftware.github.io/blob/master/_sdk/Run-Procedure-SQLI.md This example demonstrates executing a report ('OPENORDIBYDOER') using the WINACTIV command. It includes steps to set an output file, select a temporary file, link a table, insert data, and then execute the report. ```sql :F = '../../output.txt'; SELECT SQL.TMPFILE INTO :CST FROM DUMMY; LINK CUSTOMERS TO :CST; GOTO 299 WHERE :RETVAL <= 0; INSERT INTO CUSTOMERS SELECT * FROM CUSTOMERS O WHERE CUSTNAME = '250'; UNLINK CUSTOMERS; EXECUTE WINACTIV '-R', 'OPENORDIBYDOER','CUSTOMERS', :CST; LABEL 299; ``` -------------------------------- ### Batch Operation Request Example Source: https://github.com/prioritysoftware/prioritysoftware.github.io/blob/master/_restapi/6.restModify.md This JSON payload demonstrates how to combine a PATCH request to update a family log entry with a subsequent GET request to retrieve the updated entry. The 'dependsOn' field ensures the GET request executes only after the PATCH request completes successfully. ```json { "requests": [{ "method": "PATCH", "url": "serviceRoot/FAMILY_LOG('765')", "headers": { "content-type": "application/json; odata.metadata=minimal; odata.streaming=true", "odata-version": "4.0" }, "id": "g1", "body": { "FAMILYNAME": "765", "FAMILYDESC": "My OData Family" } }, { "id": "r8", "method": "GET", "url": "serviceRoot/FAMILY_LOG('765')", "headers": { "content-type": "application/json; odata.metadata=minimal; odata.streaming=true", "odata-version": "4.0" }, "dependsOn": ["g1"] }] } ``` -------------------------------- ### Download a File using SFTPCLNT Source: https://github.com/prioritysoftware/prioritysoftware.github.io/blob/master/_sdk/SFTPCLNT.md Example demonstrating how to download a file from an SFTP server to the Priority server. The source file path is specified on the server, and the target path is on the Priority server. ```SQL /* In the second example, we download a file from a folder on the server to Priority */ :SRC = 'TestFolder/GrabTest.txt'; :TRGT = STRCAT(SYSPATH('LOAD', 1), 'GrabTarget.txt'); EXECUTE SFTPCLNT 'ch1' '-d', :SRC, :TRGT; ``` -------------------------------- ### Login to Priority System Source: https://github.com/prioritysoftware/prioritysoftware.github.io/blob/master/_api/3.global.md Use this function to initialize the system and log in. A successful login also returns the LoginFunctions object. It requires a Configuration object containing environment details. ```javascript login(configuration) .then(loginFunctions => { // Use loginFunctions }) .catch(serverResponse => { // Handle error }); ``` -------------------------------- ### Get Priority Server Version Source: https://github.com/prioritysoftware/prioritysoftware.github.io/blob/master/_api/4.loginFucntions.md Call priorityVersion to retrieve the current version of the Priority software installed on the server. This ensures compatibility and awareness of the deployed version. ```javascript loginFunctions.priorityVersion(); ``` -------------------------------- ### Insert Current Date with POST-FIELD Trigger Source: https://github.com/prioritysoftware/prioritysoftware.github.io/blob/master/_sdk/Creating-your-Triggers.md Use this trigger to automatically populate a column with the current date when a new record is opened, provided the column is currently empty. This example uses a system function to get the current date. ```sql INSERT :$.CURDATE = SQL.DATE8; ``` -------------------------------- ### Alternative Initialization for Shipped Item Quantities Source: https://github.com/prioritysoftware/prioritysoftware.github.io/blob/master/_sdk/SQL-Variables.md An alternative SQL syntax for initializing :TQUANT and :QUANT variables, achieving the same result as the primary example. ```sql :TQUANT = :$.TQUANT and :QUANT = :$.QUANT; ``` -------------------------------- ### login(configuration) Source: https://github.com/prioritysoftware/prioritysoftware.github.io/blob/master/_api/3.global.md Initializes the system and logs the user in. A successful login also returns the LoginFunctions object. ```APIDOC ## login(configuration) ### Description Use this function to initialize the system and login. A succesful login also returns the [`LoginFunctions`](#LoginFunctions) object. ### Method POST (implied, as it's an initialization/login action) ### Endpoint N/A ### Parameters #### Request Body - **configuration** (Configuration) - Required - Environment configuration object. ##### Configuration : Object **Properties** - **url** (string) - URL to the Priority WCF service. See [URL](#url) below. - **tabulaini** (string) - tabula.ini file name. - **language** (number) - Language code. This determines the language of messages provided by the server, e.g. **3** - American English. - **profile** (object) - The internal name of the company in Priority to log into. - **appname** (string) - Application Name - (When developing for **Priority**, can be accessed in forms and procedures using the variable :WEBSDK_APP_NAME) - **username** (string) - Username. This is the user's **standard** user name in the system, and not the one specially defined for REST API in the **Personnel File** form in Priority. - **password** (string) - Password. - **devicename** (string) - Name of the device (additional information that is logged in the connection log). May be an empty string. - **appid** (string) - If your application uses a per-application license to connect to Priority (as opposed to generic API license), the unique application ID assigned to your application by Priority Software. - **appkey** (string) - If your application uses a per-application license to connect to Priority (as opposed to generic API license), the unique application license key assigned to your application by Priority Software. - **activeDirectory** (boolean) - Optional - use if your organization works with Active Directory. If set to **1**, login information in *username* and *password* should match the user's Windows credentials. *Supported in version 18.1 and above of Priority.* ##### URL **Local Installations** For local installations, the URL is the url to the *Priority* WCF service, without the “wcf/wcf/service.svc” part (i.e. the URL configured for the Priority Application Server). **Priority Cloud** For installations hosted on Priority Cloud, a distinction needs to be made between tenants on Private vs. Public Cloud (AWS). - On the public cloud (AWS), all installations share the same URL, and are distinguished by differing tabula.ini files. For production environments, the url is: https://p.priority-connect.online/wcf/service.svc For test environments, the prefix can be either **s** or **t.eu**, instead: - https://s.priority-connect.online/wcf/service.svc - https://t.eu.priority-connect.online/wcf/service.svc - On the private cloud, the URL is the url to the *Priority* WCF service, without the “wcf/wcf/service.svc” part. ### Response #### Success Response (200) - **LoginFunctions** (object) - Object containing login functions. #### Response Example N/A ``` -------------------------------- ### Start Attachments Sub-Form Source: https://github.com/prioritysoftware/prioritysoftware.github.io/blob/master/_api/6.form_examples.md Starts the 'EXTFILES' sub-form, which is used for managing attachments. ```javascript let subform = await mainFormHandler.startSubForm('EXTFILES', onShowMessge,null); ``` -------------------------------- ### Create Directory Source: https://github.com/prioritysoftware/prioritysoftware.github.io/blob/master/_sdk/Interact-with-External-Systems.md Creates a new directory at the specified path. ```SQL EXECUTE MAKEDIR :dir; ``` -------------------------------- ### Specific Entity Metadata Request Example Source: https://github.com/prioritysoftware/prioritysoftware.github.io/blob/master/_restapi/4.restRequest.md Example of requesting metadata for the 'CUSTOMERS' entity. Note that only top-level entities can be requested. ```http GET serviceRoot/GetMetadataFor(entity='CUSTOMERS') ``` -------------------------------- ### Run Interface Based on Load Table Source: https://github.com/prioritysoftware/prioritysoftware.github.io/blob/master/_sdk/Execute-FormLoads.md This example demonstrates running an interface that is based on a load table. It involves selecting a temporary file, linking a general load table, inserting data, executing the interface, and then unlinking the table. ```sql SELECT SQL.TMPFILE INTO :G1 FROM DUMMY; LINK GENERALLOAD ORD TO :G1; GOTO 99 WHERE :RETVAL <= 0; INSERT INTO GENERALLOAD ORD(LINE,RECORDTYPE,TEXT2) SELECT SQL.LINE, '1', CPROFNUM FROM CPROF WHERE PDATE = SQL.DATE8; EXECUTE INTERFACE 'OPENORDBYCPROF', '' , '-L', :G1; LABEL 99; UNLINK GENERALLOAD ORD; ``` -------------------------------- ### procStart Source: https://github.com/prioritysoftware/prioritysoftware.github.io/blob/master/_api/3.global.md Starts a procedure or a report. It takes the procedure name, type, a progress callback, and the company name as arguments and returns a Promise. ```APIDOC ## procStart(name, type, progressCallback, dname) ### Description Starts a [`Procedure`](../procedure/#Proc) or a report. ### Parameters #### Path Parameters - **name** (string) - Required - The internal (uppercase) name of the procedure, e.g. '**WWWSHOWORDER**'. - **type** (string) - Required - Type (**R** for report, **P** for procedure). - **progressCallback** (ProcProgressCallback) - Required - Callback function for displaying progress. - **dname** (string) - Required - Internal name of the company in which the procedure is run. ### Returns - Promise ``` -------------------------------- ### Retrieve System Registration Name using SQL.REGNAME Source: https://github.com/prioritysoftware/prioritysoftware.github.io/blob/master/_sdk/SQL-Functions-Variables.md Shows how to get the system's registration name, identical to the 'About Priority' help menu entry, using SQL.REGNAME. ```sql SELECT SQL.REGNAME FROM DUMMY FORMAT; ``` -------------------------------- ### LINK ALL Command Example Source: https://github.com/prioritysoftware/prioritysoftware.github.io/blob/master/_sdk/Link-Unlink.md This snippet demonstrates the usage of the LINK ALL command to link a table to a temporary file and perform database manipulations. ```sql SELECT SQL.TMPFILE INTO :TMPFILE; LINK ALL ORDERS TO :TMPFILE; GOTO 99 WHERE :RETVAL <= 0; /*database manipulation on the temporary ORDERS table */ UNLINK ORDERS; LABEL 99; ``` -------------------------------- ### Specific Entity Metadata Response Example Source: https://github.com/prioritysoftware/prioritysoftware.github.io/blob/master/_restapi/4.restRequest.md An example XML response for a specific entity metadata request, showing the EntityType definition with properties and annotations. ```xml                                                                                         ``` -------------------------------- ### Full Service Metadata Response Example Source: https://github.com/prioritysoftware/prioritysoftware.github.io/blob/master/_restapi/4.restRequest.md An example of the XML response for the $metadata request, showing the structure of entity types, properties, and navigation properties. ```xml ... ... ``` -------------------------------- ### SELECT with FORMAT and ADDTO output to file Source: https://github.com/prioritysoftware/prioritysoftware.github.io/blob/master/_sdk/Additions-to-SQL-Commands.md This example demonstrates how to use the FORMAT output command to generate results with column headings and data, and the ADDTO option to append the output to a specified file instead of overwriting it. ```sql SELECT * FROM PART WHERE PART > 0 FORMAT STRCAT ('/tmp/', 'part.sav'); ``` -------------------------------- ### Property Type Examples for Filtering and Data Representation Source: https://github.com/prioritysoftware/prioritysoftware.github.io/blob/master/_restapi/4.restRequest.md Examples of how values should be represented for different property types (Decimal, Int64, String, DateTimeOffset) when filtering or adding entities. ```text Type | Example --|-- Edm.Decimal | 42.00 Edm.Int64 | 42 Edm.String | "A string" Edm.DateTimeOffset | 2017-04-16 ``` -------------------------------- ### Document Formats Array Example Source: https://github.com/prioritysoftware/prioritysoftware.github.io/blob/master/_api/7.procedure.md Provides an example of an object within the 'formats' array for documentOptions. Each object specifies a format ID, selection status, and a display title. ```javascript 0:Object {title: "By Base Product", format: -7, selected: 0} format:-7 selected:0 title:"By Base Product" ``` -------------------------------- ### POST-FORM Trigger Example Source: https://github.com/prioritysoftware/prioritysoftware.github.io/blob/master/_sdk/Creating-your-Triggers.md Example of a POST-FORM trigger used to update values in an upper-level form based on changes in a sub-level form. This snippet updates the KITFLAG in the SERIAL table. ```sql UPDATE SERIAL SET KITFLAG = 'Y' WHERE SERIAL = :$$.SERIAL AND EXISTS (SELECT 'X' FROM KITITEMS WHERE SERIAL = :$$.DOC AND TBALANCE > 0 AND KITFLAG = 'Y'); GOTO 1 WHERE :RETVAL > 0; ``` -------------------------------- ### List Folder Contents using SFTPCLNT Source: https://github.com/prioritysoftware/prioritysoftware.github.io/blob/master/_sdk/SFTPCLNT.md Example demonstrating how to list the contents of a specified directory on an SFTP server. The results are stored in a temporary file and then displayed. ```SQL SELECT SQL.TMPFILE INTO :ST6 FROM DUMMY; EXECUTE SFTPCLNT 'vg1', '-l', 'pub/example', :ST6; LINK STACK6 TO :ST6; GOTO 99 WHERE :RETVAL <= 0; SELECT NAME, TYPE, 01/01/88 + NUM FROM STACK6 WHERE NAME <> '' FORMAT; UNLINK STACK6; LABEL 99; ``` -------------------------------- ### Serve Jekyll Site Locally Source: https://github.com/prioritysoftware/prioritysoftware.github.io/blob/master/README.md Builds the Jekyll project and starts a local server to host the site. Access the site by navigating to localhost:4000 in your browser. ```bash $ jekyll serve ``` -------------------------------- ### Example: Update Status History for Sales Orders Source: https://github.com/prioritysoftware/prioritysoftware.github.io/blob/master/_sdk/Send-Mail.md An example demonstrating how to add a new line to the 'History of Statuses' for a specific sales order by setting PAR1 and PAR2 and using the MAILMSG command. ```sql :PAR1 = 'O'; /* the Type defined for all records in the ORDERS form */ :PAR2 = '15982'; /* the internal Document (ID) of Order Number A00098 */ MAILMSG 1 TO USER -2; ``` -------------------------------- ### Load Sales Orders Interface using WINRUN Source: https://github.com/prioritysoftware/prioritysoftware.github.io/blob/master/_sdk/Interact-with-External-Systems.md Example of running an interface to load sales orders from the server using WINRUN. Specifies a message file for load messages. ```bash d:\priority\bin.95\winrun "" tabula XYZabc1 d:\priority\system\prep demo INTERFACE LOADORDERS d:\priority\tmp\messages.txt ``` -------------------------------- ### Retrieve Cloud Environment URL using SQL.CLOUDURL Source: https://github.com/prioritysoftware/prioritysoftware.github.io/blob/master/_sdk/SQL-Functions-Variables.md Demonstrates retrieving the address of a Priority Software Cloud hosted environment using SQL.CLOUDURL. ```sql SELECT SQL.CLOUDURL FROM DUMMY FORMAT; ``` -------------------------------- ### Example of Displaying Dates in a Custom Format Source: https://github.com/prioritysoftware/prioritysoftware.github.io/blob/master/_sdk/Calculated-Columns-Reports.md This example shows how to use the DTOA function to convert a date from a table column into a custom string format. The column type should be CHAR and its width adjusted accordingly. ```SQL DTOA(ORDERS.CURDATE, 'MMM DD, YYYY') ``` -------------------------------- ### Upload a File using SFTPCLNT Source: https://github.com/prioritysoftware/prioritysoftware.github.io/blob/master/_sdk/SFTPCLNT.md Example demonstrating how to upload a file from Priority to an SFTP server. The destination filename is specified relative to the path configured in the SFTP Definitions. ```SQL /* In this example, we upload a file to the sftp server from Priority */ SELECT SQL.TMPFILE INTO :SOURCE FROM DUMMY; SELECT 'THIS IS A TEST' FROM DUMMY ASCII :SOURCE; /* filepaths on the SFTP server are relative to the path provided in the Defintions for SFTP form */ :DEST = 'destinationTest.txt'; /* 'ch1' is the code of the SFTP server in the Defintions for SFTP form */ EXECUTE SFTPCLNT 'ch1' '-u', :SOURCE, :DEST; ``` -------------------------------- ### Execute Procedure with ACTIVATF Source: https://github.com/prioritysoftware/prioritysoftware.github.io/blob/master/_sdk/Run-Procedure-SQLI.md This snippet demonstrates executing a procedure named 'OPENORDBYCPROF' using the ACTIVATF command. It includes logic to check a status, select a temporary file, link a table, insert data, and then execute the procedure. ```sql GOTO 10099 WHERE :$.CPROFSTAT <> :SPECIALSTATUS; SELECT SQL.TMPFILE INTO :FILE FROM DUMMY; LINK CPROF TO :FILE; GOTO 10099 WHERE :RETVAL <= 0; INSERT INTO CPROF SELECT * FROM CPROF O WHERE PROF = :$.PROF; UNLINK CPROF; EXECUTE ACTIVATF '-P', 'OPENORDBYCPROF', 'CPROF', :FILE; LABEL 10099; ``` -------------------------------- ### priorityVersion Source: https://github.com/prioritysoftware/prioritysoftware.github.io/blob/master/_api/4.loginFucntions.md Retrieves the current version of Priority installed on the server. ```APIDOC ## priorityVersion() ### Description This method returns the current version of Priority installed on the server. ### Method This method can only be run on the [`LoginFunctions`](#LoginFunctions) object, which is returned after a successful [`login`](#login). ### Response #### Success Response - **version** (string) - Priority version number. ``` -------------------------------- ### Procedure Step Example for PRANDOM Source: https://github.com/prioritysoftware/prioritysoftware.github.io/blob/master/_sdk/Interact-with-External-Systems.md Demonstrates the use of PRANDOM within a procedure step to generate and display random hexadecimal and decimal values. ```sql SELECT SQL.TMPFILE INTO :STK1 FROM DUMMY; SELECT SQL.TMPFILE INTO :STK2 FROM DUMMY; EXECUTE PRANDOM :STK1, 'Y'; EXECUTE PRANDOM :STK2, ''; LINK STACK4 S1 TO :STK1; GOTO 1 WHERE :RETVAL <= 0; LINK STACK4 S2 TO :STK2; GOTO 1 WHERE :RETVAL <= 0; SELECT DETAILS AS 'RANDOM HEXA' FROM STACK4 S1 WHERE KEY = 1 FORMAT; SELECT DETAILS AS 'RANDOM DECIMAL' FROM STACK4 S2 WHERE KEY = 1 FORMAT; UNLINK STACK4 S1; UNLINK STACK4 S2; LABEL 1; ``` -------------------------------- ### priorityVersion() Source: https://github.com/prioritysoftware/prioritysoftware.github.io/blob/master/_api/4.loginFucntions.md Returns the current version of Priority installed on the server. ```APIDOC ## priorityVersion() ### Description Returns the current version of Priority installed on the server. ### Method This method can only be run on the [`LoginFunctions`](#LoginFunctions) object, which is returned after a successful [`login`](#login). ### Parameters This method does not take any parameters. ### Response #### Success Response - **version** (string) - The current version of Priority. ``` -------------------------------- ### Run Overnight Backflush Program using WINRUN Source: https://github.com/prioritysoftware/prioritysoftware.github.io/blob/master/_sdk/Interact-with-External-Systems.md Example of running the 'Overnight Backflush-New Transact' program from the server using WINRUN. Assumes Priority is on drive 'd'. ```bash d:\priority\bin.95\winrun "" tabula XYZabc1 d:\priority\system\prep demo WINACTIV -P BACKFLUSH_ONNEW ``` -------------------------------- ### Get Year Source: https://github.com/prioritysoftware/prioritysoftware.github.io/blob/master/_sdk/Scalar-Expressions.md Extracts the four-digit year from a given date. ```sql SELECT YEAR(03/22/06) FROM DUMMY FORMAT;/* 2006 */ ``` -------------------------------- ### Find Substring Index with Specified Start Position Source: https://github.com/prioritysoftware/prioritysoftware.github.io/blob/master/_sdk/Scalar-Expressions.md Returns the index location of a search string within a full string, starting the search from a specified index position. A negative index reverses the search from the end of the string. Returns 0 if not found or if the index is out of bounds. ```sql :STR = 'hello world this is my string'; :SUBSTR = 'is'; :INDEX = 1; SELECT :STR, :SUBSTR, :INDEX, STRINDEX(:STR, :SUBSTR, :INDEX) FROM DUMMY FORMAT; /* Result = 15*/ :INDEX = -1; SELECT :STR, :SUBSTR, :INDEX, STRINDEX(:STR, :SUBSTR, :INDEX) FROM DUMMY FORMAT; /* Result = 18*/ ``` -------------------------------- ### Document Options Data Structure Example Source: https://github.com/prioritysoftware/prioritysoftware.github.io/blob/master/_api/7.procedure.md Illustrates the structure for documentOptions, showing available formats and template configurations for document generation. This is used when a document has multiple display or print formats. ```javascript formats:Array[15] [Object, Object, Object, …] pdf:0 proc:Object {} type:"documentOptions" wordTemplates: Array[10] [Object, Object, Object, …] ``` -------------------------------- ### Get Day of Month Source: https://github.com/prioritysoftware/prioritysoftware.github.io/blob/master/_sdk/Scalar-Expressions.md Returns the day of the month for a specified date. ```sql SELECT MDAY(03/22/06) FROM DUMMY FORMAT;/* 22 */ ``` -------------------------------- ### Running an Interface Directly on a File Source: https://github.com/prioritysoftware/prioritysoftware.github.io/blob/master/_sdk/Release-Notes.md Demonstrates the use of the undocumented '-i' option for interfaces to run them directly on a specified file. ```SQL interfaces ``` -------------------------------- ### XML Basic Structure Example Source: https://github.com/prioritysoftware/prioritysoftware.github.io/blob/master/_sdk/Load-XML-JSON.md Demonstrates the basic structure of an XML file with a root and an element, used for defining tags and fields. ```XML ``` -------------------------------- ### Get String Length Source: https://github.com/prioritysoftware/prioritysoftware.github.io/blob/master/_sdk/Scalar-Expressions.md Returns the length of a given string as an integer. ```sql SELECT STRLEN('Priority') FROM DUMMY FORMAT;/* 8 */ ``` -------------------------------- ### Get Month Number Source: https://github.com/prioritysoftware/prioritysoftware.github.io/blob/master/_sdk/Scalar-Expressions.md Extracts the number of the month (1-12) from a given date. ```sql SELECT MONTH(03/22/06) FROM DUMMY FORMAT;/* 3 */ ``` -------------------------------- ### Create an ORDER with Multiple ORDERITEMS (Alternative) Source: https://github.com/prioritysoftware/prioritysoftware.github.io/blob/master/_restapi/6.restModify.md This example demonstrates creating an ORDER with multiple ORDERITEMS using a different endpoint and authentication method. It's useful for scenarios requiring specific host and authorization headers. ```html POST /ui/odata/Priority/tabmob.ini/usdemo/ORDERS HTTP/1.1 Host: www.eshbelsaas.com Content-Type: application/json Authorization: Basic YXBpZGVtbzoxMjM= Cookie: GCLB=CMbzkMzAjKf7ygE Content-Length: 350 { "CUSTNAME" : "00000002", "ORDERITEMS_SUBFORM" : [ { "PARTNAME": "TR0001", "TQUANT": 10, "DUEDATE": "2021-08-30T00:00:00+02:00" }, { "PARTNAME": "TR0001", "TQUANT": 11, "DUEDATE": "2021-09-30T00:00:00+02:00" } ] } ``` -------------------------------- ### WINHTML Quick Mode Syntax Source: https://github.com/prioritysoftware/prioritysoftware.github.io/blob/master/_sdk/WINHTML.md Use this simplified syntax for quick document generation, suitable for default printing. ```sql EXECUTE WINHTML '-dQ' | '-dQe', 'document_name', 'record_id'; ``` -------------------------------- ### OData Version Response Payload Source: https://github.com/prioritysoftware/prioritysoftware.github.io/blob/master/_restapi/4.restRequest.md Example JSON response showing the OData version. ```json { "@odata.context": "serviceroot/$metadata#Edm.String", "value": "1.0.0.0" } ``` -------------------------------- ### Get File Size Source: https://github.com/prioritysoftware/prioritysoftware.github.io/blob/master/_sdk/Interact-with-External-Systems.md Retrieves the size of a given file and stores it in the STACK table. ```SQL EXECUTE GETSIZE 'path/file_name', :$.STK; ```