none
XML and Templates ? RRS feed

  • Question

  • Hello Everyone,

     

    I don't know if this is the correct place to ask this question or not. I tried using the Report Viewer Control available in VS 2005 and doesn't give  me the required functionality as my report is in different formats. I was thinking maybe I can create an XML templates and based on user data generate it on runtime...

     

    Any advise how this can be achieved ?

    Saturday, June 23, 2007 6:01 PM

Answers

  • Hi Harsimrat,

     

    Thank you for being more explicit.

     

    These problems  that you're talking about really *are* solvable within the standard RDL/RDLC layouts.  So there is no need to resort to XML just for them! If you ever really need to go the XML+XSLT route, I will be happy to talk to you about that <s>. It is one of my favorite topics in the whole world!

     

    For now let's just talk about the layout problems that you want to solve -- which have nothing to do with my favorite topic, as it turns out <g>.

     

    I will want to telll you that your questions really have nothing to do with the ReportViewer, however.  They are *Report Design* problems.  IOW, they would affect you when designing an RDL or RDLC -defined  report even if ReportViewer was not the display mechanism.  OK?

     

    Now to your questions

     

    1)  I am not sure what kind of data region you are using. 

     

    1a) To start with, let's assume that you are using a List as the container for this address, maybe designing labels to be printed, or perhaps no data area at all (for example, this could be the address area of a letter, in the page header).  let's also going to assume that what you put in your message is a text label for each data value, so that the real layout looks something like this:

     

    Name :  <name field here>

    Age :    <age field here>

    Year :   <year field here>

    PO Box : <pob field here>

    City :      <city field here>

    Country : <country field here>

     

    The easiest way to do this is to use an expression with an IIF() for two or more of the lines, rather than having them all separate.  In your case, I gather than only one item in the list can be empty, and you have 6 items all together.  You can put PO Box together with either the one before or the one after, so that you now have 5 items. (I'll use the one after in my example.)  You make the "special" item that contains two lines double height. Here is what the expression for the two fields, on the right side above, might look like:

     

    IIF(LEN(TRIM(Fields!POB.Value)) > 0, Fields!POB.Value & vbCRLF,"") & Fields!City.Value

     

    Notice that the IIF includes a vbCRLF if POV has a value, so that there is a line break.  Of course, for your labels on the left side, you can do something similar:

     

    IIF(LEN(TRIM(Fields!POB.Value)) > 0, "POB Box:" & vbCRLF,"") & "City: "

     

    1b)  If you are using a table, things might be a bit easier than this!  Consider this possible table layout:

    • two columns, with the left column holding your labels and the right column holding your fields
    • no table header or footer
    • 6 detail lines

    A full detail row can have visibility set -- and when the detail line isn't visible, the space closes up just the way you want it to.  So now you can select the POBox row and give it the following Visibility value:

     

    LEN(TRIM(Fields!POB.Value)) = 0

     

    ... and you get exactly what you want, with no IIFs or trickery.

     

    2.  Your second question  is really a simple grouping problem.  You can use a table that groups on the individual (or Name?) value.  The table has two header lines for Name and Age and then it probably has a three detail lines, one with Image, one with the link and one with the link description (assuming you want those items to be on separate lines).

     

    Even though there is only one instance of each detail ine in the table, these details  will repeat until the next individual is encountered. Make sure your data is properly sorted or sort it yourself (you'll find a sorting tab in the Table Properties dialog) so that the grouping works the way you expect it to.  To understand this better, because it is a very general point, I think maybe you should read the documentation a bit on report data regions, and maybe let the Report Wizard generate some reports from data for you and examine the results.  You need to be able to envision how data is going to repeat in a data region before going forward and evaluating Reporting Services, or working on the design of *any* report.

     

    Note: for your specific situation, with the images and links, I said "probably" you have three detail lines because it isn't clear to me what your dataset looks like.  Are the images related to the links in some way, or are they not?  It is important  to know before giving you an exact answer.

     

    If it turns out that this is a classic "multiple child relations" situation, there is actually often a way to handle this  in a single table -- although you will have people here tell you to use subreports.  But a lot depends on how your data is organized, so please explain further.

     

    >L<

    Monday, June 25, 2007 5:05 AM
  • Hi Harsimrat:

     

    The following aspects of your scenario are probably not relevant to your two main questions but I want to give you some comments here:

     

    >>certainly pictures are not stored there

     

    The only important thing about this is that the pictures have to be available to your report.  If they are external, the report needs to have access to them.  I believe you said you are running in local mode, which is fine, but you still need to tell the LocalReport member of the ReportViewer control to EnableExternalImages.

     

    You also have to fashion an identifier for each image in a way that the reportviewer can use.  I don't know how you store the paths to the images in your database column, but you will probably have to build a suitable expression starting with whatever there is there. Both http:// and file:// references will work.  (In the http:// case if the site requires additional authentication it probably won't, in the file:// case you really do need an absolute full path as far as I can tell, maybe relative path references work but I haven't been able to get it to work reliably.)

     

    >>The data I get I bind it to Strongly typed DataSet

     

    The important thing will be how you structure that dataset, not how it's typed <s>.

     

    Now to your questions and the relevant bit.

     

    >>

    1) If I have more than one link, how can I repeat it ? How to design that part ?

    2) If I more than one image, how can I show multiples with only one image control ? How to achieve that.....

    <<

     

    Honestly, this is *not* a problem.  Have you done as I suggested earlier?

     

    Even though there is only one instance of each detail line in the table, these details  will repeat until the next individual is encountered. Make sure your data is properly sorted or sort it yourself (you'll find a sorting tab in the Table Properties dialog) so that the grouping works the way you expect it to.  To understand this better, because it is a very general point, I think maybe you should read the documentation a bit on report data regions, and maybe let the Report Wizard generate some reports from data for you and examine the results.  You need to be able to envision how data is going to repeat in a data region before going forward and evaluating Reporting Services, or working on the design of *any* report.

     

     

    An image control can be in a detail line, just like a textbox.  The expression for the source of that control will be built from whatever you're storing in the database relevant to each image, and will change on each invocation, just like the textbox's runtime results do.

     

    To get each one repeated for many times for each individual, you just group on the individual.

     

    Look: Your dataset comes from a stored procedure, or a SELECT statement, or something.  Even though the data comes from multiple tables, you can "flatten" it out when you create this structure, for the purposes of reporting.

     

    Here's the relevant bit:

     

    >>

    In my scenario an entity has many-to-many relationship with images/links.

     

    I would like to see you do this, in the normal way, successfully, with one child file first, so that I am sure you understand how reports work before addressing your many-to-many requirement. 

     

    I don't know what your dataset looks like now.  But try creating one that looks something like this:

     

    SELECT <individual fields list>, links.linkfield FROM individual JOIN ON individual.ID = links.IndividualID

     

    ... this will give you many records for each individual.  Create a report that groups on individual and has your links in the details of a table.  You will see how this works.

     

    Then it is time to address your second child file (images, in my example here).  You can actually do this in one table.  The standard answer from Reporting Services people will be to use a subreport, though <s>. Let's get you handling a simpler report first and then we can discuss.

     

    >L<

     

     

     

    Thursday, June 28, 2007 3:09 PM
  • Well, I am sorry that I am not explaining something right, Harsimrat.

     

    I will try again. 

     

    First, have you set the dataset of the table to be whatever dataset is attached to this report?  Just in case.

     

    Second, have you tried creating a report from scratch, using the Wizard, with this data source, and using a Table format, as I suggested?

     

    Third, can you confirm what the rows in your data set look like if you preview them (or however you choose to visualize them)?

     

    I had recommended that you create the dataset with *one* set of child records first (either links or images, I don't care which). 

     

    If you have done that, your dataset should look  something like this (I will leave some fields out for simplicity).  IOW, you should have a "flattened" data set with your Person fields repeated multiple times, one time for each link child record associated with that person-parent record. 

     

     In this table I have highlighted the unique values for each person -- where there is no highlight, those records have repeated parent values:

     

     

    Person POB Link
    Individual 1 POB for Individual 1 Link1 for Individual 1
    Individual 1 POB for Individual 1 Link2 for Individual 1
    Individual 1 POB for Individual 1 Link3 for Individual 1
    Individual 2 POB for Individual 2 Link1 for Individual 2
    Individual 2 POB for Individual 2 Link2 for Individual 2
    Individual 3 POB for Individual 3 Link1 for Individual 3
    Individual 3 POB for Individual 3 Link2 for Individual 3
    Individual 3 POB for Individual 3 Link3 for Individual 3
    Individual 3 POB for Individual 3 Link4 for Individual 3

     

     

    Now, the way I have it structured above, you can actually set it up in the table if you want; I think there is an option to " hide duplicates" that would take care of the non-highlighted entries. 

     

    To achieve this effect, the dataset must be sorted by Person/Individual, which you can take care of at the Table level if you haven't got it that way already.

     

    The layout above is not what I had suggested you do, and probably not the best layout for you.  I just want you to realize that this type of layout is available to you and will help you see what is "in the data".

     

    What I suggested was that you *create a group* in the table and group on individual.  Now your group rows (however many you add) include the data for the parent table -- in this case Person and POB -- in whatever arrangement you want.  Your detail rows contain only the repeating child records, in this case Link.

     

    When you have gotten something like this working, we will talk about your second child set.  OK?

     

    >L<

     

    Saturday, June 30, 2007 8:47 PM

All replies

  • Which is the part that you need advice on?

     

    Attaching an XSLT template to the Report Properties that will work for your requirements?

     

    Making the XSLT template dynamic, perhaps swapping it in at runtime or parameterizing it?

     

    Writing an appropriate XSLT template for your requirements, given the structure of the XML data output?

     

    BTW: I don't think this is going to work with a localreport -- serverreport is required to render to XML...

     

    IAC what are the parts of your "different formats" that needs to be dynamic? (Maybe you don't even really need to export to XML, although you haven't found the "required functionality" so far... )

     

    >L<

     

     

     

    Sunday, June 24, 2007 2:58 PM
  • Can you please provide an sample code the best way you think ?
    Sunday, June 24, 2007 4:14 PM
  • no actually I can't.  That is why I asked you for more details <s>.

     

    If you explain a bit more about what your situation is I can make a recommendation and provide sample code.  With the question the way you asked it, it's impossible to do this properly.

     

    >L<

    Sunday, June 24, 2007 6:12 PM
  • Hello Lisa,

     

    Thanks for helping me. This is my problem with Report Viewer Control :-  I will come to why I want to choose XML as a format. (Running in local mode, Using stronly typed dataset).

     

    I have two big problems which I couldn't ifnd a solution to:

     

    1)

    I have a report that looks something like this :

     

    Name :

    Age :

    Year :

    PO Box :

    City :

    Country :

     

    PO Box can be empty in the database, so if its empty report should render something like this :

     

    Name :

    Age :

    Year:

    City :

    Country :

     

    and when there is PO Box available show it.

     

    I have two problems :

    1) I don't know if there is no data, how to hide.

    2) Once hidden how to remove the extra space or just move little higher.

     

     

    2) In My Report the layout is something like this :

     

    Name :

    Age :

    Image :

    Link :

    Link Description

     

    Here as well two problems :

    1) There can be multiple Images in the database, How can I show all of them without previoulsy knowing how many ? As of now I'm only putting one image control in list box, hoping it will repeat somehow....

     

    2) I can have more than one link and link descriptions as well, I want to show all of them as well...For Example I have three links and descriptions in DB My Report should expand and look something like this

     

    Name :

    Age :

    Image :

    Link : 1

    Link Description : 1s

     

    Link : 2

    Link Description : 2Something

     

    Link : 3

    Link Description : 3 Something

     

    For now I'm only putting two textboxes in List control again hoping it will repeat somehow.

     

    If I can't find any way I was hoping maybe I can use XML and somehow generate the reports at runtime and do something ......and that will help me eliminate these problems...

     

    Really appreciate for helping.

     

    Thanks,

    Harsimrat

     

    Monday, June 25, 2007 2:50 AM
  • Hi Harsimrat,

     

    Thank you for being more explicit.

     

    These problems  that you're talking about really *are* solvable within the standard RDL/RDLC layouts.  So there is no need to resort to XML just for them! If you ever really need to go the XML+XSLT route, I will be happy to talk to you about that <s>. It is one of my favorite topics in the whole world!

     

    For now let's just talk about the layout problems that you want to solve -- which have nothing to do with my favorite topic, as it turns out <g>.

     

    I will want to telll you that your questions really have nothing to do with the ReportViewer, however.  They are *Report Design* problems.  IOW, they would affect you when designing an RDL or RDLC -defined  report even if ReportViewer was not the display mechanism.  OK?

     

    Now to your questions

     

    1)  I am not sure what kind of data region you are using. 

     

    1a) To start with, let's assume that you are using a List as the container for this address, maybe designing labels to be printed, or perhaps no data area at all (for example, this could be the address area of a letter, in the page header).  let's also going to assume that what you put in your message is a text label for each data value, so that the real layout looks something like this:

     

    Name :  <name field here>

    Age :    <age field here>

    Year :   <year field here>

    PO Box : <pob field here>

    City :      <city field here>

    Country : <country field here>

     

    The easiest way to do this is to use an expression with an IIF() for two or more of the lines, rather than having them all separate.  In your case, I gather than only one item in the list can be empty, and you have 6 items all together.  You can put PO Box together with either the one before or the one after, so that you now have 5 items. (I'll use the one after in my example.)  You make the "special" item that contains two lines double height. Here is what the expression for the two fields, on the right side above, might look like:

     

    IIF(LEN(TRIM(Fields!POB.Value)) > 0, Fields!POB.Value & vbCRLF,"") & Fields!City.Value

     

    Notice that the IIF includes a vbCRLF if POV has a value, so that there is a line break.  Of course, for your labels on the left side, you can do something similar:

     

    IIF(LEN(TRIM(Fields!POB.Value)) > 0, "POB Box:" & vbCRLF,"") & "City: "

     

    1b)  If you are using a table, things might be a bit easier than this!  Consider this possible table layout:

    • two columns, with the left column holding your labels and the right column holding your fields
    • no table header or footer
    • 6 detail lines

    A full detail row can have visibility set -- and when the detail line isn't visible, the space closes up just the way you want it to.  So now you can select the POBox row and give it the following Visibility value:

     

    LEN(TRIM(Fields!POB.Value)) = 0

     

    ... and you get exactly what you want, with no IIFs or trickery.

     

    2.  Your second question  is really a simple grouping problem.  You can use a table that groups on the individual (or Name?) value.  The table has two header lines for Name and Age and then it probably has a three detail lines, one with Image, one with the link and one with the link description (assuming you want those items to be on separate lines).

     

    Even though there is only one instance of each detail ine in the table, these details  will repeat until the next individual is encountered. Make sure your data is properly sorted or sort it yourself (you'll find a sorting tab in the Table Properties dialog) so that the grouping works the way you expect it to.  To understand this better, because it is a very general point, I think maybe you should read the documentation a bit on report data regions, and maybe let the Report Wizard generate some reports from data for you and examine the results.  You need to be able to envision how data is going to repeat in a data region before going forward and evaluating Reporting Services, or working on the design of *any* report.

     

    Note: for your specific situation, with the images and links, I said "probably" you have three detail lines because it isn't clear to me what your dataset looks like.  Are the images related to the links in some way, or are they not?  It is important  to know before giving you an exact answer.

     

    If it turns out that this is a classic "multiple child relations" situation, there is actually often a way to handle this  in a single table -- although you will have people here tell you to use subreports.  But a lot depends on how your data is organized, so please explain further.

     

    >L<

    Monday, June 25, 2007 5:05 AM
  • Hello Lisa,

     

    This is one of the best explanations I have ever got. I really appreciate for you doing this :

     

    Data Organization : What I did was just put a rectangle on the page and start putting textboxes in it and where image was required put a image control and so on. If you have any suggestions how should I organize the data I can easily change it. In my case the reports can be big and I was trying to use table for the matter but it didn't seem that friendly, maybe I will try using it again that way data is more organized.

     

    For Images have no relationship but Link and Link Description are connected, the layout is like rectange, then listbox and then link and link description textboxes in there. I have almost 15 different report formats and where Images and links are main parts of the reports.

     

    If you can also tell me is there any way to adjust everything in a table ?

     

    Once again really appreciate for helping me.

     

    Thanks,

    Harsimrat

    Monday, June 25, 2007 12:57 PM
  • OK, you're welcome -- but I don't have a lot of time to write at the moment.

     

    >>What I did was just put a rectangle on the page and start putting textboxes in i

     

    The first thing you really, really have to do, as I said before, is understand data regions as containers for repeating data elements. Which (I'm pretty sure) a rectangle is not -- it's just a visual element.

     

    As I recommended in my previous message, you can get to know a bit about this by using the report wizard, because it will create a table or a matrix for you and when you see how things repeat in these data regions you will be able to envision a bit more.

     

    >>can also tell me is there any way to adjust everything in a table ?

     

    Yes <s>.  Pretty much everything, anyway.  (I don't want to say "everything" because I really don't know what you have in mind!)

     

    I agree that there are counter-intuitive aspects of report design in the layout window; what you have selected, and what a rightclick will do is not always obvious, for example. And of course what a data region is designed to do -- represent a single image of repeating information, which may be repeating on different levels with aggregated data -- is inherently a difficult thing to represent in a designer.  You will get used to it quickly.

     

    >>I have almost 15 different report formats and where Images and links are main parts of the reports.

     

    The fact that your data elements are images and links is not intrinsicly important to the layout issues that you face.  They are in some sort of relationship with your other elements, that's all that matters.  The thing we need to know to help you figure out how to do this is what exactly that relationship is. 

    Maybe the best thing for you to do is tell us more about your data scheme in the database (or if this is not coming from a database, just tell us more about the data.

     

    >L<

     

     

     

    Monday, June 25, 2007 3:50 PM
  • Hello Lisa,

     

    Sorry for late response. I had to be fully sure what I'm doing before posting here.

     

    Everything is coming from the database and certainly pictures are not stored there, its only the location either on hard drive or somwhere on the web. The data I get I bind it to Strongly typed DataSet and use that in reports.

     

    In my scenario an entity has many-to-many relationship with images/links.

     

    Now what I'm looking at this point :

    1) If I have more than one link, how can I repeat it ? How to design that part ?

    2) If I more than one image, how can I show multiples with only one image control ? How to achieve that.....

     

    Please let me know if you need more information.

     

    Thanks,

    Harsimrat

    Thursday, June 28, 2007 7:04 AM
  • Hi Harsimrat:

     

    The following aspects of your scenario are probably not relevant to your two main questions but I want to give you some comments here:

     

    >>certainly pictures are not stored there

     

    The only important thing about this is that the pictures have to be available to your report.  If they are external, the report needs to have access to them.  I believe you said you are running in local mode, which is fine, but you still need to tell the LocalReport member of the ReportViewer control to EnableExternalImages.

     

    You also have to fashion an identifier for each image in a way that the reportviewer can use.  I don't know how you store the paths to the images in your database column, but you will probably have to build a suitable expression starting with whatever there is there. Both http:// and file:// references will work.  (In the http:// case if the site requires additional authentication it probably won't, in the file:// case you really do need an absolute full path as far as I can tell, maybe relative path references work but I haven't been able to get it to work reliably.)

     

    >>The data I get I bind it to Strongly typed DataSet

     

    The important thing will be how you structure that dataset, not how it's typed <s>.

     

    Now to your questions and the relevant bit.

     

    >>

    1) If I have more than one link, how can I repeat it ? How to design that part ?

    2) If I more than one image, how can I show multiples with only one image control ? How to achieve that.....

    <<

     

    Honestly, this is *not* a problem.  Have you done as I suggested earlier?

     

    Even though there is only one instance of each detail line in the table, these details  will repeat until the next individual is encountered. Make sure your data is properly sorted or sort it yourself (you'll find a sorting tab in the Table Properties dialog) so that the grouping works the way you expect it to.  To understand this better, because it is a very general point, I think maybe you should read the documentation a bit on report data regions, and maybe let the Report Wizard generate some reports from data for you and examine the results.  You need to be able to envision how data is going to repeat in a data region before going forward and evaluating Reporting Services, or working on the design of *any* report.

     

     

    An image control can be in a detail line, just like a textbox.  The expression for the source of that control will be built from whatever you're storing in the database relevant to each image, and will change on each invocation, just like the textbox's runtime results do.

     

    To get each one repeated for many times for each individual, you just group on the individual.

     

    Look: Your dataset comes from a stored procedure, or a SELECT statement, or something.  Even though the data comes from multiple tables, you can "flatten" it out when you create this structure, for the purposes of reporting.

     

    Here's the relevant bit:

     

    >>

    In my scenario an entity has many-to-many relationship with images/links.

     

    I would like to see you do this, in the normal way, successfully, with one child file first, so that I am sure you understand how reports work before addressing your many-to-many requirement. 

     

    I don't know what your dataset looks like now.  But try creating one that looks something like this:

     

    SELECT <individual fields list>, links.linkfield FROM individual JOIN ON individual.ID = links.IndividualID

     

    ... this will give you many records for each individual.  Create a report that groups on individual and has your links in the details of a table.  You will see how this works.

     

    Then it is time to address your second child file (images, in my example here).  You can actually do this in one table.  The standard answer from Reporting Services people will be to use a subreport, though <s>. Let's get you handling a simpler report first and then we can discuss.

     

    >L<

     

     

     

    Thursday, June 28, 2007 3:09 PM
  • Hello Lisa,

     

    Thanks for helping me.

     

    I'm facing couple things : I read over the data regions and as you suggested moved everything in the table form. This is how I have created the table :

     

    1) Dragged and dropped the table to the layout form and then removed table header and footer and added rows in the details field.

     

    Now my table looks something like this :

    Column1       Column2

    Name         Harsimrat Thukral

    City             Something

    Country       Something

     

    Now when I run  the report the table doesn't show at all. If I add row header and put something there then only that starts showing up, rest of the table still don't.

    If I put a textbox on somewhere else on the report it shows up too, but not this particular table.

     

    What is possible wrong, that it is not displaying the text ?

     

    2) How to store the multiple links and images in the typed dataset that it can be shown. I mean by this say I have something like this :

    IList<Link> link = List<Link>();

    and all the links get stored there one by one. Now how should I use that to show all the links.

     

    Sorry for asking the repeated questions, this is giving me lot of grief.

     

    Thanks,

    Harsimrat

    Saturday, June 30, 2007 7:28 PM
  • Well, I am sorry that I am not explaining something right, Harsimrat.

     

    I will try again. 

     

    First, have you set the dataset of the table to be whatever dataset is attached to this report?  Just in case.

     

    Second, have you tried creating a report from scratch, using the Wizard, with this data source, and using a Table format, as I suggested?

     

    Third, can you confirm what the rows in your data set look like if you preview them (or however you choose to visualize them)?

     

    I had recommended that you create the dataset with *one* set of child records first (either links or images, I don't care which). 

     

    If you have done that, your dataset should look  something like this (I will leave some fields out for simplicity).  IOW, you should have a "flattened" data set with your Person fields repeated multiple times, one time for each link child record associated with that person-parent record. 

     

     In this table I have highlighted the unique values for each person -- where there is no highlight, those records have repeated parent values:

     

     

    Person POB Link
    Individual 1 POB for Individual 1 Link1 for Individual 1
    Individual 1 POB for Individual 1 Link2 for Individual 1
    Individual 1 POB for Individual 1 Link3 for Individual 1
    Individual 2 POB for Individual 2 Link1 for Individual 2
    Individual 2 POB for Individual 2 Link2 for Individual 2
    Individual 3 POB for Individual 3 Link1 for Individual 3
    Individual 3 POB for Individual 3 Link2 for Individual 3
    Individual 3 POB for Individual 3 Link3 for Individual 3
    Individual 3 POB for Individual 3 Link4 for Individual 3

     

     

    Now, the way I have it structured above, you can actually set it up in the table if you want; I think there is an option to " hide duplicates" that would take care of the non-highlighted entries. 

     

    To achieve this effect, the dataset must be sorted by Person/Individual, which you can take care of at the Table level if you haven't got it that way already.

     

    The layout above is not what I had suggested you do, and probably not the best layout for you.  I just want you to realize that this type of layout is available to you and will help you see what is "in the data".

     

    What I suggested was that you *create a group* in the table and group on individual.  Now your group rows (however many you add) include the data for the parent table -- in this case Person and POB -- in whatever arrangement you want.  Your detail rows contain only the repeating child records, in this case Link.

     

    When you have gotten something like this working, we will talk about your second child set.  OK?

     

    >L<

     

    Saturday, June 30, 2007 8:47 PM
  • Hello Lisa,

     

    The problem is with the data I store and how I store it ?

    For Example I have 4 classes :

     

    Code Snippet

    public class LinksAndImages

    {

    private readonly IList<Images> images = new List<Images>();

     

    public ICollection<Images> Images

    {

    get

    {

    return (this.images as List<Images>).AsReadOnly();

    }

    }

    }

    // The above has links as well, for keep it simple I'm taking it out

     

    Code Snippet

    public class Images

    {

         private string filename;

         private string desc;

     

    get and set methods for both of the above...

    }

     

    Code Snippet

    public class UserInfo : LinksAndImages

    {

        //Store User Info and so on.....

    }

     

    In my other code I have added these classes as a datasource and use them to display the data.

     

    Now For Example my .rdlc looks something like this and its in the table form with two columns and only details :

     

    Name : <UserInfo Class>

    Age : <UserInfo class>

    Image Description : <Image Class>

    Image : <Image Class>

     

    Now I populate the UserInfo and Image DataSets seperately. What happens is with User 1, if two pictures were attached..it doesn't know that....so the output is something like this :

     

    //Output I'm getting

     

    Name : User1

    Age : 20

    Image Description : Good Picture

    Image : Actual Picture

     

    Name : User

     Age : 30

    Image Description : Second Picture

    Image : Actual Pic

     

    // The output should be

    Name : User 1

    Age : 20

    Image Description : Good Picture

    Image : Actual Image

    Image Description : Second Picture

    Image : Actual Picture

     

    Name : User2

    Age :30

     

    //Now what is happening above is somehow I can add the pictures collection to UserInfo directly as it is readonly and when I do it seperate it doesn't know it belongs to one user or not.....

     

    I guess this is the first part where there are problems....

     

    Thanks,

    Harsimrat

     

     

     

     

    Sunday, July 1, 2007 4:12 PM
  • I understand that your objects are different entities, Harsimrat.  I really do.

     

    If they were SQL datasources rather than objects, they would still almost certainly be different entities in the database. 

     

    I have been trying to explain, that for the purposes of putting things in the same table, it is usually best to "flatten" the heirarchy and build a virtual entity that combines the details with each parent.

     

    As I said to you earlier,

     

    >>

    >>The data I get I bind it to Strongly typed DataSet

     

    The important thing will be how you structure that dataset, not how it's typed <s>.

    <<

     And this is still the important thing.  It is quite common to store data efficiently and relationally in a database, or in objects that elegantly model real-life entities, and yet need to extract the data into different structures for reporting convenience.  This is one reason people build data warehouses and marts, BTW.   Analysis cubes are another example of how data is made available in a different structure than its original structure when it is time to *interpret* the data.

    So the problem is not your data, and it is not "how you store" the data.  It is that "how you store" the data is not necessarily how you should pull it for the purposes of this report. I am more of a SQL (for tabular) and XML (for hierarchical) data person, so explaining how you build the correct virtual object entity for what I tried to illustrate in my last message in this thread is not easy for me to do.  But it should be possible. 

     

    >L<

     

    Monday, July 2, 2007 5:35 AM
  • Now I'm stuck in a new problem and I guess the last one for this thread.

     

    What you have mentioned before Hide Duplicates, that work but to be sure of the output I want to club the ID's which are avilable in both datasets.

     

    I want to say something like :

    SELECT * FROM BOTH DATASETS

    WHERE ID FROM 1ST = ID FROM 2nd.......

     

    Below are the details : 

     

    I have two dataSets, For Example Say Person and Images :

     

    Person has details like Name and so, and Images contains the images related with that person and both of them share the same ID.

     

    Person DataSet :

    int ID

    string FirstName :

    string LastName:

     

    Images DataSet

    int ID

    string imageDesc:

    string imageFileName:

     

     

    Now what is happening is when I show the data, Something like this :

     

    First Name : Harsimrat  

    Last Name : Thukral

    Image Desc : Fight.jpg

    Image : Actual Image

     

    Now if there are two images , then everything repeats :

     

    First Name : Harsimrat

    Last Name : Thukral

    Image Desc : Mountain.jpg

    Image : Actual Image

     

    How can I club the both datasets based on the ID (or somehow group them), I was looking for expression to do it where I can get something along these lines :

     

    First Name : Harsimrat

    Last Name : Thukral

    Image Desc : Fight.jpg

    Image : Actual Image

    Image Desc : Mountain.jgg

    Image : Actual Image

     

    Thanks for your patience and help.

     

    Harsimrat

     

    Tuesday, July 3, 2007 2:48 AM
  • Now we're getting somewhere!

     

    yes, this is what you needed to do:

     

    >>

    SELECT * FROM BOTH DATASETS

    WHERE ID FROM 1ST = ID FROM 2nd.......

    <<

     

     

    >>Now if there are two images , then everything repeats :

     

    This is what grouping in a table is for!

     

    As I tried to explain earlier (but your data wasn't in the right shape) you need to do the following:

     

    • Sort your data by ID (either in the SQL as an ORDER BY or in the table instructions)
    • Put your "parent" items in group rows rather than detail rows.

    As I told you, you can use "hide duplicates" to get a different arrangement of the data, but I am pretty sure that in your list-oriented arrangement of the data you should use a group here instead.    This should give you your "parent" (person) details once and its images underneath as details, which is what you want.

     

    >L<

    Tuesday, July 3, 2007 3:34 PM
  • When you say Sort your Data by ID, I should do this sorting where, after I have the datastored in datasets ? as the data I get I have no control over it..That was the reason I created two datasets with the same ID's in there.

     

    Can you please explain me the steps, where to write this query (I'm using local mode) .rdlc.....?

     

    Secondly where is this option (Put your "parent" items in group rows rather than detail rows.)..

     

    Yes, I have tried using Hide Duplicates and they leave the space ....even if I use the hide property...

     

    Sorry for asking too much...

     

    Thanks a ton...

    Tuesday, July 3, 2007 4:39 PM
  • (I will do my best to explain this, but if it isn't clear, you really need to take a look at the docs, okay?  Because I'm sure this is in there.)

     

    Why you got empty spaces with Hide Duplications: there are a couple of different reasons, most likely because you needed to mark the items CanShrink = True, but never mind because as I said it's probably not the right solution for your data and layout anyway!

     

    Sorting the contents of the table:

    • Make sure you have the properties window visible.
    • Select the table in your report layout.  You will know when you have the table selected, rather than one of its contained columns or other layout controls, because the selection marquee is "around" the outside, and also in the properties window you should see the name of the table at the top.  If you see something else, try rightclicking and there may be an option in the context menu to allow you to select one of the parent containers of whatever you have really selected.  In any case, you want to SELECT THE TABLE <g>.
    • When the table is selected you should be able to click on the selection marquee around its edges, rightclick and choose Properties from the context menu.  This does *not* shift focus to the "regular" properties window you already have visible.  It brings up a modal dialog specialized to a data region (in this case, a Table).
    • You should see a Sorting tab in that dialog.  You can sort there.

    Adding grouping to the table: You should also see a Grouping table in that modal dialog, which you will need to use.   You can also add groups and group header/footer lines by doing something like this:

     

    • Click on some object in the table
    • Look at the LEFT MARGIN area of the table, where you probably see a grey column with a symbol (some horizontal lines) that mean you're in a detail row.
    • Rightclick on this left margin area. It will turn darker grey and you will see a different context menu (I *could not* make this up).
    • You should see an option to Insert Group on that context menu.

    Try that, okay?

     

    >L<

    Tuesday, July 3, 2007 7:59 PM
  • Sorry for asking stupid questions. Actually I should have been more clear, I can find the grouping and sorting that wasn't a problem. The expression or some kind of SQL statement was my point.

     

    So this is what I do. Add a group ->then go to Details Grouping->the from Person table add the ID expression that is fine......But I need to relate images with it too...So I add Images something like this the expression =Sum(Fields!ID.Value, "Datasets_Images")...Then I get this error...

     

     A group expression for the table 'table1' includes an aggregate function.  Aggregate functions cannot be used in group expressions. 

     

    My actual questions is what expression I should write to do what I'm looking for as seriously I searched everywhere and I don't find it.

     

    The expression for hiding the cells and rows is extremely useful. As I don't find in documentation anywhere what exactly the expressions are.

     

     

    Thanks,

    Harsimrat

     

    Wednesday, July 4, 2007 4:54 PM
  • You don't need to use an aggregate function in there... All you need to do is group on the Person ID.  All the rows for the same person will have that ID. 

     

    Please refer back to the message I wrote earlier in this thread, where there is a table of your data.  Notice how the Person information is repeated against multiple image rows.  This is what the dataset for the table is supposed to look like.  Does it look like that in your dataset?

     

    Assuming it does, and I am assuming that because you wrote a SELECT statement that should come out something like that, and assuming your dataset is sorted on Person ID, then a group on Person ID should have the correct effect.  Here is what the data looks like again:

     

    Person POB Link
    Individual 1 POB for Individual 1 Link1 for Individual 1
    Individual 1 POB for Individual 1 Link2 for Individual 1
    Individual 1 POB for Individual 1 Link3 for Individual 1
    Individual 2 POB for Individual 2 Link1 for Individual 2
    Individual 2 POB for Individual 2 Link2 for Individual 2
    Individual 3 POB for Individual 3 Link1 for Individual 3
    Individual 3 POB for Individual 3 Link2 for Individual 3
    Individual 3 POB for Individual 3 Link3 for Individual 3
    Individual 3 POB for Individual 3 Link4 for Individual 3

     

    In your layout table, you   group on Person ID.  You put group header lines in with Person information (such as the individual names and POBs that I show in this example) in the layout table.  You put detail lines in the layout table for information that is *not* repeated: the child links.

     

    In the resulting output, because of this group expression, you will get group information once each for the three people in this sample.  There will be multiple detail lines in each group, representing one line for each child link for that person. In the sample above, you will get three detail lines for Individual 1,  2 for Individual 2, and 4 for Individual 3.  Each set of detail lines (not each detail line) will be preceded by its header data for each individual.

     

    >>

    The expression for hiding the cells and rows is extremely useful. As I don't find in documentation anywhere what exactly the expressions are.

    <<

     

    The documentation doesn't tell you what exactly the expressions are because it doesn't know what you want to do <s>.  I agree that the examples in the docs could be more useful, you still have to understand your own data and apply that understanding to create your own expressions.  I will try to help but I am not sure what you are asking here.

     

    >L<

     

     

     

    Wednesday, July 4, 2007 7:05 PM