There are different scenarios your application might be leveraging TipoTapp dynamic expressions capabilities, both in the Tipo UI JavaScript Expressions and also in Tipo Server Query Expression Syntax. This article summarises the system objects available to use in these queries.
Client Objects
As described in the Tipo UI JavaScript Expressions , expressions are evaluated to either auto-fill a value in a field or to decide if a field or a section should be displayed or hidden and so on.
These expressions will require data from the other fields in the same object to be able to successfully evaluate. The following two methods are available to refer to data in the same object.
$tipo_root
This will allow you to access data from the root of the current object where the expression is being evaluated.
$tipo
This will allow you to access data from the current context for which the expression is currently being evaluated for.
In order to better explain this, consider Application tipo with the following fields:
- Application Tipo
-> Application ID(application_id) - -> Student (student_name)
-> Application Date (application_date)
-> Discount on Fees (discount) - FeeDetails : Group
-> Fees PerTerm (fees)
-> Terms (term)
--> Total after discount (total_after_discount)
Requirement: In this example, requirement is to calculate line item total for each line item multiplying fees*term and then apply discount supplied in the Application Tipo

A real example of the above will look something like this:
{
"student": "101",
"order_date": "2018-14-01",
"discount": 20
,
"FeeDetails" :
[
{
"fees": 1000,
"term": 3,
"total" : <Auto-calculate using expression>
}
]
}
Solution using $tipo... :
Use the following Auto-Fill Expression to meet this requirement
($tipo.fees * $tipo.term)*((100- $tipo_root.discount)/100)
Lets first examine the first part of the solution, to multiple unit price and quantity. Each line item has its own unit price and its own quantity. By using $tipo you can refer to the fields in the same level.
So, the first part of the expression $tipo.fees * $tipo.term will give the total without the discount.
Discount however, is present outside the group. From the line items, to refer to something that is not in its level, we can use $tipo_root . In this example you can access discount present outside by using $tipo_root.discount
Array Index :
In order to reference a specific array index you can simply use normal array syntax. I.e. to refer to first line item total $tipo_root.OrderLineItem[0].line_item_total
If your expression doesn't know the current index, you can simply use [index] to refer to the current index where the expression is being evaluated. So, the same expression to multiple unit_price and quantity and apply discount can be written as below:
($tipo_root.OrderLineItem[index].quantity * $tipo_root.OrderLineItem[index].unit_price) *((100- $tipo_root.header.discount)/100)
$tipo_handle
This is another client side object providing a number of system variables for dynamic expressions to be more valuable. From different parts of the system, useful system variables are exposed for application creator.
Application Metadata
- $tipo_handle.application_meta.application
> Application ID - $tipo_handle.application_meta.application_owner_account
> Application owner account ID, i.e creator account ID.
User Metadata
- $tipo_handle.user_meta.tipo_id
> User tipo_id, Unique ID for each app user. - $tipo_handle.user_meta.account
> User account ID - $tipo_handle.user_meta.application
> Application ID - $tipo_handle.user_meta.application_owner_account
> Application owner account ID, i.e. creator account ID. - $tipo_handle.user_meta.fully_qualified_username
> TipoTapp System internal identifier for each user - $tipo_handle.user_meta.role
> User role
Perspective Metadata
- $tipo_handle.perspective.tipo_name
> Current perspective tipo name - $tipo_handle.perspective.display_name
> Perspective tipo display name - $tipo_handle.perspective.field_name
> Perspective field name that is automatically added to each object in creation - $tipo_handle.perspective.tipo_id
> Current perspective object id
Menu Metadata
- $tipo_handle.menu_item.label
> Menu label displayed in the menu - $tipo_handle.menu_item.id
> Internal unique identifier - $tipo_handle.menu_item.quickFilters
> If a filter is applied to the selcted menu item in context, that is available here - $tipo_handle.menu_item.tipo_name
> Display name for the selected Tipo - $tipo_handle.menu_item.ignore_singleton
> If singleton was requested to be ignored when setting up menu item - $tipo_handle.menu_item.isSingleton
> true - If the selected item is a singleton - $tipo_handle.menu_item.perspective
> Perspective in the context. E.g. TipoApp.1000000001
Server Object Replacements
A number of queries are passed to server to fetch data from the server. The following scenarios can use the following replacement variables.
- Relationship Filters
- Query Params in Relationship Filters
- Quick Filters (Only applicable for Rise plan and above)
$tipo_context :
Similar to client side replacements, this object gives the ability to have dynamic replacements in server side queries, the following summarises the list of variables available for replacement in $tipo_context
- $tipo_context.user
> Logged-in user id (Email) - $tipo_context.user_role
> Logged-in user role - $tipo_context.account
> Logged-in user account ID - $tipo_context.account_name
> Logged-in user account name - $tipo_context.application
> Logged-in application ID - $tipo_context.application_name
> Logged-in application name - $tipo_context.application_owner_account
> Logged-in application owner account ID - $tipo_context.application_owner_account_name
> Logged-in application owner account name
Gateway Request : Metadata about HTTP request
- $tipo_context.gateway_request.tipo_name
> TipoName in the request URL - $tipo_context.gateway_request.tipo_id
> TipoID in the request URL - $tipo_context.gateway_request.tipo_action
> Query parameter tipo_action value - $tipo_context.gateway_request.http_method
> Request HTTP method (GET, PUT, POST, DELETE) - $tipo_context.gateway_request.page
> During pagination, this will be the requested page - $tipo_context.gateway_request.per_page
> How many results in a single response. - $tipo_context.gateway_request.tipo_filter
> Filter to apply on the data being fetched. - $tipo_context.gateway_request.params
> HTTP request parameters. To get the value of a specific parameter passed by the client, simply add parameter name after params. E.g.$tipo_context.gateway_request.params.special_codewill give you the value for the parameter by the namespecial_code
Current Tipo Data:
- $tipo_context.current_tipo.{}
> When Actions are performed in the detail/update view, the current tipo will contain the data upon which the action is currently being executed.
User Meta Data:
- $tipo_context.user_attributes
> Name value pairs of attributes associated during user registraion. Role identification TipoName and ID. For example, if the invited user is Supplier. - $tipo_context.user_attributes.user_tipo
> E.g. Patient, PartnerContact - $tipo_context.user_attributes.user_tipo_id
> E.g. Patient ID (1234), PartnerContact ID (2222) - $tipo_context.user_attributes.org_tipo
> E.g. PartnerOrg, SupplierOrg - $tipo_context.user_attributes.org_tipo_id
> Eg. PartnerOrg ID (PARTNER_11), SupplierOrg ID (SUPP_2222)
Comments
0 comments
Please sign in to leave a comment.