Unknown fields updating report with xml source

Hi.

I'm modifying an .NET application wich exports info to xml files that will be further readed by Crystal Reports.

I've added a new field in one of the system tables, it's related XML is correctly updated, but when I try to set again the Datasource Location of the Report to him in order to update fields I get strange results.

On Map Fields screen I get one of the original fields of the report unmapped, and on the new source fields y get the one I've added and two new fields apparently appeared from nowhere.

XML principal nodes are like:
<municipio>
    <municipio>145</municipio>
    <isla />
    <denominacion>S.EMILIANO</denominacion>
    <mayor50k>false</mayor50k>
</municipio>

The new field is <mayor50k>, however when I try to update the source, Crystal Reports says that "municipio" isn't mapped to the report (althought this field is currently showing correct data on the report), and on the new unmapped fields I get "municipio_Id", "mayor50k" and "municipio_Id_0"

It's my first encounter with Crystal Reports and I'm a bit confused with this problem. Any help will be welcomed.
LVL 19
BardobraveAsked:
Who is Participating?
 
mlmccConnect With a Mentor Commented:
Are all the nodes the same

<municipio>
    <municipio>145</municipio>
    <isla />
    <denominacion>S.EMILIANO</denominacion>
    <mayor50k>false</mayor50k>
</municipio>

Looking at your sample node the mayor50k is a field in the xml

The node uses municipio twice.  I suspect that is why you are getting the ID fields.  Can you modify the XML file so you don't reuse the municipio name?

mlmcc
0
 
Bob LearnedCommented:
What version of Crystal Reports are you using?  Are you using an external version, or the internal IDE version?  How did you map the data source in the Crystal Reports designer?
0
 
mlmccCommented:
Did yo utry simply using the VERIFY DATABASE option rather than the set database location?

mlmcc
0
Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

 
BardobraveAuthor Commented:
I will check version on monday. I'm using the external program. To map the source I select a XML database connection and select the updated file, then the system detects that this have changes respect previous version and prompts me to the mapping window.

Yes I've tried with Verify Database and with Update option also. Three ways conduce me to the same mapping window with same options and same strange unkown fields.
0
 
Bob LearnedCommented:
Can you attach a screen shot of the mapping window, so that I can understand the context for your problem?
0
 
BardobraveAuthor Commented:
Crystal Reports Version is 10.0.0.533

When I try to refresh report data (F5), I get conduced to attached image1.

As you can see, field "municipio" gets unmapped, and CR find it matcheable to "mayor50k", the new field in my XML source file.

In image2 you can see what happens when I uncheck types comparison. Two new fields appear "municipio_Id" and "municipio_id_0". These two fields don't exist on XML source file and I dno't have idea from where they come.

My problem is that, whatever I select in this window, my report always get the 3 new files and unloads the field "municipio", I also get a mess with the data, obtaining empty records inserted between correct ones...
image1.JPG
image2.JPG
0
 
mlmccCommented:
Is that the correct mapping?

Its been a while since I built a report off an XML file but I seem to recall having fields "generated" in that way.  They seemed to be XML id fields but unrelated to the data.

mlmcc
0
 
Bob LearnedCommented:
When I map a data source to a Crystal Report, I map it to an .xsd document that I control, so it doesn't change unless I change it.  I believe that way is better than mapping to a DataSet object that may or may not change...
0
 
BardobraveAuthor Commented:
Hi experts, I answer you separately

mlmcc:
Those two Id fields doesn't exist on XML file, I don't know from where are they coming. Even they values doesn't correspond to the real id values, who are stored in "municipio" field, the one that is losing mapping.

TheLearnedOne:
Sadly this is an application that's already created, I'm only making some required modifications (I'm not it's original creator) and I'll need to add a new field to several reports. If I change the way data are being seeded to the report I supose that I'll need to recreate these reports (as changing the source it's giving some trouble), I'd rather prefer to understand why it's happening this and how to solve it.

Thanks for your responses.
0
 
Bob LearnedCommented:
When you work with a DataSet object and XML, it sometimes can infer a field from an extra attribute that gets added to the DataSet.  I would examine the XML that gets generated with DataSet.WriteXml to see if you can understand where those extra attributes are coming from.
0
 
BardobraveAuthor Commented:
Hi mlmcc.

I've thought of that too... but sadly this would mean change more than 50 xml files structure and their generation sources. I'll try to do it manually on a test file to see if the problem fixes this way... on that case... well... I'll see what to do.
0
 
BardobraveAuthor Commented:
Ok, you hit the spot.

After removing duplicity on node names report updating gets no more strange fields from the twilight zone... the original programmer used DataSet.WriteXml method to generate XML files in an automated way, he also gave same name to the table and one of it's fields.

This is the reason why the node gets repeated, now it's my time to fix it... I think that I'll use a method to programatically change father's node name in the XMLs and call it just after XML generation.

Thanks for your time gentlemen.
0
 
BardobraveAuthor Commented:
You hit the spot. Although I've though of it as a possible reason from the beginning I've thrased it for thinking it should be so simple... it's good to have a community of experts helping you to open your eyes ^_^
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.