Showing posts with label fields. Show all posts
Showing posts with label fields. Show all posts

Friday, March 23, 2012

OPEN XML

I have to insert one table by using the concept OPENXML

But i want to insert a table lot of fields i require, in the open XML few fields fields are there , so i want to selet some fields from other table

can u guide me for this scenario to INSERT some fields from one table and some in OPENXML as a single insert statement

Awaiting for Reply PLease

Thanx

Consider using the openXml to create a temporary table first. Then join the two tables as the base for the insert.

Wednesday, March 7, 2012

only show fields that have data in reportviewer

Hi all,

I am using reportviewer control in Visual Web Developer. It uses a report (Report.rdlc with a table) to show all the fields. I am using a stored procedure to populate the dataset. How can I set the reportviewer or the table to increase or decrease the number of columns it shows depending on the names and number of fields pulled from the database. The user has an option of choosing the fields she/he wants on the report but right now all the coulmns show (even those which I am not selecting from the database, i.e. columns with no data).

Please help,

Thanks,

bullpit

have a look at thishttp://en.wikipedia.org/wiki/Double_posting|||

I got your point. Actually I was not sure which forum I should submit this post. I found two forums which looked related to my problem so I posted in both of them. But now I know this should not be done, would you please let me know how to delete one.

Thanks

Only show field on last page

Hallo,
i would like to show some fields only on the last page on the report. How can i achieve this?
(The field is in the body area)

King regards,
Christian NiehavesYou can exactly control the report pagination if this is what you after but if the fields are at the end of the report body (below the main report region) they will show last on the report.|||Hallo,
is there any possiblity to get the current page number and the total number of pages in the body area of a report?

King regards
Christian Niehaves|||The only way I know of is to pass the page number to a code-behind variable in the page footer and read it in the report body.|||

I have only rdl file, how to pass the page number to a code-behind variable ? I think i can't to do that via xml.

|||The idea was to create a VB.NET variable in the report properties Code tab. Since PageNumber and TotalPages are available only in the page header/footer, use one of the exression-based properties of the Page Header band to set the variable and then read it from the Textbox in the body section, e.g. =Code._PageNumber (assuming that _PageNumber is the variable).|||

I'm understood it, but i have the report server project generated by wizard, and seems to me that i don't have VB or C# codebehind, only rdl file with xml syntax. How i can place current page number into the body of report?

Sorry for my English.

Thank you.

|||

I attempted to add expressions =ReportItems!TextboxInHeader.Value for field in the body and i've got compiling error:

Error 1 [rsReportItemReference] The Value expression for the textbox ‘textboxInBody’ refers to the report item ‘TextboxInHeader’. Report item expressions can only refer to other report items within the same grouping scope or a containing grouping scope.

|||You cannot cross-reference items in different bands. Actually, I appologize for giving a wrong page number hack. Pseudo-events like these (setting a var in one band and reading it in another) were working (but were not supported) in RS 2000. In RS 2005, the expression execution order was changed. The net effect is that when reading the variable in the body section, you won't be able to "see" the changes made by the bands. This effectively means that there is no way that I know of to pass a page number to the body section.|||Thank you.

Only show field on last page

Hallo,
i would like to show some fields only on the last page on the report. How can i achieve this?
(The field is in the body area)

King regards,
Christian NiehavesYou can exactly control the report pagination if this is what you after but if the fields are at the end of the report body (below the main report region) they will show last on the report.|||Hallo,
is there any possiblity to get the current page number and the total number of pages in the body area of a report?

King regards
Christian Niehaves|||The only way I know of is to pass the page number to a code-behind variable in the page footer and read it in the report body.|||

I have only rdl file, how to pass the page number to a code-behind variable ? I think i can't to do that via xml.

|||The idea was to create a VB.NET variable in the report properties Code tab. Since PageNumber and TotalPages are available only in the page header/footer, use one of the exression-based properties of the Page Header band to set the variable and then read it from the Textbox in the body section, e.g. =Code._PageNumber (assuming that _PageNumber is the variable).|||

