null values in xml.serializer.variabletodom()

Started by Holger S., April 04, 2019, 09:43:20 AM

Previous topic - Next topic

Holger S.

How can I use xml.serializer.variabletodom(rec, n) in 3.10 if rec contains fields with null values
rec is defined with like (rec like artikel.*)

Sisavanh S.

Hi,

Do you have a sample we can test ?
I presume you are looking for the XMLNILLABLE attribute ?
For more details, see:
https://4js.com/online_documentation/fjs-fgl-manual-html/#fgl-topics/c_gws_XML_attribute_XMLNillable.html

Best regards,
Sisa.

Holger S.

I see. But that means we have to adapt thousands of source code lines
to replace i.e
define cust record like customer.*
by
define cust record
   cust_id integer primary key,
   cust_name varchar(50) not null,
   cust_address varchar(100) ATTRIBUTES(XMLNillable),
   cust_zipcode char(10)ATTRIBUTES(XMLNillable),
   cust_state char(2) ATTRIBUTES(XMLNillable),
   cust_comment varchar(255) ATTRIBUTES(XMLNillable)
end record
In genero 2.50 it worked with like table.*

Holger S.

Is there any chance to get ATTRIBUTES(XMLNillable)
as default if the compiler sees LIKE <table>.* definitions?

Sisavanh S.

Hi,

Have you tried XMLNILLABLE on the root element only ?
And no XMLNILLABLE for the other embedded  variables ?

For example:
DEFINE cust RECORD ATTRIBUTES(XMLNillable)
   cust_id integer,
   cust_name varchar(50),
   cust_address varchar(100),
   cust_zipcode char(10),
   cust_state char(2),
   cust_comment varchar(255)
END RECORD

If you still have an issue, please contact your local support center.

Best regards,
Sisa.

Reuben B.

Holger,

Did you see the following entry in the 3.10 Upgrade Guide http://4js.com/online_documentation/fjs-fgl-manual-html/#fgl-topics/c_fgl_Migrate_to_310_web_services.html

I suspect that you need to follow that and replace

Code (genero) Select
DEFINE cust RECORD LIKE customer.*

with

Code (genero) Select
DEFINE cust RECORD ATTRIBUTE(XMLElementNillable) LIKE customer.*

http://4js.com/online_documentation/fjs-fgl-manual-html/#fgl-topics/c_gws_XML_attribute_XMLElementNillable.html

Reuben


Product Consultant (Asia Pacific)
Developer Relations Manager (Worldwide)
Author of https://4js.com/ask-reuben
Contributor to https://github.com/FourjsGenero

Holger S.

Hi Reuben,
I get an error compiling code with Record LIKE definition

  DEFINE pakstat RECORD ATTRIBUTE(XMLElementNillable) LIKE akstatus.*
| Attribute 'XMLElementNillable' is only allowed on a record definition.
| See error number -9007.

fglcomp 3.10.17 rev-889c7091