XML Nodes Issue / Question
Hello everyone!
I am generating my first report from an XML File and ran into a (hopefully minor) issue and I'm not sure how Fast Reports handles this.
My Node structure looks like this:
<Room>
<Width>
<Length>
<Height>
<Offsets>
<Openings>
</Room>
<Room>
<Width>
<Length>
<Height>
<Offsets>
<OffsetName>
<Width>
<Depth>
<Height>
</Offsets>
<Openings>
</Room>
The Offsets and Openings Nodes MAY contain child nodes and may not.
So, I have a couple of problems with this. I wasn't sure how this should be handled within Fast Reports
1) The Offset and Opening nodes do not show up in the DataSource in the designer.
2) Since the nodes may and may not exist, I'm unsure how Fast Reports will handle that if they don't exist.
This is going to be a multi-page report. I have a cover page already and am now trying to handle the Room pages, etc.
Any help is greatly appreciated. Thanks!
I am generating my first report from an XML File and ran into a (hopefully minor) issue and I'm not sure how Fast Reports handles this.
My Node structure looks like this:
<Room>
<Width>
<Length>
<Height>
<Offsets>
<Openings>
</Room>
<Room>
<Width>
<Length>
<Height>
<Offsets>
<OffsetName>
<Width>
<Depth>
<Height>
</Offsets>
<Openings>
</Room>
The Offsets and Openings Nodes MAY contain child nodes and may not.
So, I have a couple of problems with this. I wasn't sure how this should be handled within Fast Reports
1) The Offset and Opening nodes do not show up in the DataSource in the designer.
2) Since the nodes may and may not exist, I'm unsure how Fast Reports will handle that if they don't exist.
This is going to be a multi-page report. I have a cover page already and am now trying to handle the Room pages, etc.
Any help is greatly appreciated. Thanks!
Comments
you may use LinQ to XML , www.tutorialspoint.com/linq/
download tutorial in pdf format :
https://www.google.co.id/url?sa=t&rct=j...147448319,d.c2I
I did read through your tutorial on LINQ. Thank you for the information.
I am able to parse the XML file without an issue now (I did have a minor issue initially, but I have that working). I have the data in the report as well (Most of it).
I do have a couple of issues that I'm not sure how to solve.
This is my first multi-page report. I have the cover page put together and that seems to be working well. All of the data seems to be populating properly.
I added a second page that should be the content pages and I designed that, but I am only getting one content page and I should be getting 4...
I am also getting a plus sign on the cover page for some reason when I preview the report. I can also see it during design, but it is not selectable or able to be removed? I've attached a picture.
I also want to include a final Totals Page and wasn't sure how I would do a final page without messing up the content pages since Fast Reports does that automatically?
Thanks again, I'm sorry to be such a bother...
Personally, i love interactive report, look at fastreport demo, "Complex (hyperlinks, outline, TOC)".
For table of contents, i changed linked page number to [Engine.GetBookmarkPage([Categories.CategoryName])-2] , to exclude coverpage and table of contents, and in content page, i setted ResetPageNumber = true.
'ResetPageNumber' property and [PageNofM] macro, is that what you're looking for?
I'm sorry it took me so long to post back, I was trying to figure out where the issue actually was and I'm excited to report that I think I know what it is!
I am not sure how to fix it, but it appears to be caused by how Fast-Reports handles the XML Data. When converted to DataSets, it gives each group of data its own dataset, which ignores the Parent / Child relationship this data has in the XML file.
So, instead of pulling only the data applicable to the particular Parent Node, it pulls all of the data from the dataset.
For example, if my structure looks like this:
-Room Parent Node
Room Data
Room Data
Items
Item Data
Item Data
-Room Parent Node
Room Data
Room Data
Items
Item Data
Item Data
Item Data
This creates a dataset of Rooms and a dataset of Items completely ignoring that some Items are children of the parent Rooms...
Is there a way for Fast Reports to recognize the Parent / Child relationship of this data?
business object
xml to business object
....then push businessobject to fastreport
I am out of town on training the next couple of days, but I will try this method over the weekend.
Thank you very much.
1) How do I register the dbData? It seems like nothing I do works. I did find this post here, but can"http://www.fast-report.com/en/forum/?p=/discussion/5695" ] http://www.fast-report.com/en/forum/?p=/discussion/5695 [/url]
2) Do I need to do anything in my report to delete the dataset that is there now?
3) I'm not certain that I understand this code after reviewing it. Is this iterating through the XMLDocument and adding the measurement values to the dbData object? Do I also need to add to the object all of the other data from my XMLDocument?
I also attached a sample XML Document so that you could see what I was referring to just in case it was helpful. In addition to the offsets, I also have subnodes for openings and for items and main nodes for totals and such.
I'm trying to structure my report like this:
Room Data
Offset and Opening Data
Items
Room Data
Offset and Opening Data
Items
Totals
I'm very sorry for all of the questions and everything. I feel very very confused and just can't seem to wrap my head around what I'm supposed to be doing.
Thank you again for all of your help.
then use linq to query those tables.
I also received the attached error that I don't understand because I don't see how a Node would not support child nodes? That seems like a basic purpose of a node to me...?
Thanks again for all of your help!
<perhaps>yes</perhaps>
that node name ends with 's'
this part will give you that kind of error => if (item1.Name.EndsWith("s"))
here is the fix :
When I run this code, no datasource shows up in the Fast Reports Designer.
I did check the .csv file and I get something like this:
,Job,,,,,1,RDN
,Job,,,,,2,RDN
,Job,,,,,3,RDN
,Job,,,,,13,RDN
,Job,,,,,14,RDN
,Job,,,,,15,RDN
,Job,,,,,16,RDN
,Job,,,,,17,RDN
1st Floor,Living Room,,,,,7,RDN
1st Floor,Dining Room,,,,,,
2nd Floor,Master Bedroom,Offset 1,SubRoom,Yes,Missing Wall,,
Now, I understand that I need to flesh that out, and that is perfectly reasonable, but I'm still confused about the structure here and what it is sending over to the report. Is this basically combining all of the nodes into a single list? How will I be able to organize the items, offsets, and openings by room?
Thanks Again for all of your help, I really don't mean to be a bother...