I'm understood it, but i have the report server project generated by wizard, and seems to me that i don't have VB or C# codebehind, only rdl file with xml syntax. How i can place current page number into the body of report?

Sorry for my English.

Thank you.

|||

I attempted to add expressions =ReportItems!TextboxInHeader.Value for field in the body and i've got compiling error:

Error 1 [rsReportItemReference] The Value expression for the textbox ‘textboxInBody’ refers to the report item ‘TextboxInHeader’. Report item expressions can only refer to other report items within the same grouping scope or a containing grouping scope.

|||You cannot cross-reference items in different bands. Actually, I appologize for giving a wrong page number hack. Pseudo-events like these (setting a var in one band and reading it in another) were working (but were not supported) in RS 2000. In RS 2005, the expression execution order was changed. The net effect is that when reading the variable in the body section, you won't be able to "see" the changes made by the bands. This effectively means that there is no way that I know of to pass a page number to the body section.|||Thank you.

Only seeing data from last row in dataset

I have a master detail report that I'm having trouble
with, I have the report layed out and populating fields in
the master report with data, my report uses fields from the
master report and passes it as parameters to the subreport, that's all
working well, the problem is I only get data for the last
record in the master dataset... It's not displaying a new
page for each records in the master dataset... None of my
fields use the First function... My grouping in my query
is setup correctly, is there any other place to setup
grouping in the report designer...? What am I doing
wrong...? In the wizard it asks me how I would like to scope my fields
either Page, Group or Details, where can I access this functionality outside
the wizard, I created all of my reports without the wizard...I am not sure but it sounds like you need to put either a table or rectangle
onto the report that you can tie back to you dataset. If you just create a
report and put textboxes on the blank page you will only get the last row of
data.
"Alien2_51" wrote:
> I have a master detail report that I'm having trouble
> with, I have the report layed out and populating fields in
> the master report with data, my report uses fields from the
> master report and passes it as parameters to the subreport, that's all
> working well, the problem is I only get data for the last
> record in the master dataset... It's not displaying a new
> page for each records in the master dataset... None of my
> fields use the First function... My grouping in my query
> is setup correctly, is there any other place to setup
> grouping in the report designer...? What am I doing
> wrong...? In the wizard it asks me how I would like to scope my fields
> either Page, Group or Details, where can I access this functionality outside
> the wizard, I created all of my reports without the wizard...
>|||Hi John,
I'm pretty confident we're on to something here, I'm certain I'm just using
a report with text boxes on it, which is most definately why I'm seeing only
the last row of data. I put my data elements in a rectangle which seemed more
appropriate because I'm displaying header or master data in the "top" report,
so I want a new page for every row in the master dataset. I noticed in the
property pages for the rectangle that there is a drop down list thats labeled
Data region, the description reads: Type or select the data region with which
to repeat the rectangle on every page that the data region appears. My
question is this; Could you define the term "Data region" and how do I create
one in the designer. I typed in the field from the dataset but got an error.
In your post you had mentioned that I can tie it back to the dataset, what
did you mean by that...?
Thanks for your help!!!
Dan
"johnE" wrote:
> I am not sure but it sounds like you need to put either a table or rectangle
> onto the report that you can tie back to you dataset. If you just create a
> report and put textboxes on the blank page you will only get the last row of
> data.
> "Alien2_51" wrote:
> > I have a master detail report that I'm having trouble
> > with, I have the report layed out and populating fields in
> > the master report with data, my report uses fields from the
> > master report and passes it as parameters to the subreport, that's all
> > working well, the problem is I only get data for the last
> > record in the master dataset... It's not displaying a new
> > page for each records in the master dataset... None of my
> > fields use the First function... My grouping in my query
> > is setup correctly, is there any other place to setup
> > grouping in the report designer...? What am I doing
> > wrong...? In the wizard it asks me how I would like to scope my fields
> > either Page, Group or Details, where can I access this functionality outside
> > the wizard, I created all of my reports without the wizard...
> >|||Why do you have two datasets? As far as I know you cannot join two seperate
datasets in a report. I may be wrong. What might be easier is to join the
datsets in your query. When you do that you create a table and create a
group by the changing rows of the master data set. If that won't work then
use a subreport rather than two different datasets. the subreport will bring
in the detail. When you do it this way you put the rectangle on the report
for the master dataset. After you add the rectangle right click on it and
select properties. On the general tab there will be an option to tie it to a
data set. Then inside the main rectangle you add another one and add the
subreport to that. Let me know which way you decide to go and I can help you
with this.
"Alien2_51" wrote:
> Hi John,
> I'm pretty confident we're on to something here, I'm certain I'm just using
> a report with text boxes on it, which is most definately why I'm seeing only
> the last row of data. I put my data elements in a rectangle which seemed more
> appropriate because I'm displaying header or master data in the "top" report,
> so I want a new page for every row in the master dataset. I noticed in the
> property pages for the rectangle that there is a drop down list thats labeled
> Data region, the description reads: Type or select the data region with which
> to repeat the rectangle on every page that the data region appears. My
> question is this; Could you define the term "Data region" and how do I create
> one in the designer. I typed in the field from the dataset but got an error.
> In your post you had mentioned that I can tie it back to the dataset, what
> did you mean by that...?
> Thanks for your help!!!
> Dan
> "johnE" wrote:
> > I am not sure but it sounds like you need to put either a table or rectangle
> > onto the report that you can tie back to you dataset. If you just create a
> > report and put textboxes on the blank page you will only get the last row of
> > data.
> >
> > "Alien2_51" wrote:
> >
> > > I have a master detail report that I'm having trouble
> > > with, I have the report layed out and populating fields in
> > > the master report with data, my report uses fields from the
> > > master report and passes it as parameters to the subreport, that's all
> > > working well, the problem is I only get data for the last
> > > record in the master dataset... It's not displaying a new
> > > page for each records in the master dataset... None of my
> > > fields use the First function... My grouping in my query
> > > is setup correctly, is there any other place to setup
> > > grouping in the report designer...? What am I doing
> > > wrong...? In the wizard it asks me how I would like to scope my fields
> > > either Page, Group or Details, where can I access this functionality outside
> > > the wizard, I created all of my reports without the wizard...
> > >|||I don't have two datasets, I'm using a subreport, the subreports parameters
are tied to fields in my master dataset using the parameters collection in
the subreport, I don't see the option in the general tab to "tie it back to
the dataset" Are you talking about the "Data region"...? How do I create one
in the designer...? I typed in the field from the dataset I'm grouping on but
got an error. In your post you had mentioned that I can tie it back to the
dataset, what did you mean by that...?
I appreciate your help...
"johnE" wrote:
> Why do you have two datasets? As far as I know you cannot join two seperate
> datasets in a report. I may be wrong. What might be easier is to join the
> datsets in your query. When you do that you create a table and create a
> group by the changing rows of the master data set. If that won't work then
> use a subreport rather than two different datasets. the subreport will bring
> in the detail. When you do it this way you put the rectangle on the report
> for the master dataset. After you add the rectangle right click on it and
> select properties. On the general tab there will be an option to tie it to a
> data set. Then inside the main rectangle you add another one and add the
> subreport to that. Let me know which way you decide to go and I can help you
> with this.
> "Alien2_51" wrote:
> > Hi John,
> >
> > I'm pretty confident we're on to something here, I'm certain I'm just using
> > a report with text boxes on it, which is most definately why I'm seeing only
> > the last row of data. I put my data elements in a rectangle which seemed more
> > appropriate because I'm displaying header or master data in the "top" report,
> > so I want a new page for every row in the master dataset. I noticed in the
> > property pages for the rectangle that there is a drop down list thats labeled
> > Data region, the description reads: Type or select the data region with which
> > to repeat the rectangle on every page that the data region appears. My
> > question is this; Could you define the term "Data region" and how do I create
> > one in the designer. I typed in the field from the dataset but got an error.
> > In your post you had mentioned that I can tie it back to the dataset, what
> > did you mean by that...?
> >
> > Thanks for your help!!!
> >
> > Dan
> >
> > "johnE" wrote:
> >
> > > I am not sure but it sounds like you need to put either a table or rectangle
> > > onto the report that you can tie back to you dataset. If you just create a
> > > report and put textboxes on the blank page you will only get the last row of
> > > data.
> > >
> > > "Alien2_51" wrote:
> > >
> > > > I have a master detail report that I'm having trouble
> > > > with, I have the report layed out and populating fields in
> > > > the master report with data, my report uses fields from the
> > > > master report and passes it as parameters to the subreport, that's all
> > > > working well, the problem is I only get data for the last
> > > > record in the master dataset... It's not displaying a new
> > > > page for each records in the master dataset... None of my
> > > > fields use the First function... My grouping in my query
> > > > is setup correctly, is there any other place to setup
> > > > grouping in the report designer...? What am I doing
> > > > wrong...? In the wizard it asks me how I would like to scope my fields
> > > > either Page, Group or Details, where can I access this functionality outside
> > > > the wizard, I created all of my reports without the wizard...
> > > >|||click on the rectangle you drew. Go to the properties tab. One of the
properties is dataset name. there should be a drop down list that allows you
to select the dataset. After you select the data set insert the subreport.
Pass the fieild you want to use as a parameter. On the properties tab for
the sub report set the Page break after to True.
"Alien2_51" wrote:
> I don't have two datasets, I'm using a subreport, the subreports parameters
> are tied to fields in my master dataset using the parameters collection in
> the subreport, I don't see the option in the general tab to "tie it back to
> the dataset" Are you talking about the "Data region"...? How do I create one
> in the designer...? I typed in the field from the dataset I'm grouping on but
> got an error. In your post you had mentioned that I can tie it back to the
> dataset, what did you mean by that...?
> I appreciate your help...
>
> "johnE" wrote:
> > Why do you have two datasets? As far as I know you cannot join two seperate
> > datasets in a report. I may be wrong. What might be easier is to join the
> > datsets in your query. When you do that you create a table and create a
> > group by the changing rows of the master data set. If that won't work then
> > use a subreport rather than two different datasets. the subreport will bring
> > in the detail. When you do it this way you put the rectangle on the report
> > for the master dataset. After you add the rectangle right click on it and
> > select properties. On the general tab there will be an option to tie it to a
> > data set. Then inside the main rectangle you add another one and add the
> > subreport to that. Let me know which way you decide to go and I can help you
> > with this.
> >
> > "Alien2_51" wrote:
> >
> > > Hi John,
> > >
> > > I'm pretty confident we're on to something here, I'm certain I'm just using
> > > a report with text boxes on it, which is most definately why I'm seeing only
> > > the last row of data. I put my data elements in a rectangle which seemed more
> > > appropriate because I'm displaying header or master data in the "top" report,
> > > so I want a new page for every row in the master dataset. I noticed in the
> > > property pages for the rectangle that there is a drop down list thats labeled
> > > Data region, the description reads: Type or select the data region with which
> > > to repeat the rectangle on every page that the data region appears. My
> > > question is this; Could you define the term "Data region" and how do I create
> > > one in the designer. I typed in the field from the dataset but got an error.
> > > In your post you had mentioned that I can tie it back to the dataset, what
> > > did you mean by that...?
> > >
> > > Thanks for your help!!!
> > >
> > > Dan
> > >
> > > "johnE" wrote:
> > >
> > > > I am not sure but it sounds like you need to put either a table or rectangle
> > > > onto the report that you can tie back to you dataset. If you just create a
> > > > report and put textboxes on the blank page you will only get the last row of
> > > > data.
> > > >
> > > > "Alien2_51" wrote:
> > > >
> > > > > I have a master detail report that I'm having trouble
> > > > > with, I have the report layed out and populating fields in
> > > > > the master report with data, my report uses fields from the
> > > > > master report and passes it as parameters to the subreport, that's all
> > > > > working well, the problem is I only get data for the last
> > > > > record in the master dataset... It's not displaying a new
> > > > > page for each records in the master dataset... None of my
> > > > > fields use the First function... My grouping in my query
> > > > > is setup correctly, is there any other place to setup
> > > > > grouping in the report designer...? What am I doing
> > > > > wrong...? In the wizard it asks me how I would like to scope my fields
> > > > > either Page, Group or Details, where can I access this functionality outside
> > > > > the wizard, I created all of my reports without the wizard...
> > > > >|||Hi John,
Sorry man, we must be using different versions of the report designer or
something, I'm just not seeing the "dataset name" property you're talking
about... I've looked both on the property tab in the VS IDE and the property
pages accessed from the context menu... If you send me email at
dan.billow@.re.mo.ve.this.monacocoach.com, I'll send you some screen captures
of my property pages, I don't know what else to do.
"johnE" wrote:
> click on the rectangle you drew. Go to the properties tab. One of the
> properties is dataset name. there should be a drop down list that allows you
> to select the dataset. After you select the data set insert the subreport.
> Pass the fieild you want to use as a parameter. On the properties tab for
> the sub report set the Page break after to True.
> "Alien2_51" wrote:
> > I don't have two datasets, I'm using a subreport, the subreports parameters
> > are tied to fields in my master dataset using the parameters collection in
> > the subreport, I don't see the option in the general tab to "tie it back to
> > the dataset" Are you talking about the "Data region"...? How do I create one
> > in the designer...? I typed in the field from the dataset I'm grouping on but
> > got an error. In your post you had mentioned that I can tie it back to the
> > dataset, what did you mean by that...?
> >
> > I appreciate your help...
> >
> >
> > "johnE" wrote:
> >
> > > Why do you have two datasets? As far as I know you cannot join two seperate
> > > datasets in a report. I may be wrong. What might be easier is to join the
> > > datsets in your query. When you do that you create a table and create a
> > > group by the changing rows of the master data set. If that won't work then
> > > use a subreport rather than two different datasets. the subreport will bring
> > > in the detail. When you do it this way you put the rectangle on the report
> > > for the master dataset. After you add the rectangle right click on it and
> > > select properties. On the general tab there will be an option to tie it to a
> > > data set. Then inside the main rectangle you add another one and add the
> > > subreport to that. Let me know which way you decide to go and I can help you
> > > with this.
> > >
> > > "Alien2_51" wrote:
> > >
> > > > Hi John,
> > > >
> > > > I'm pretty confident we're on to something here, I'm certain I'm just using
> > > > a report with text boxes on it, which is most definately why I'm seeing only
> > > > the last row of data. I put my data elements in a rectangle which seemed more
> > > > appropriate because I'm displaying header or master data in the "top" report,
> > > > so I want a new page for every row in the master dataset. I noticed in the
> > > > property pages for the rectangle that there is a drop down list thats labeled
> > > > Data region, the description reads: Type or select the data region with which
> > > > to repeat the rectangle on every page that the data region appears. My
> > > > question is this; Could you define the term "Data region" and how do I create
> > > > one in the designer. I typed in the field from the dataset but got an error.
> > > > In your post you had mentioned that I can tie it back to the dataset, what
> > > > did you mean by that...?
> > > >
> > > > Thanks for your help!!!
> > > >
> > > > Dan
> > > >
> > > > "johnE" wrote:
> > > >
> > > > > I am not sure but it sounds like you need to put either a table or rectangle
> > > > > onto the report that you can tie back to you dataset. If you just create a
> > > > > report and put textboxes on the blank page you will only get the last row of
> > > > > data.
> > > > >
> > > > > "Alien2_51" wrote:
> > > > >
> > > > > > I have a master detail report that I'm having trouble
> > > > > > with, I have the report layed out and populating fields in
> > > > > > the master report with data, my report uses fields from the
> > > > > > master report and passes it as parameters to the subreport, that's all
> > > > > > working well, the problem is I only get data for the last
> > > > > > record in the master dataset... It's not displaying a new
> > > > > > page for each records in the master dataset... None of my
> > > > > > fields use the First function... My grouping in my query
> > > > > > is setup correctly, is there any other place to setup
> > > > > > grouping in the report designer...? What am I doing
> > > > > > wrong...? In the wizard it asks me how I would like to scope my fields
> > > > > > either Page, Group or Details, where can I access this functionality outside
> > > > > > the wizard, I created all of my reports without the wizard...
> > > > > >

