Hexagon Geospatial
MENU

M.App Enterprise

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
Contributor
Posts: 28
Registered: ‎02-22-2017

mobile - database view for disctinct list

Hi,

 

I created a database view to have a distinct list of my object.

 

And how can I use this database view in my picker? I tried it with a new Entity in the Shell.xaml but it doesn't work. 

 

 

 

Regards, Maike

Staff
Posts: 507
Registered: ‎11-12-2015

Re: mobile - database view for disctinct list

[ Edited ]

hi maike,

 

A posted sample of your entity and picker definition would be helpful here.

 

Have you setup the view table in an entity?

Has the picker items been associated to the view and a display member assigned? ie. Items= "{Entity EntityName}"

 

Its hard to provide advice on this given the information provided.

Contributor
Posts: 28
Registered: ‎02-22-2017

Re: mobile - database view for disctinct list

Pardon me for the less information. 

 

I have an Entity with the view table (picker_nutzbez). 

<Shell.Entities>
		<Entity Id="Gruenflaechen" Table="gruenflaechen_ausw" Key="id" SyncType="Automatic">
			<Field Name="id" Type="Guid" IsRequired="True" />
			<Field Name="nutzbez" Type="String" IsRequired="True" MaxLength="100" />
			<Field Name="neuaufnahm" Type="Datetime" />
			<Field Name="aenddat" Type="Datetime"/>
			<Field Name="strasse_neu" Type="String" />
			<Field Name="geometry_new" Type="Geometry" />
			<Field Name="bild" Type="Binary" />
			<!--Entity.Triggers>
				<UpdateFieldTrigger Method="BeforeSave, BeforeUpdate" Field="id" Value="@{System.id}" />
			</Entity.Triggers-->
		</Entity>
		<Entity Id="Picker" Table="picker_nutzbez">
			<Field Name="nutzbez" Type="String" />
		</Entity>
	</Shell.Entities>

In my Form.xaml I have Items="{Entity EntityName}". 

<Picker Name="nutzbez" Title="Nutzungsbezeichnung" KeyMember="nutzbez" DisplayMember="nutzbez" Items="{Entity Picker} />

 And the definition of the picker in PostGIS (pgAdmin 4):

-- View: public.picker_nutzbez

-- DROP VIEW public.picker_nutzbez;

CREATE OR REPLACE VIEW public.picker_nutzbez AS
 SELECT DISTINCT gruenflaechen_alt_pufferzonen.nutzbez
   FROM gruenflaechen_alt_pufferzonen
  ORDER BY gruenflaechen_alt_pufferzonen.nutzbez;

ALTER TABLE public.picker_nutzbez
    OWNER TO postgres;

For the picker, it still takes the items of the "Gruenflaechen Entity". 

 

 

Regards, Maike

Staff
Posts: 57
Registered: ‎10-25-2016

Re: mobile - database view for disctinct list

Hi Maike,

 

can you have a look if you get an error in device or studio log?

 

Can you try to add Key="nutzbez" to your new entity?

 

Otherwise it looks right.

 

Regards

Christian

Highlighted
Contributor
Posts: 28
Registered: ‎02-22-2017

Re: mobile - database view for disctinct list

Hi Christian,

 

thank you for your answer.

 

I added Key="nutzbez" to my new entity. Now, I have a studio log (no authority for the relation picker_nutzbez), which I attach as zip file. 

 

 

 

Regards, Maike

 

 

 

Contributor
Posts: 28
Registered: ‎02-22-2017

Re: mobile - database view for disctinct list

Are there any ideas?

Staff
Posts: 57
Registered: ‎10-25-2016

Re: mobile - database view for disctinct list

PostgreSql error 42501 means your database user doesn't have access to table picker_nutzbez.

 

Maybe you have added the table with a different user?

 

Regards

Christian

 

 

Do you need immediate support?
If you encounter a critical issue and need immediate assistance please submit a Development Ticket through our Development Ticket Portal.