Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
4d_moneyworks_plugin [2011/04/25 06:07] – [Included Methods] Adrian Boone | 4d_moneyworks_plugin [2011/04/25 06:36] (current) – removed Adrian Boone | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | =====Introduction===== | ||
- | This document is based on the Moneyworks command-line documentation from Cognito ([[http:// | ||
- | |||
- | The full path must be given for any files, as the Moneyworks command line doesn' | ||
- | |||
- | Double quotes within strings should be escaped, or use Char(Double Quote). Single quotes should not be used (except in the // | ||
- | |||
- | The component has been tested on 4Dv11r5 and 4Dv11r8, connecting to Moneyworks v5.2.3 and the new v6.03. | ||
- | |||
- | The component will operate as a trial for one hour. For a license key, or to obtain the source code, please contact us ([[http:// | ||
- | |||
- | |||
- | |||
- | |||
- | ========== | ||
- | |||
- | |||
- | Examples using these methods are included in the accompanying example database, which also includes a form which can be used to experiment (use the **mwks_preferences** method to open it) | ||
- | |||
- | |||
- | |||
- | |||
- | =====mwks_register ===== | ||
- | // | ||
- | |||
- | |||
- | |||
- | |**Parameter**|**Type**|**Description**| | ||
- | |registration_key|String|Registration key for component| | ||
- | |||
- | |||
- | |||
- | |||
- | ====Return value==== | ||
- | // | ||
- | |||
- | |||
- | ====Description==== | ||
- | Registers the component using the given key string. If the key isn't valid, the component can still be used for an hour before it times out. This method should be called before attempting to use any other component method e.g. in the **On Startup** database method. | ||
- | |||
- | |||
- | |||
- | |||
- | ========== | ||
- | |||
- | =====mwks_setup_connection ===== | ||
- | // | ||
- | |||
- | //**[if connection=1 (Gold local): data_path; doc_username; | ||
- | |||
- | //**[if connection=2 (Gold server): client_license; | ||
- | |||
- | //**[if connection=3 (DC server): | ||
- | |||
- | // | ||
- | |||
- | |||
- | |||
- | |**Parameter**|**Type**|**Description**| | ||
- | |p_connect|Pointer to string|For the connect string| | ||
- | |p_application|Pointer to string|For the Moneyworks application string| | ||
- | |p_error|Pointer to string|For the error string| | ||
- | |connection|Integer|1=Gold local, 2=Gold server, 3=DC server| | ||
- | |mwks_location|String|Full path to Moneyworks executable| | ||
- | |data_path|String|Full path to data file (if connection=1), | ||
- | |doc_username|String|Username for data file (ignored if doc_pass is blank)| | ||
- | |doc_pass|String|Password for data file (may be left blank)| | ||
- | |client_key|String|License key for client of Gold server| | ||
- | |server_ip|String|IP address of Gold server/DC server| | ||
- | |server_port|String|If left blank, uses default port (6674 for Gold server, 6699 for DC server)| | ||
- | |dc_username|String|Username for DC server login (may be left blank if DC server not running in ASP mode, otherwise it is required)| | ||
- | |dc_pass|String|Password for DC server (may be left blank)| | ||
- | |dc_os|String|OS of DC server - either ' | ||
- | |open_datafile|String|Optional parameter - if non blank, try to open the data file| | ||
- | |xml_output|String|Optional parameter - if non blank, use XML output| | ||
- | |||
- | |||
- | |||
- | |||
- | ====Return value==== | ||
- | // | ||
- | |||
- | |||
- | ====Description==== | ||
- | Sets up the necessary connection parameters for communicating with Moneyworks (// | ||
- | |||
- | The last two parameters (// | ||
- | |||
- | |||
- | ========== | ||
- | |||
- | =====mwks_run_command===== | ||
- | //** (connect_string; | ||
- | |||
- | |||
- | |||
- | |**Parameter**|**Type**|**Description**| | ||
- | |connect_string|String|Connect string| | ||
- | |command_string|String|Moneyworks command string| | ||
- | |application_string|Pointer to string|Moneyworks application string| | ||
- | |p_result|Pointer to string|For the result string| | ||
- | |p_error|Pointer to string|For the error string| | ||
- | |||
- | |||
- | |||
- | |||
- | ====Return value==== | ||
- | // | ||
- | |||
- | |||
- | ====Description==== | ||
- | Generic method to run any Moneyworks command (used in the Execute button on the example form). The first two parameters are the connection parameters from // | ||
- | |||
- | |||
- | |||
- | |||
- | =====mwks_evaluate ===== | ||
- | // | ||
- | |||
- | |||
- | |||
- | |**Parameter**|**Type**|**Description**| | ||
- | |connect_string|String|Connect string| | ||
- | |application_string|String|Moneyworks application string| | ||
- | |p_result|Pointer to string|For the result string| | ||
- | |p_error|Pointer to string|For the error string| | ||
- | |expression|String|Expression to be evaluated| | ||
- | |||
- | |||
- | |||
- | |||
- | ====Return value==== | ||
- | // | ||
- | |||
- | |||
- | ====Description==== | ||
- | Evaluate the given expression. The first two parameters are the connection parameters from // | ||
- | |||
- | Note that single quotes should not be used in the // | ||
- | |||
- | " | ||
- | |||
- | evaluate expr=' | ||
- | |||
- | |||
- | |||
- | |||
- | =====mwks_import_file ===== | ||
- | // | ||
- | |||
- | |||
- | |||
- | |||
- | =====mwks_import_text===== | ||
- | // | ||
- | |||
- | |||
- | ========== | ||
- | |||
- | =====mwks_import_arrays===== | ||
- | // | ||
- | |||
- | |||
- | |||
- | |**Parameter**|**Type**|**Description**| | ||
- | |connect_string|String|Connect string| | ||
- | |application_string|String|Moneyworks application string| | ||
- | |p_result|Pointer to string|For the result string| | ||
- | |p_error|Pointer to string|For the error string| | ||
- | |import_map|String|Full path to Moneyworks import map| | ||
- | |file_path|String|Full path to file to be imported| | ||
- | |import_text|String|Text to be imported| | ||
- | |p_text_array|Pointer to string array|Array of individual field data values to be imported| | ||
- | |extra_parameters|String|Advanced import options - see below| | ||
- | |||
- | |||
- | |||
- | |||
- | ====Return value==== | ||
- | // | ||
- | |||
- | |||
- | ====Description==== | ||
- | Three different ways to import data, depending on whether the data is being imported from a file, a pre-prepared text string, or an array of individual field strings (which are combined internally into a single string) The first two parameters are the connection parameters from // | ||
- | |||
- | There is no metacharacter expansion when importing from text (or from an array of text), so you can't use \t, \n etc.. If you have multiple lines to import, write your data to a temporary file and import from the file instead. Output is a report of number of records created and updated (except for User, Contact and Build files, which will always report zero). Note also that single quotes should not be used in // | ||
- | |||
- | Additional arguments which can be combined into // | ||
- | |||
- | filename=' | ||
- | |||
- | update=' | ||
- | |||
- | return_seq=' | ||
- | |||
- | post=' | ||
- | |||
- | post seqnum=' | ||
- | |||
- | |||
- | =====mwks_export ===== | ||
- | // | ||
- | |||
- | |||
- | |||
- | |**Parameter**|**Type**|**Description**| | ||
- | |connect_string|String|Connect string| | ||
- | |application_string|String|Moneyworks application string| | ||
- | |p_result|Pointer to string|For the result string| | ||
- | |p_error|Pointer to string|For the error string| | ||
- | |table|String|Moneyworks table name| | ||
- | |format|String|Format string (if blank, use default export format)| | ||
- | |search|String|Search string (if blank, include all records)| | ||
- | |output_file|String|Full path to output file (if blank, return in // | ||
- | |extra_parameters|String|Advanced export options - see below| | ||
- | |||
- | |||
- | |||
- | |||
- | ====Return value==== | ||
- | // | ||
- | |||
- | |||
- | ====Description==== | ||
- | Export data from the given file (" | ||
- | |||
- | The //table// parameter may// //include a sort specifier (e.g. " | ||
- | |||
- | If the //search// parameter is an empty string, you will get all records, otherwise only those matching the search expression. Using " | ||
- | |||
- | To export with a particular format, use the //format// parameter. Everything in the format string is returned verbatim except for anything inside [...] which is treated as an expression which can reference the fields of the file being exported. Thus if you want tab-delimited, | ||
- | |||
- | Note that single quotes should not be used in the //table//, //format//, or //search// parameters as they are used internally to delimit the corresponding command-line parameters sent to Moneyworks. You can use double quotes instead e.g. $t_search: | ||
- | |||
- | If the // | ||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | =====mwks_data_to_arrays ===== | ||
- | // | ||
- | |||
- | |||
- | |||
- | |**Parameter**|**Type**|**Description**| | ||
- | |result_string|String|Result string from mwks_export()| | ||
- | |p_arrays|Pointer to 2D array|For an array of text arrays to hold results| | ||
- | |||
- | |||
- | |||
- | |||
- | ====Description==== | ||
- | Process exported data from MoneyWorks. Create a 2D array of text arrays with zero elements (one for each field to be returned) and pass a pointer to it as // | ||
- | |||
- | |||
- | ========== | ||
- | |||
- | =====mwks_report===== | ||
- | //** (connect_string; | ||
- | |||
- | |||
- | |||
- | |**Parameter**|**Type**|**Description**| | ||
- | |connect_string|String|Connect string| | ||
- | |application_string|String|Moneyworks application string| | ||
- | |p_result|Pointer to string|For the result string| | ||
- | |p_error|Pointer to string|For the error string| | ||
- | |report_path|String|Full path to report| | ||
- | |format|String|' | ||
- | |from|String|From date string (may be blank)| | ||
- | |to|String|To date string (may be blank)| | ||
- | |output_file|String|Full path to output file (if blank, return in // | ||
- | |extra_parameters|String|Advanced report options - see below| | ||
- | |||
- | |||
- | |||
- | |||
- | ====Return value==== | ||
- | // | ||
- | |||
- | |||
- | ====Description==== | ||
- | Executes the given report. The first two parameters are the connection parameters from // | ||
- | |||
- | You should either supply both //from// and //to// as date strings (e.g. ' | ||
- | |||
- | Note that single quotes should not be used in the //format// parameter, as they are used internally to delimit the command-line parameters sent to Moneyworks. | ||
- | |||
- | If // | ||
- | |||
- | All parameters are inserted into the name table and are available to the report. Thus you can pass values for custom controls defined for a report in // | ||
- | |||
- | |||
- | |||
- | |||
- | =====mwks_form===== | ||
- | //** (connect_string; | ||
- | |||
- | |||
- | |||
- | |**Parameter**|**Type**|**Description**| | ||
- | |connect_string|String|Connect string| | ||
- | |application_string|String|Moneyworks application string| | ||
- | |p_result|Pointer to string|For the result string| | ||
- | |p_error|Pointer to string|For the error string| | ||
- | |form_path|String|Full path to form| | ||
- | |format|String|' | ||
- | |search|String|Search string (required unless form type is .rept)| | ||
- | |output_file|String|Full path to output file (if blank, return path in // | ||
- | |extra_parameters|String|Advanced form options - see below| | ||
- | |||
- | |||
- | |||
- | |||
- | ====Return value==== | ||
- | // | ||
- | |||
- | |||
- | ====Description==== | ||
- | Only available in Moneyworks v6. Renders the form to a pdf file. The first two parameters are the connection parameters from // | ||
- | |||
- | For form types other than .rept the //search// parameter must be provided to select the record(s) to use. If multiple records are selected, all output still goes to the same file. | ||
- | |||
- | The only supported //format// at present is " | ||
- | |||
- | Note that single quotes should not be used in the //search// parameter as they are used internally to delimit the command-line parameters sent to Moneyworks. You can use double quotes instead e.g. $t_search: | ||
- | |||
- | For forms that use variables supplied by the form printing dialog (such as Message, Print_Copy etc) you may provide values for those variables by passing them in // | ||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | =====Migrating from previous Moneyworks 4D plugin===== | ||
- | The main differences are: | ||
- | |||
- | *The connection to Moneyworks is handled differently - most methods take two extra parameters (// | ||
- | *The return value is usually Boolean rather than text - text return values are passed via a string pointer instead (// | ||
- | *There is no separate method (// | ||
- | *There is no equivalent of // | ||
- | Taking into account the extra (four in most cases) parameters, the methods can be mapped as follows: | ||
- | |||
- | *Connecting to Moneyworks: // | ||
- | *Evaluating expressions: | ||
- | *Importing: The // | ||
- | *Exporting: The //table//, //search// and // | ||
- | *Reporting: The // | ||
- | |||
- | |||