Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Scripted Related Lists are different from related lists in that queries to the related tables are performed by the script.

These lists can be configured via the Scripted Related Lists (

...

sys_related_list_script

...

Ключевое

Name - имя синтетического связанного списка

Apply to - к какой форме мы это применяем. На форме какой таблицы. Ссылка (reference) на sys_db_table. Нужно указать таблицу. По смыслу это ссылка на таблицу. Отображается Title таблицы. На формах записей, которые относятся к этой таблице, мы будем выводить наш ССС.

Query from - референс на таблицу, из которой мы будем вынимать записи для этого списка. 

Далее самое интересное.

Query with - скрипт, который нам формирует условие выборки. Есть несколько ключевых моментов:

  1. Есть объект current, это самое важное, это объект таблицы, для которой мы создаем наш query (таблицы из поля query from). По смыслу мы создаем какой-то запрос, который будет делать выборку для этого листа. И ключевое, что в этом скрипте должно быть, это, current.addQuery, и дальше какой-то там query, или какие-то addCondition, и тд тд и тд, и в итоге для current мы должны сформировать какой-то запрос, и соответственно исходя из этого он будет показывать записи.
  2. Есть объект parent, это ссылка на объект формы из apply to. Parent это форма записи, current это лист таблицы из query from. Вот, собственно говоря, и все. Исходя из этого query, мы формируем запрос и выводим обычный стандартный релейтед лист как положено.

Надо описать обязательно объекты parent и current, потому что от них все зависит, они все делают. Скрипт может быть в принципе любым. 

  1. Navigate to {your_instance_url}/list/sys_related_list_script;
  2. Click New, fill in the form and click Save.

Relationships form fields

) table.

To set up a scripted related list, please complete the steps below:

  1. Navigate to System Settings → Scripted Related Lists.
  2. Click New and fill in the form.
  3. Click Save or Save and Exit to apply changes.

Relationships form fields

FieldMandatoryDescription
NameYRelationship name displayed in the list.
Apply toYSpecify the table on the forms of which this related list will be displayed.
Query FromYSpecify the table containing the source records for this list.
Query WithYIn this field, you can put down a script specifying the records to include from the table processed by this relationship. 


In your scripts, you are free to use current and parent objects. The main purpose of this script is to generate a query that will be applied to the table specified in the Query From field.


Info
  1. The current object is an object of the table where the query is created (the table specified in the Query From field).
  2. The parent object is a reference to the object of a table specified in the Apply to field.

In other words, the parent object is a record form specified in the Apply to field, and a current object is a list from a table specified in the Query From field.

You can use any SimpleRecord Server-Side methods as directives in the current and parent objects

...

.