#1 Yesterday 14:08:02

itSDS
Member
From: Germany
Registered: 2014-04-24
Posts: 560

Problem senden Enum - Value

Hi Arnaud, im sending objects with soa call to server.
This Object contains a enum

published
property Einheit : TEinheitEnum read fEinheit

the Value Einheit is not contained in the JSON send to m2 Server, Einheit on Server is uninitialized
i checked ctxt on client an not Entry for Einheit.

What can i do ?


Rad Studio 12.3 Athens / 13.0 Ganymede

Offline

#2 Yesterday 14:12:37

itSDS
Member
From: Germany
Registered: 2014-04-24
Posts: 560

Re: Problem senden Enum - Value

it is not a generell problem, sending other Object containing enum value works as expected...


Rad Studio 12.3 Athens / 13.0 Ganymede

Offline

#3 Yesterday 19:35:51

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 15,076
Website

Re: Problem senden Enum - Value

If the field is missing, it is left in its previous value.
By design choice.

Offline

#4 Yesterday 19:47:40

itSDS
Member
From: Germany
Registered: 2014-04-24
Posts: 560

Re: Problem senden Enum - Value

Hm what previous Value do you mean. I only change 1 Value in Object then put whole Objekt to soa call ?
All members are transfered except the enum one.

On Server Site a wrong value is in that enum field.


Rad Studio 12.3 Athens / 13.0 Ganymede

Offline

#5 Today 06:35:04

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 15,076
Website

Re: Problem senden Enum - Value

Ah I did not understand.

How is the TEinheitEnum type defined?
It should be a continuous type like (one, two) , with no numerical value like (one=1, two).

Offline

#6 Today 08:23:42

itSDS
Member
From: Germany
Registered: 2014-04-24
Posts: 560

Re: Problem senden Enum - Value

Hi i found the Error

My Enum is like this:
TEinheitEnum = (
first,
second,
third,
fourth
);

in class constructor i set member fEinheit to "third" (Because i like it initialized with third value) The Enum is kind of sorted smile
Now in client its set to "first"

if its set to first, the value is missing in JSON - Data send to server (as you said its optimized)
Because of this the expected Value is not sent to server.

As Solution i put my desired default value in top of enum
enum is now : (third, first, second, fourth)
It does not look good, but it works now.

Last edited by itSDS (Today 08:24:20)


Rad Studio 12.3 Athens / 13.0 Ganymede

Offline

#7 Today 10:03:52

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 15,076
Website

Re: Problem senden Enum - Value

Are you sure the constructor is actually called?

Ensure you inherit e.g. from TSynPersistent and override its virtual constructor.

Offline

Board footer

Powered by FluxBB