What function can I use to open another table?
The basic function for opening another table is linkToTable.
=: linkToTable(table: 'table'; title: "Window Title"; target: "iframe")
Is it possible to open it in a pop-up window and set its size?
Yes, this is handled by the target
parameter:
iframe
— in an iframe above other windows.
blank
— in a new window (for proper operation, you need to allow pop-ups in the browser).
parent
— in the base lower window, all open nested windows will be closed.
self
— in the current window. If the parameter is not specified, it is processed as self.
Only one of these options should be specified.
To set the iframe
window size by width, use the parameter width: 800
. The number is a fixed width in pixels.
You can pass not a number, but "80vw"
, then the number before vw will determine the percentage of the browser window width.
Is it possible to pass prefilter values to the opening table to see the desired rows?
If your landing page has a prefilter, you can pass a value to it using the filter
parameter:
=: linkToTable(table: 'table'; title: "Window Title"; filter: 'fl_filter' = #number; target: "iframe")
The value of the passed prefilter will be encrypted with a session key and passed in the URL. Therefore, such a transfer has a volume limitation — you cannot pass large lists or arrays in the filter
!
The prefilter field must be editable for the role. It can be hidden, but it must be editable.
This way, you can link tables to each other.
For example, from the Warehouse table, you can open the list of Movements for a specific item.
How to avoid the error of passing large lists to prefilters?
To be able to handle large lists in linkToTable
, there is an approach:
You create two! prefilter fields.
In the first one, you pass the value by filter
. This should be a short value, such as a list of roles or a role number from which the limiting list of categories will be calculated. Or a set of parameters that will allow you to calculate the limiting list in the second field.
The first prefilter field is not linked to the string part. The setting name of the field in the string part remains empty.
In the second prefilter field, you calculate the necessary list of restrictions with code, and this field is linked to the string part.
What visibility and change settings must the prefilter fields have for this to work?
The first field must be editable but can be hidden for the role. Only values for editable fields for the role can be passed through the filter
of prefilters.
The second field, which is calculated by code, can be non-editable and hidden.
How do I open a table and immediately open an insert row with filled parameters?
The linkToTable
has another parameter that reduces the number of user clicks and increases convenience — it's field
.
If you pass a value to field
and the target table has an available add row, then when the window opens, the add row will be immediately available, and the specified field will be populated with values.
For example: we have an order, and we use linkToTable
to open the payments table. We can immediately set the calculated remaining payment amount for this order in the payment amount field.
=: linkToTable(table: 'payments'; filter: 'fl_order' = #order_number; field: 'summ' = $calc)
calc: #order_summ - $payments
payments: listSum(list: $list)
list: selectList(table: 'payments'; field: 'summ'; where: 'order' = #order_number)