M.App Enterprise Discussions

Discuss topics with other M.App Enterprise Product pioneers and experts to get the most out of it.
Showing results for 
Search instead for 
Do you mean 
Reply
Highlighted
Contributor
Posts: 64
Registered: ‎11-15-2018
Accepted Solution

Mobile APP: How to show values of foreign table in Form.xaml

Hello,

 

How can you show in form (for entity A) one or more(!) values of entitiy B
if entity A has foreign_key of entity B?

 

table A:
id
id_B
...

 

table B:
id
name
address

 

How to show name and address?

I know, how to show one foreign value in List.xaml,
but I don't get it run for Form.xaml.

 

Many thanks,

Iris

Highlighted
Contributor
Posts: 64
Registered: ‎11-15-2018

Re: Mobile APP: How to show values of foreign table in Form.xaml

Hi,

 

Ok I found a solution by using picklist and filter.
I didn't know that you can use more than one picker with same Name...

 

So scenario above you can realise in the following way:

 

FormA.xaml:

Picker Name="id_B" Title="Name" KeyMember="id" DisplayMember="name"
    Items="{Entity table_B, Filter=TableBFilter}" IsEnabled="False"/>
<Picker Name="id_B" Title="Address" KeyMember="id" DisplayMember="address"
    Items="{Entity table_B, Filter=TableBFilter}" IsEnabled="False"/>



Shell.xaml:

<Entity Id="table_B" Table="table_B" Key="id" SyncType="Automatic" >
	<Entity.Filters>
		<Filter Id="TableBFilter" Sql="id = @{id_B}  " />
	</Entity.Filters>
			
	<Field Name="id" Type="Guid" IsRequired="True" />			
	<Field Name="name" Type="String"  />	
	<Field Name="address" Type="String" />						
</Entity>



Regards,

Iris

Highlighted
Staff
Posts: 105
Registered: ‎10-25-2016

Re: Mobile APP: How to show values of foreign table in Form.xaml

Hi Iris,

 

you can also use a table:

 

<Table Name="items" Title="Items" Entity="table_B" RowCount="5">
  <TableCell Name="name" Title="Name" />
  <TableCell Name="address" Title="Address" />
</Table>

Make sure to mark the foreign relationship in Shell.xaml (table_A):

 

<Field Name="id_B" Type="Guid" ForeignEntity="table_B"  />	

Regards

Christian

Highlighted
Contributor
Posts: 64
Registered: ‎11-15-2018

Re: Mobile APP: How to show values of foreign table in Form.xaml

Hi Christian,

 

yes, a table is fine, but sometimes form looks better if you have single fields,

especially if you only have a few values.

 

Thank you very much,

Iris