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
Occasional Contributor
Posts: 8
Registered: ‎03-15-2019

Mobile App: List Search for Field based on another table

Hello,I'm looking for a solution to my problem.

 

In my form there is a Picker that is linked to another entity (Example from Mobile Documentation):

<Picker Name="task_id" Title="Task" KeyMember="id" DisplayMember="name"
              Items="{Entity Tasks}" />

 

Therefore the saved value in my table is an ID of the entity Tasks. Now, if I want to search my List for a specific task which is the value mapped to the ID. Is there a way for this?

 

The Entity.Filter sql statement is very limited and I reckon a join is needed to map the values regarding their ID.

 

Hope, this is understandable. Thanks for any information!

 

Highlighted
Technical Evangelist
Posts: 735
Registered: ‎11-12-2015

Re: Mobile App: List Search for Field based on another table

Hi LaEichler,

 

I'm sorry but I dont understand the question you pose well enough to provide a meaningful response.

Perhaps another member understands and can help. Or you may wish to elucidate on your post by providing a visual example if possible (I like pictures that tell stories Smiley Wink )

 

Highlighted
Occasional Contributor
Posts: 8
Registered: ‎03-15-2019

Re: Mobile App: List Search for Field based on another table

Hello sclow, thanks for reaching out.Sorry for being not precise, it's hard to explain, but I try again.

 

Lets say I'd like to map trees. In my DB there is a table for the trees I submit via form and another table for tree type, as there are so many and I'd like to be able to pick it from a list. So first I define a field treetype_id linked to the treetype table:

 

<!-- Shell.xaml -->
<Entity Id="tree" Table="baum" Key="id" SyncType="Automatic" RevisionField="lastupdatetime">
         [...]
	<Field Name="treetype_id" Type="Guid" ForeignEntity="Treetype" />
</Entity>

Then in Form.xaml I set a Picker to get a list of the values and be able to set the tree type:

<!-- Form.xaml -->
<Picker Name="treetypePicker" Title="Select Tree Type" KeyMember="id" DisplayMember="type" Items="{Entity Treetype}"/>

Now I'd like to display the tree type in the List view which is done with:

<!-- List.xaml -->
<ListCell Name="treetype_id" Title="Type" ForeignField="type" />

So far so good. Now I would like to search the list entries for tree type, how do I do this?

 

Screenshot_mobileApp_SearchTreeType

 

So I started with these code snippets but obviously this does not work, as the treetype_id is saved in the column, but I need to search the type.

 

<!-- Shell.xaml -->
<Entity.Filters>
	<Filter Id="TreeSearch" Sql="type LIKE @{TreeSearch}" />	
</Entity.Filters>

<!-- List.xaml-->
<List.ShellActions>
        <SearchShellAction Filter="TreeSearch" Placeholder="Search for tree type" />
 </List.ShellActions>

Hope this explains it better. Thanks for any help!