Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Help with Dynamic XML dataset in CR XI Post Reply Post New Topic
Author Message
Fernanthonies
Newbie
Newbie


Joined: 18 Mar 2009
Online Status: Offline
Posts: 2
Quote Fernanthonies Replybullet Topic: Help with Dynamic XML dataset in CR XI
     Posted: 18 Mar 2009 at 12:18pm
First off, I am new to both this forum and to Crystal Reports, so bare with me...

I am trying to generate a report in CR based off of an XML dataset, and I am trying to figure out if what I am trying to do is even possible.

We have a pricing program that lets you configure this "unit" and choose its different components and such. That program spits out an XML file that describes the components present, and I want to be able to generate a report that lets you view the details on that Unit and its components.

The problem is that I have put together a report in CR for a full unit, and we want to be able to connect an XML file from any unit to that report, but some units may not have all the components of others. That causes the report to break because the dataset from that XML file doesn't have all the fields that are used in the report.

So my question is, is there some way to use "dynamic fields" or something like that, so that if the dataset you are using at the time doesn't have a specific field, it doesn't make the report go "poof".

My limited experience with CR makes me think that its just not designed to do something like this, but maybe it is and I just don't know about it.

Anyway, thanks in advance for any help.

Edited by Fernanthonies - 18 Mar 2009 at 12:19pm
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 19 Mar 2009 at 6:55am
No, I think that you are correct.  When you design a report, you set a template of what fields are expected in the report (or more importantly what fields will be displayed/used).  You can send more fields than existed at the time of the reports creation, but you must always send the fields that are displayed/used by the report...otherwise you get an error. 
 
Depending on the number of components an how you call Crystal, you might be able to create a series of reports, but that becomes a maintance headache, what would be easier to do would be to modify the XML so that every component is defined in the table structure...XSD (actually you just need and XSD file with all of the component fields defined, since the XML file usually bother to pass empty fields).  Now any component not passed appears as a null value.  You can choose to suppress the fields that are null so that they don't display on the report.
 
Now would be the really hard part, how to make a decent looking report with random fields being blank.  What I have done, and it gets redundantly boring and semi complex is to pass a field in a second table that determines the order of the columns on the report...depending on the subtotalling needed there can be a lot of formulas running to create totals that are needed.  Another method would be to put each component on its own detail line and then suppress the lines where the fields are null.
 
All of my reports run off of XML files, so I have a bit experience, but I usually ensure that all the fields desired are in every dataset.  If nothing else, this might be the start of an idea that solves the problem.
 
Hope some of this helped...
IP IP Logged
Fernanthonies
Newbie
Newbie


Joined: 18 Mar 2009
Online Status: Offline
Posts: 2
Quote Fernanthonies Replybullet Posted: 19 Mar 2009 at 7:29am
That did help, thank you. I'm gonna talk to the guy that is working on the pricing app and see if we can have it export an xml file that contains all the fields needed, whether that component is present or not.

Thanks again.
IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum