1 (edited by kbalmer 28-05-2010 08:47:37)

Re: Problems getting basic XML examples to work

I thought I'd investigate writing XML reports today and spent a few fruitless hours trying to get Example 1 in the help system to work, i.e. this one:

<?xml version="1.0" ?>

<CustomReport menupath="Site Reports" title="Alphabetic List of Locations" description="Lists all location names in alphabetic order with their central spatial reference. Preferred is 'Yes' for preferred names and 'No' for alternative names.">

<SQL>

Select

Location.Location_Key,
Location_Name.Item_Name,
Location_Name.Preferred,
Location.Spatial_Ref

From Location Inner Join Location_Name On Location.Location_Key = Location_Name.Location_Key

<Where Keytype="Default">

Order By Location_Name.Item_Name

</Where>

</SQL>

</CustomReport>

I eventually found the problem that is worth passing on to any other newbie (and need to be fixed in a future version of the help and/or Recorder)...

Keytype in the above example begins with an upper-case K when it appears to need to be lower-case.

I also thought there was a problem with keytype="Default" as the query never showed under Quick Reports. (I had inadvertantly presumed that that this meant it would always show, but actually relates to what it does under Reports->Run (I think).

(Mike Weideli's basic example in (http://www.jncc.gov.uk/files/R6XMlHelpMike2.zip) is therefore okay, when I first reported it as not working, as it didn't show under Quick Reports).

Note that I got no error messages during the debug. I don't know if error reports are going somewhere that I haven't found yet...? Mike's help says "Any errors in the structure will give rise to an error message when Recorder 6 is opened" so I'd expected to be told something about "Keytype" being spelled with upper-case?

Newbies also note that it appears necessary to exit and re-enter Recorder with each change you make to the XML, a subtlety I missed at first which compounded the frustration.

Regards, Keith

2

Re: Problems getting basic XML examples to work

You can get away with making some changes to XML reports without closing and re-entering Recorder. Most of the time just changing the SQL  will work, but not changes the tags, attributes etc.

I wasn't aware that the use of upper case for attributes didn't cause an error when Recorder loaded and this is certainly something to watch for.  Most structural errors, seem to be picked up.

You are right that ketype = 'default' is what happens when you use the run menu. Other keytype (eg.  'location',) determine what happens  in  quick reports.

Mike

Mike Weideli

3

Re: Problems getting basic XML examples to work

A suggestion for Mary to add to the list. It might be easier if xml reports consistently used lower case for all the element and attribute names. Now, we don't want to break all the existing reports, but perhaps the approach could be to change the code to allow either the current casing,  or lowercase, then change the documentation to lowercase.

Just a thought as this has caught me out a couple of times.

John van Breda
Biodiverse IT

4

Re: Problems getting basic XML examples to work

Noted, many thanks for raising this.