Expand my Community achievements bar.

Update within Relationship table list does not persist to parent schema

Avatar

Level 2

I have a Relationship table defined between two tables that contains links to respective tables.

Within a form, I have an input of type "list" based on the Relationship table defined above. The list references fields from both tables and (as expected) allows to edit values of those fields. Once a filed is updated, "Save" button appears within the related container and the changes are seemingly propagated - the field displays an update value. However, the actual object whose field was just "updated" retains its original value and, as soon as the screen is Refreshed (F5), the field displays its original value again.

Relationship table definition:

...

<element label="RelTable" name="relTable">

  <key internal="true" name="id">

      <keyfield xlink="table1"/>

      <keyfield xlink="table2"/>

    </key>

  

    <element integrity="neutral" label="Table1" name="table1" revIntegrity="own"

             target="cus:table1" type="link"></element>

    <element integrity="neutral" label="Table2" name="table2" revIntegrity="own"

             target="cus:table2" type="link"/>

</element>

...

Input Form:

...

<container colcount="2" label="CB Extend">

          <input img="nms:geolocation.png" nolabel="true" type="list" xpath="relTable">

            <input label="Field1" xpath="table1/@fieldId"/>

            <input label="Name" xpath="table1/@fieldName"/>

            <input hidden="true" xpath="[@table2-id]"/>

            <input hidden="true" xpath="[@table1-id]"/>

            <orderBy>

              <node expr="[table1/@fieldName]"/>

            </orderBy>

          </input>

        </container>

....

Would anyone have any suggestions?.. Thank you!

8 Replies

Avatar

Community Advisor

Hi,

The form is on the bridge table? If so, change revIntegrity to integrity.

You probably also want owncopy instead of own.

Thanks,

-Jon

Hi @wodnicki !

Updated schema definition to this:

<element label="RelTable" name="relTable">

  <key internal="true" name="id">

      <keyfield xlink="table1"/>

      <keyfield xlink="table2"/>

    </key>

 

    <element integrity="neutral" label="Table1" name="table1" revIntegrity="owncopy"

             target="cus:table1" type="link"></element>

    <element integrity="neutral" label="Table2" name="table2" revIntegrity="owncopy"

             target="cus:table2" type="link"/>

</element>

Same result      

could you please elaborate on "The form is on the bridge table? If so, change revIntegrity to integrity."

Thank you!

Avatar

Community Advisor

Hi,

The form container in the original post is unclear- Is there a third schema that's backing it, hosting the UI for the bridged elements?

Either way, AFAIK changes via xtk:persist#Write (console form) will propagate only to owned schemas, not vice-versa as in the schema defined above. Options would then be either make your own xtk:persist#Write calls in <postSave/> event (hacky), or try adding zoom="true" editable="false" to the <input/> element (degraded ux).

Thanks,

-Jon

Avatar

Level 10

Hi wodnicki ,

Thank you for all your participation in our community

Any ideas for Tetyana? She's having the same result.

Thanks again!

Avatar

Community Advisor

Hi,

Try by changing element label and name with revLink in schema definition:

<element label="RelTable" name="relTable">

  <key internal="true" name="id">

      <keyfield xlink="table1"/>

      <keyfield xlink="table2"/>

    </key>

 

    <element integrity="neutral" label="Table1" name="table1" revLink="relTable" revIntegrity="own"

             target="cus:table1" type="link">

   <join xpath-dst="@id" xpath-src="@table1-Id"/>

  </element>

    <element integrity="neutral" label="Table2" name="table2" revLink="relTable" revIntegrity="own"

             target="cus:table2" type="link">

      <join xpath-dst="@id" xpath-src="@table2-Id"/>

</element>

Thanks.

Avatar

Community Advisor

Hi,

Out of curiosity, how would changing the name of the link impact data propagation?

Thanks,

-Jon

Avatar

Community Advisor

Hi,

It is creating reverse link to your main table. I think it will solve the issue.

Thanks.

Avatar

Community Advisor

Hi,

Reverse links are automatically created when creating links, with the option to change the reverse link's name from its default of target schema using attribute 'revLink'- the example you posted sets it to the existing default.

AFAICT the issue isn't about changing the link name, it's a form input being used to set values in a way underlying relationships don't support.

Thanks,

-Jon