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

Mobile App - save change

[ Edited ]

Hi,

 

I tried to save changes in my mobile app in the form, but there are always the same log-entries: 

Einfügen oder Aktualisieren in Tabelle »sx_devicelog« verletzt Fremdschlüssel-Constraint »fk_sx_devicelog_app_id« and

42883: Operator existiert nicht: integer = text (operator not exists: integer = text)

and I have no idea, where I can change something about the foreign key and which operator I have to change and where.  

 

 

 

Regards, Maike

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

Re: Mobile App - save change

Hi Maike,

 

can you post the stack trace of the log entry?

 

Regards

Christian

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

Re: Mobile App - save change

Hi Christian,

 

thank you for your answer.

 

I attach the log entries.

 

 

 

Regards, Maike

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

Re: Mobile App - save change

Hi Maike,

 

the foreign key constraint error is probably because the client tried to sync device logs of an already deleted app.

 

The other error looks like an entity table definition mismatch.

 

Can you post your entity and table definition?

 

Regards

Christian

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

Re: Mobile App - save change

Hi Christian,

 

thanks a lot for your answer. 

 

And what can I do, to solve the problem with the foreign key constraint?

 

Entity definition: 

 

<?xml version="1.0" encoding="utf-8" ?>
<Shell xmlns="http://schemas.snapworx.at/appshell/2016/xaml"
	   xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
	<Shell.Entities>
		<Entity Id="Gruenflaechen" Table="gruenflaechen_auswahl" 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>
	</Shell.Entities>
	
</Shell>

 

table definition:

-- Table: public.gruenflaechen_auswahl

-- DROP TABLE public.gruenflaechen_auswahl;

CREATE TABLE public.gruenflaechen_auswahl
(
    dataid character varying(11) COLLATE pg_catalog."default",
    pflegebzrk character varying(60) COLLATE pg_catalog."default",
    lfdnr integer DEFAULT 0,
    neigung character varying(50) COLLATE pg_catalog."default",
    nutznr character varying(20) COLLATE pg_catalog."default",
    nutzbez character varying(60) COLLATE pg_catalog."default",
    besitzer character varying(60) COLLATE pg_catalog."default",
    pflegekat character varying(200) COLLATE pg_catalog."default",
    pflegetrp character varying(60) COLLATE pg_catalog."default",
    aenddat timestamp without time zone,
    neuaufnahm timestamp without time zone,
    lfdgtnr integer DEFAULT 0,
    objektnr character varying(20) COLLATE pg_catalog."default",
    strasse_neu character varying(100) COLLATE pg_catalog."default",
    flaeche_ber double precision,
    guid uuid,
    id integer NOT NULL DEFAULT nextval('gruenflaechen_auswahl_id_seq'::regclass),
    geometry_new geometry(GeometryZ,25832),
    bild bytea,
    CONSTRAINT gruenflaechen_auswahl_pkey PRIMARY KEY (id)
)
WITH (
    OIDS = FALSE
)
TABLESPACE pg_default;

ALTER TABLE public.gruenflaechen_auswahl
    OWNER to bb;

Regards, Maike

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

Re: Mobile App - save change

Hi Maike,

 

> And what can I do, to solve the problem with the foreign key constraint?

 

Does it occur after each login?

 

The name of your Guid column is "guid", but in your entity definition you have specified "id" as field and entity key.

If you change that, it should work.

 

Also you can remove the following code, as it isn't required:

 

<Entity.Triggers>
    <UpdateFieldTrigger Method="BeforeSave, BeforeUpdate" Field="id" Value="@{System.id}" />
</Entity.Triggers>

 

Regards

Christian

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

Re: Mobile App - save change

Hi Christian,

 

I tested again the app and the problem with the foreign key constraint occurs in studio log after saving the change. 

 

I changed also the guid column and now the following error occurs in studio log: Spalte "guid" hat Typ uuid, aber der Ausdruck hat Typ text. Do you know which "Ausdruck" is meant in the log? Perhaps, I have something to change in the "Ausdruck"?

 

I also removed the Entity.Trigger. 

 

 

 

Regards, Maike

 

 

 

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.