I want to use the "includeFrom" in a DataSource definition but I have some problems.
I have two Tables: "t_users", and "t_notes".
The t_notes table has 2 rows which save the creator and modifier user, and these fields are foreign keys of the t_notes table: f_username_created and f_username_last_change
In the users DataSource, I have a DERIVED field "fullname":
But I cannot include the "fullname" field for two reasons:
1) the field "fullname" ist a DERIVED field, so it doesn't exist in the real table.
2) I cannot distinguish the two "includeFrom" fields from each other:
How can I use an includeFrom with derived fields, and distinguishing more than one "includeFrom" field from each other?
I am using SmartGWT 3.0p EE.
I have two Tables: "t_users", and "t_notes".
The t_notes table has 2 rows which save the creator and modifier user, and these fields are foreign keys of the t_notes table: f_username_created and f_username_last_change
Code:
notes: <DataSource ID="notizen" serverType="sql" tableName="t_notizen"> <fields> <field name="f_id" type="sequence" primaryKey="true" hidden="true" /> <field name="f_notiz" type="text" required="true" /> <field name="f_date_created" type="creatorTimestamp" /> <field name="f_username_created" type="creator" foreignKey="users.f_username"/> <field name="f_date_last_change" type="modifierTimestamp" /> <field name="f_username_last_change" type="modifier" foreignKey="users.f_username" /> <field name="fullname_created" type="text" includeFrom="users.fullname" /> <field name="fullname_last_change" type="text" includeFrom="users.fullname" /> </fields> </DataSource>
Code:
<DataSource ID="users" serverType="sql" tableName="t_users"> <fields> <field name="f_username" type="text" primaryKey="true" hidden="true" /> <field name="f_name" type="text" /> <field name="f_vorname" type="text" /> <field name="f_system_user" type="boolean" sqlStorageStrategy="number" /> <field name="fullname" type="text" customSelectExpression="CASE WHEN f_vorname IS NOT NULL THEN f_vorname + ' ' ELSE '' END + CASE WHEN f_name IS NOT NULL THEN f_name ELSE '' END " /> </fields> </DataSource>
1) the field "fullname" ist a DERIVED field, so it doesn't exist in the real table.
2) I cannot distinguish the two "includeFrom" fields from each other:
Code:
<field name="fullname_created" type="text" includeFrom="users.fullname" /> <field name="fullname_last_change" type="text" includeFrom="users.fullname" />
I am using SmartGWT 3.0p EE.
Comment