--- title: "system.db.runSFNamedQuery" description: "Runs a named query through the store and forward system and to multiple datasources at the same time." --- # system.db.runSFNamedQuery > Runs a named query through the store and forward system and to multiple datasources at the same time. This function is used in **Python Scripting**. ## Description Runs a named query that goes through the Store and Forward system. Note that the number of parameters in the function is determined by scope. Both versions of the function are listed on this page. :::note Only Update Named Queries are allowed in Store and Forward. ::: ## Client Permission Restrictions This scripting function has no Client Permission restrictions. ## Gateway Scope Syntax `system.db.runSFNamedQuery([project], path, params)` ### Parameters Type | Parameter | Description ------- | ------- | ----- String| `project` | The project name the query exists in. [optional] String| `path` | The path to the Named Query to run. Note that this is the full path to the query, including any folders. Dictionary[String, Any]| `params` | A Python dictionary of parameters for the Named Query to use. ### Returns **Boolean** - Returns true if successfully sent to the Store and Forward system. ### Scope Gateway, Perspective Session ## Project Scope Syntax `system.db.runSFNamedQuery(path, params)` ### Parameters Type | Parameter | Description ------- | ------- | ----- String| `path` | The path to the Named Query to run. Note that this is the full path to the query, including any folders. Dictionary[String, Any]| `params` | A Python dictionary of parameters for the Named Query to use. ### Returns **Boolean** - Returns true if successfully sent to the Store and Forward system. ### Scope Vision Client ## Code Examples ```python title="Simple Example - Without Parameters" # This example runs a Named Query without any parameters in the Project scope. # The second argument in the function is NOT optional, so Named Queries that do not require a parameter # must still pass an empty dictionary as an argument. # Request the Named Query with an empty dictionary as the second parameter. system.db.runSFNamedQuery("folderName/myNamedQuery", {}) ``` ```python title="Gateway Scope Example" # This example runs a Named Query without any parameters in the Gateway scope. # The last argument in the function is NOT optional, so Named Queries that do not require a parameter # must still pass an empty dictionary as an argument. # Request the Named Query to execute. system.db.runSFNamedQuery("ProjectName", "folderName/myNamedQuery", {}) ``` ```python title="Simple Example - With Parameters" # This example runs a Named Query while passing some parameters in the Project scope. # The Named Query is assumed to have two parameters already defined on the Named Query: # param1 : A string # param2 : An integer # Create a Python dictionary of parameters to pass params = {"param1":"my string", "param2":10} # Run the Named Query system.db.runSFNamedQuery("myUpdateQuery", params) ```