Skip to Content

mvSQL runtime function - Shared()


When linking to a page, criteria can be made available to the target page's data objects. This function will then access these values in several locations.


SHARED(<name>, <datatype>)



A string representing the requested criteria's name.


Datatype is only used to pass back null /empty values. The return type of Shared is always a string and will essentially always have the default behavior of passing back an empty string. If the shared criteria is not available, the return type can be specified as UUID or numeric (if desired). If set, Vinyl will return '00000000-0000-0000-0000-000000000000' for a UUID or '0' for a number. Otherwise the resulting SQL will fail when comparing a UUID to an empty string.


Returns a quoted string with the value passed to the page.


More information is available on the overall Shared criteria page, including how to define the shared criteria and where this function can be used.

As of 2.3, the SHARED() function always returns a quoted string.



  • The page receives a shared criteria ActiveEmployeeId=5
  • The page does not receive a shared criteria with the name LastRegion

This rule could be created:

SELECT CustomerId, shared('ActiveEmployeeId') as ActiveEmployeeId FROM Customer WHERE CustomerRegionId <> shared('LastRegion', 'UUID')

Which would evalulate at runtime to:

SELECT CustomerId, '5' as ActiveEmployeeId FROM Customer WHERE CustomerRegionId <> '00000000-0000-0000-0000-000000000000'