cancel
Showing results for 
Search instead for 
Did you mean: 

Foreign Key Management

Former Member
0 Kudos

I have created a MasterData UDO and I use it on a form that is AutoManaged. One of the fields in my MasterData Table is a foreign key to another table ( simple UDT ) . What I am trying to do is to get values from fields in that table to show in controls on the form automatically.

My MasterData table MyMD has a field X that has the property LinkedTable set to a simple table MyLT. MyLT also has a field with the same name and type as X.

I am binding an EditText to field X in table MyMD and another EditText to a field in table MyLT (different from X). I would like to have the second EditText value filled in by based on the value X in the first EditText.

This doesn't work, though. I have changed table MyLT to MasterData and it still doesn't work. Has anyone faced this issue before ?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Tibi,

You must create your "MyLT" table as a MasterData Object.

Then, in your "MyMD" form, you must add a ChooseFromList to the EditText that will display the "MyLT" table records.

You can take a look at the SDK ChooseFromList sample to guide you. Also there are lots of posts about the subject in the forum.

If you have any particular doubt, let us know.

Regards,

Vítor Vieira

Answers (4)

Answers (4)

Former Member
0 Kudos

Now the CFL works , but the value in the edittext bound to the U_TEST field is not completed - I've tried in add mode to select the element from the MyLT CFL - and also in find mode to select a MyMD entry and have values load to controls, but no result.

Former Member
0 Kudos

Hold on, i found the problem - i didn't allow find for MyLT object.

Former Member
0 Kudos

Here it is. The form is set to Automanaged true, and the form object type is MyMD. I'm using DBDataSource for edittexts.

EditText bound to Code field in MyMD

<item uid="txtCode" type="16" left="41" tab_order="0" width="80" top="91" height="14" visible="1" enabled="1" from_pane="1" to_pane="1" disp_desc="0" right_just="0" description="" linkto="" forecolor="-1" backcolor="-1" text_style="0" font_size="-1" supp_zeros="0" AffectsFormMode="1">

<AutoManagedAttribute/>

<specific TabOrder="0">

<databind databound="1" table="@MyMD" alias="Code"/>

</specific>

</item>

EditText bounded to a field in MyLT

</item>

<item uid="46" type="16" left="273" tab_order="0" width="160" top="478" height="14" visible="1" enabled="0" from_pane="1" to_pane="1" disp_desc="0" right_just="0" description="" linkto="" forecolor="-1" backcolor="-1" text_style="0" font_size="-1" supp_zeros="0" AffectsFormMode="1">

<AutoManagedAttribute/>

<specific TabOrder="0">

<databind databound="1" table="@MyLT" alias="U_TEST"/>

</specific>

</item>

EditText with CFL

<item uid="184" type="16" left="150" tab_order="0" width="80" top="502" height="14" visible="1" enabled="1" from_pane="1" to_pane="1" disp_desc="0" right_just="0" description="" linkto="" forecolor="-1" backcolor="-1" text_style="0" font_size="-1" supp_zeros="0" AffectsFormMode="1">

<AutoManagedAttribute/>

<specific TabOrder="0" ChooseFromListUID="CFL_2">

<databind databound="1" table="@MyMD" alias="U_X"/>

</specific>

</item>

the CFL :

<ChooseFromListCollection>

<action type="add">

<ChooseFromList UniqueID="-1" ObjectType="-1" MultiSelection="0" IsSystem="1"/>

<ChooseFromList UniqueID="CFL_2" ObjectType="MyLT" MultiSelection="0" IsSystem="0"/>

</action>

</ChooseFromListCollection>

Former Member
0 Kudos

Thanks for the reply.

I'm trying it now, but I've only been using Screen Painter and the CFL I add doesn't function ( i'm getting the -1103 error ). I'll try adding it from code and see if it works.

Former Member
0 Kudos

Hi Tibi,

Can you please post your xml form code? The problem by there.

Regards,

Vítor Vieira