Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents
maxLevel3

Info
iconfalse
titleRelated articles

Specifying parameters that can be used in SQL queries, connection strings and file paths allows you to use a single Sync file for multiple 'organisations' in Phocas. These parameters are passed to Sync, with the result that the same information structure is sent to a different organisationany organisation that you have set up to use the

Data The following data item types that reference parameters:

  • SQL
  • File
  • Directory.

Defining parameters

  1. Select the Parameters tab in Sync.
  2. Select
the
  1. Add button to create a new parameter.
  2. Enter the parameter name and a value into the table, noting that:
    • Parameter names are alphanumeric only. Special characters can not be used.
    • Values can not contain parameters.
    • Double quotes can not be used in values.
       

 Parameters can then be used

Using parameters as values in supported types

- e.g. defining a database connection:

Example of use: Connection string 

 

Image Removed

 

Image RemovedExample of use: SQL

Image Added

Parameter substitution in scheduled Syncs

You can substitute different values for defined parameter via scheduled Syncs (SyncCLI). To substitute a parameter value, the “-p” switch is used, followed by the parameter name and quoted value. The quoted value is only used for the duration of the session i.e. the original value defined in Sync remains unchanged.

-p:parameterName “newValue”

-p:server ”localhost“

* Note if a parameter name contains spaces, it must also be quoted:

“-p:My Server” “localhost”

“-p:Test Database” “Testing”

 

 

Examples of the format for using parameters

:

Path to sync file

-r "c:\temp\new sync\sqlparameters.sync"

Server connection switches

-user "phocas"

-password "phocas"

-service "http://localhost"

-source "ParametersBro"

Substituted parameters

-p:server: “localhost“

-p:database "phocas_testing_sales"

-p:table "entity_1"

-p:columns "cat_3,cat_4,cat_5"

 

substituting

Multiple parameters

You can substitute a number of parameters for a range of data items Example of arguments as entered into the arguments items.

Example

Image Added

 

These multiple parameters can be entered in the Arguments field in a scheduled task:

Code Block
themeMidnight
-r "c:\temp\new sync\multipleparameters.sync" -user "phocas" -password "phocas" -service "http://localhost" -source "SyncParamsFile" -p:server "localhost" -p:database "phocas_testing_sales" "-p:My source table" "entity_1" -p:columns "cat_3,cat_4,cat_5" "-p:sales directory" "C:\temp\Sales" -p:filePath "C:\temp\Customers.txt"