Only put a period "." if there is a middle intial.

I am trying to concatenate three fields into one in a View. I have the following data:
Last Name
First Name
Middle Initial (can be null)

I need my resultant field data to look like the following:
"Doe, John P."

I'm having a problem writing SQL that is sensitive to placing the period after the middle initial only if there is a middle initial present. If there isn't a middle initial, I just want the following: "Doe, John".

I have tried the following CASE statement:

CASE WHEN middleInitial IS NOT NULL THEN ' ' + middleInitial + '.' ELSE '' END

However, I get an error indicating that the CASE statement is not supported in the Query Designer.

How can I resolve this problem in a View? Is there a function similar to ISNULL(middleInitial, '') that would allow for the "."?Do you mean that you get an error in Query Analyzer? Or some other tool? CASE statements most assuredly are supported in Query Analyzer.

This code works fine for me:

CASE
WHEN middleinitial IS NOT NULL THEN ' ' + middleinitial + '.'
ELSE ''
END
What is the complete query you're trying to build?

Don|||I found my answer on a different forum. For those who are interested...

If you SET CONCAT_NULL_YIELDS_NULL ON (which I believe is the default value), you can accomplish the task in the following way:

SELECT LastName + ', ' + FirstName + ISNULL(' ' + MiddleInitial + '.', '')
FROM MyTable|||donkeily,

