Nested Datalists

S

Sparky Arbuckle

The application I'm creating consists of a DataGrid with 3 (at this
point in time) DataLists nested inside of it. One of the columns is for
the the latest version of the product and the other is for revisions to
that produce version. So the database table would look something like
this for any given item with revisions:

ItemNumber - Revision

A - 1
A - 2
B - 1
B - 2
B - 3
C - 1
D - 1
D - 2
D - 3
D - 4
etc - etc..

What I'm trying to figure out is if it is possible to have one column
with the Item Number (i.e. A) and the column next to it each Revision
of the Item (i.e. B1, B2, B3). I know it would probably be easiest to
create a function that gets the max Revision number and loop through it
to create a string.

<asp:DataList id="dl1" DataSource=<%#
GetItemInfo(Container.DataItem("ItemID")) %> Runat="server">
<HeaderTemplate>TEST</HeaderTemplate>
<ItemTemplate>
<%# Container.DataItem("ItemName") %>
</ItemTemplate>
</asp:DataList>

This creates each a column that lists all Distinct Items:

A
B
C
D

How would I go about creating a column next to this one that writes A1,
A2, etc.. so that it looks like:

A - A1,A2
B - B1,B2,B3
C - C1
D - D1,D2,D3,D4

Any suggestions? If you are confused and need more information please
ask and I will provide.
 
T

tom pester

Hi,

Do a "select distinct(itemnumber") from revisions" and make it the datasource
of the outer data control.

Define a relation between this result and the revison table on the Itembumber
column

Nest the inner data control after reading this article :
http://www.openmymind.net/index.aspx?documentId=8

Let me know if you have any more questions...

Cheers,
Tom Pester
 
S

Sparky Arbuckle

Thanks alot Tom. I am understanding the logic of that tutorial but the
only problem is that my page isn't in C# (I am currently learning
though =] ). What I have so far is:

strSQL = "SELECT Max(Sheet.DCN) AS MaxOfDCN, Max(ADCN.ADCN) AS
MaxOfADCN, " & _
"Sheet.SheetNumber FROM Drawings INNER JOIN (ADCN INNER JOIN "
& _
"Sheet ON ADCN.RecordID = Sheet.RecordID) ON " & _
"Drawings.Drawing = Sheet.Drawing WHERE " & _
"(Sheet.Drawing = '" & x & "') AND " & _
"(Sheet.SheetType = 'CD') GROUP BY " & _
"Sheet.Drawing, Sheet.SheetType, Sheet.SheetNumber;"

This SQL statement returns all the information that I need (Drawing #,
SheetType, Version(DCN), Revisions(ADCN), and SheetNumber). The DCN
(MaxOfDCN) is the most current version of that item and ADCN
(MaxOfADCN) is an integer that represents the number of revisions to
that current version of the item. I have utilized a function including
this SQL string as the DataSource for one of my datalists. The output
looks like:

COLUMN 1 - COLUMN 2 - COLUMN 3
Drawing #(string) - Most Current Item Version(string) - Number(n)

The function returns a dataset and the values from above are populated
in the datalist. What I'm wondering is if I could add a column to this
dataset and programmatically alter the output.

ds.Tables("DataTable").Columns.Add("NewColumn") = strNewString

So let's say that COLUMN 2 = C and COLUMN 3 = 7, I would like to build
a string that looks like: C1,C2,C3,C4,C5,C6,C7

Can anyone get me started as to how to best (most efficiently) go about
doing this?

Much thanks.
 
T

tom pester

You are asking for a specific solution and do it in not the best english
(its not bad though ;)

If you say how your input table(s) look like with significant data in it
and give the desired output (no need for html, just text and indentation)
I'll have a go at it.
Male the sample so that I see what the report is trying to do.


Cheers,
Tom Pester
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top