# Local DataSource

## PV syntax

The standard prefix for the datasource is `loc://` which can be omitted if configured as the default datasource.

'Local' pvs are transient that exist in the current program instance. They can be used to communicate between between different components of the application. Their value is lost at disconnection.

The syntax to create a local pv is:

      loc://pvname
      loc://pvname<type>
      loc://pvname(initialValue)
      loc://pvname<type>(initialValue)

Both the type and the initial values are optional but, if specified, they have to match previous type or initialValue if they were given. In other words: it is not possible to open the same pv multiple times at the same time with a different type or initial value.

The initialValue will be trigger an update only the first time is used, and only if the pv wasn't previously written to. That is: the initialValue will never overwrite an already open pv that was written to. If no initial value is ever given, the value of the pv is simply left to its default null value, and no value notification is sent. The possible initial values are:

Syntax | Description
--- | ---
`loc://pvname(number)` | Creates a pv with an initial numeric value
`loc://pvname("string")` | Creates a pv with an initial text value
`loc://pvname(number, number, number, ...)` | Creates a pv with an initial numeric array value
`loc://pvname("string", "string", "string", ...)` | Creates a pv with an initial string array value

Once specified, the type will make sure that any update matches the type. If it does not, and error is notified to the writer. The first type specified is the one that counts. Subsequent use with a different type will fail to open the pv. If both initialValue and type are specified, they should match. The type can be one of the following:

Syntax | Description
--- | ---
`loc://pvname<VString>` | Creates a text pv
`loc://pvname<VStringArray>` | Creates a text array pv
`loc://pvname<VDouble>` | Creates a numeric pv
`loc://pvname<VDoubleArray>` | Creates a numeric array pv
`loc://pvname<VTable>` | Creates a table pv