(key: string): any
(all: boolean): any
(arguments: {
all?: boolean,
key?: string,
default?: any,
contextId?: string
}): any
The _url_query
operator gets a value from the urlQuery
object. The urlQuery
is a data object that is set as the [https://en.wikipedia.org/wiki/Query_string
] of the app URL. It can be set when linking to a new page using the Link
action, and can be used to set data like a id
when switching to a new page. Unlike input
, the urlQuery
is visible to the user, and can be modified by the user.
DO NOT set any private or personal information to
urlQuery
; all data set tourlQuery
are accessible publicly. Setting aid
that can be guessed, like an incrementalid
, can lead to security issues, since users can easily guess and access data for otherids
.
If the page is reloaded, the urlQuery
is not lost. By using urlQuery
, you can make links containing data that can be shared by users. By default, _url_query
accesses the url_query
object from the context
the operator is used in, but a different context can be specified.
urlQuery
objects are serialized to JSON, allowing nested objects or arrays to be specified.
Arguments
string
If the _url_query
operator is called with a string argument, the value of the key in the urlQuery
object is returned. If the value is not found, null
is returned. Dot notation and block list indexes are supported.
boolean
If the _url_query
operator is called with boolean argument true
, the entire urlQuery
object is returned.
object
all: boolean
: Ifall
is set totrue
, the entireurlQuery
object is returned. One ofall
orkey
are required.key: string
: The value of the key in theurlQuery
object is returned. If the value is not found,null
, or the specified default value is returned. Dot notation and block list indexes are supported. One ofall
orkey
are required.default: any
: A value to return if thekey
is not found inurlQuery
. By default,null
is returned if a value is not found.contextId: string
: The id of acontext
. Setting this will get the value from theurlQuery
of the specified context. A list ofcontexts
that exist are returned by the_list_contexts
operator. Cannot be used inconnections
orrequests
.
Examples
Get the value of my_key
from urlQuery
:
_url_query: my_key
_url_query:
key: my_key
Returns: The value of my_key
in urlQuery
.
Get the entire urlQuery
object:
_url_query: true
_url_query:
all: true
Returns: The entire urlQuery
object.
Dot notation:
Assuming urlQuery:
my_object:
subfield: 'Value'
then:
_url_query: my_object.subfield
_url_query:
key: my_object.subfield
Returns: "Value"
.
Return a default value if the value is not found:
_url_query:
key: might_not_exist
default: Default value
Returns: The value of might_not_exist
, or "Default value"
.
Block list indices:
Assuming urlQuery
:
my_array:
- value: 0
- value: 1
- value: 2
then:
_url_query: my_array.$.value
Returns: 0
when used from the first block (0th index) in a list.
Get a value from another context
:
_url_query:
key: my_key
contextId: 'pageId:contextId:{}'
Returns: The value of my_key
in urlQuery
in context contextId
on page pageId
.