I am sorry, I did not see your post. I must have been posting at about the same time as you.

I was attempting to do use the CASE statement in the Query Designer. I wonder why the CASE statement is supported in the Query Analyzer, but not in the Query Designer? Seems strange to me.|||Hmm. That is bizzare. I didn't know QD didn't support it. Ick!

Don

Saturday, February 25, 2012

only 1 data row shows up in preview - should have 10

I am relatively new to Reporting services. I have a real basic dataset
select * from tbl1
tbl1 contains 10 rows and 6 fields. I have 6 textboxes in the layout view.
I linked each textbox to a field in the dataset. When I go to preview, I
only see one row of the 10 rows and only 1 page. What do I need to do to
show the rest of the rows (on the same page)? Any suggestions appreciated.
Thanks,
RichWell, I found part of my problem. When I right-click on a textbox I select
"expression" which brings up a dialog box with a variety of selections. I
want to select Fields but see a message that the report has not been linked
to a dataset. So I go to the Dataset option and select fields from there.
But each of those fields has the "First" function leading the expression.
So now my question is: how do you link a dataset to the report?
"Rich" wrote:
> I am relatively new to Reporting services. I have a real basic dataset
> select * from tbl1
> tbl1 contains 10 rows and 6 fields. I have 6 textboxes in the layout view.
> I linked each textbox to a field in the dataset. When I go to preview, I
> only see one row of the 10 rows and only 1 page. What do I need to do to
> show the rest of the rows (on the same page)? Any suggestions appreciated.
> Thanks,
> Rich|||I think I figured this out. You have to add a table to the layout from the
Toolbox and that is where select your dataset.
Just posting for posterity
"Rich" wrote:
> Well, I found part of my problem. When I right-click on a textbox I select
> "expression" which brings up a dialog box with a variety of selections. I
> want to select Fields but see a message that the report has not been linked
> to a dataset. So I go to the Dataset option and select fields from there.
> But each of those fields has the "First" function leading the expression.
> So now my question is: how do you link a dataset to the report?
>
> "Rich" wrote:
> > I am relatively new to Reporting services. I have a real basic dataset
> >
> > select * from tbl1
> >
> > tbl1 contains 10 rows and 6 fields. I have 6 textboxes in the layout view.
> > I linked each textbox to a field in the dataset. When I go to preview, I
> > only see one row of the 10 rows and only 1 page. What do I need to do to
> > show the rest of the rows (on the same page)? Any suggestions appreciated.
> >
> > Thanks,
> > Rich