Showing posts with label refer. Show all posts
Showing posts with label refer. Show all posts

Tuesday, March 20, 2012

Referencing Parameters in Report Code

I'm trying to refer to a report parameter in my Code block from the Report
Properties page. But it keeps giving me an error that says, "Reference to a
non-shared member requires an object reference." I'm refering the parameter
as Parameters!pBusiness.Label.
Any ideas about how I can see my parameters within the Code block of the
Report itself?you must pass the values in ie
code.dosomething(Param1!value, Param2.value)
--
Wayne Snyder MCDBA, SQL Server MVP
Mariner, Charlotte, NC
(Please respond only to the newsgroup.)
I support the Professional Association for SQL Server ( PASS) and it's
community of SQL Professionals.
"SteveCole63" <SteveCole63@.discussions.microsoft.com> wrote in message
news:C23B3F0A-A341-47AD-A678-6A6DFD9EE114@.microsoft.com...
> I'm trying to refer to a report parameter in my Code block from the Report
> Properties page. But it keeps giving me an error that says, "Reference to
a
> non-shared member requires an object reference." I'm refering the
parameter
> as Parameters!pBusiness.Label.
> Any ideas about how I can see my parameters within the Code block of the
> Report itself?|||Actually Wayne, you can refer to parameters (I discovered after I posted) as
Report.Parameters!pBusiness.Label.
Thanks for the reply!
"Wayne Snyder" wrote:
> you must pass the values in ie
> code.dosomething(Param1!value, Param2.value)
> --
> Wayne Snyder MCDBA, SQL Server MVP
> Mariner, Charlotte, NC
> (Please respond only to the newsgroup.)
> I support the Professional Association for SQL Server ( PASS) and it's
> community of SQL Professionals.
> "SteveCole63" <SteveCole63@.discussions.microsoft.com> wrote in message
> news:C23B3F0A-A341-47AD-A678-6A6DFD9EE114@.microsoft.com...
> > I'm trying to refer to a report parameter in my Code block from the Report
> > Properties page. But it keeps giving me an error that says, "Reference to
> a
> > non-shared member requires an object reference." I'm refering the
> parameter
> > as Parameters!pBusiness.Label.
> >
> > Any ideas about how I can see my parameters within the Code block of the
> > Report itself?
>
>

Friday, March 9, 2012

Refereing a text box

Hello all,
i have a text box in the page footer region that i want to refer to in the
report body. How do i refer it? When i enter the text box name and value it
says cant find text box.
thanks in advance
IshanI believe it is ReportItem!TextBox.Value. Or it least it works that way
when refering to a text box from the report body to a text box in the
footer.|||Name the text box that you want to reference. Ex: txtAnswer
In your footer text box enter =ReportItems!txtAnswer.value
Hope this helps!
"michaelhilding@.gmail.com" wrote:
> I believe it is ReportItem!TextBox.Value. Or it least it works that way
> when refering to a text box from the report body to a text box in the
> footer.
>

Refer to webform fields in Insert statement

Can someone help with this? Let me know if what I'm trying to do is possible...

Here's code example:

@.ClientID int,

@.QuoteID int,

@.Base real,

@.One real,

@.DwellingLimit real

AS

BEGIN

Insert Into tblOne(ClientID,QuoteID,GuideID,GuideRate,GuideMult,Premium)

Select @.ClientID, @.QuoteID, GuideID,GuideRate, @.+"GuideMult"+,GuideRate*GuideMult

From tblTwo

Where Choose = 'True';

END

I need the value stored in tblTwo.GuideMult (ie. One, BaseRate) to be translated

into the numerical value shown on a webform (ie. @.One, @.BaseRate) and then

insert the numerical values into tblOne.GuideMult

Clear as mud? Does somebody have a better way to do this?

You're right -not very clear.

Please post the table DDL, and some sample data in the form of INSERT statements (see this link), and a step by stop expanation of your starting and ending results.

Refer to value of textbox?

Hi all,
How would I go about referring to the value of a TextBox within a report? I
have a TextBox that I named "txtCount", in which I use an IIf expression to
selectively count records when in a group. In the footer of the container
group, I'd like to refer to that TextBox's value. I have no idea how to do
it. I tried Fields!txtCount.Value and that didn't work. I can't even refer
to a TextBox's value in the same detail line, so I must be missing
something. Or is it not possible to refer to another TextBox's value?
Thanks in advance for any help!
--
Regards,
Jake Marx
MS MVP - Excel
www.longhead.com
[please keep replies in the newsgroup - email address unmonitored]You can get textbox value by refer to "ReportItems!<textboxname>.Value
I'm not sure it will work in your case: Report item expressions can only
refer to other report items within the same grouping scope or a containing
grouping scope.
This posting is provided "AS IS" with no warranties, and confers no rights.
"Jake Marx" <msnews@.longhead.com> wrote in message
news:%23rwU3vHjEHA.2456@.TK2MSFTNGP10.phx.gbl...
> Hi all,
> How would I go about referring to the value of a TextBox within a report?
> I
> have a TextBox that I named "txtCount", in which I use an IIf expression
> to
> selectively count records when in a group. In the footer of the container
> group, I'd like to refer to that TextBox's value. I have no idea how to
> do
> it. I tried Fields!txtCount.Value and that didn't work. I can't even
> refer
> to a TextBox's value in the same detail line, so I must be missing
> something. Or is it not possible to refer to another TextBox's value?
> Thanks in advance for any help!
> --
> Regards,
> Jake Marx
> MS MVP - Excel
> www.longhead.com
> [please keep replies in the newsgroup - email address unmonitored]
>|||Jake Marx wrote:
> Hi all,
> How would I go about referring to the value of a TextBox within a
> report? I have a TextBox that I named "txtCount", in which I use an
> IIf expression to selectively count records when in a group. In the
> footer of the container group, I'd like to refer to that TextBox's
> value. I have no idea how to do it. I tried Fields!txtCount.Value
> and that didn't work. I can't even refer to a TextBox's value in the
> same detail line, so I must be missing something. Or is it not
> possible to refer to another TextBox's value?
OK - I found it online: ReportItems!txtCount.Value.
I can refer to a TextBox in the same group using that syntax.
However, what I'm looking to do is as follows:
Group 1: Client
Group 2 (inside Group 1): Status
Details: Claims
There are 4 statuses possible. What I'm trying to do is get the counts of
each Status *in the footer of Group 1*. I can't think of a good way to do
this. I can get the total Claims count within Group 1, and I can get counts
of each Status within Group 2. But I can't figure out how to get a count of
each Status type from Group 1. I need to do a calculation on the Client
level based on those counts. I tried the following, which didn't work:
1) created 4 textboxes in the Group 2 footer to hold the counts for each
status
2) tried summing the values of the textboxes created in step 1 from the
Group 1 footer
Any other ideas? Am I approaching this the wrong way?
--
Regards,
Jake Marx
MS MVP - Excel
www.longhead.com
[please keep replies in the newsgroup - email address unmonitored]|||Lev Semenets [MSFT] wrote:
> You can get textbox value by refer to "ReportItems!<textboxname>.Value
> I'm not sure it will work in your case: Report item expressions can
> only refer to other report items within the same grouping scope or a
> containing grouping scope.
Thanks, Lev. I composed my other post before I saw your reply. Do you have
any ideas on my other post?
--
Regards,
Jake Marx
MS MVP - Excel
www.longhead.com
[please keep replies in the newsgroup - email address unmonitored]|||I think, in step 2 you may put expressions into those 4 textboxes
for 1st status:
=Sum(iif(Fields!Status.Value == "Status1", 1, 0))
for 2nd
=Sum(iif(Fields!Status.Value == "Status2", 1, 0))
etc.
--
This posting is provided "AS IS" with no warranties, and confers no rights.
"Jake Marx" <msnews@.longhead.com> wrote in message
news:OXcqPNIjEHA.1776@.TK2MSFTNGP15.phx.gbl...
> Jake Marx wrote:
>> Hi all,
>> How would I go about referring to the value of a TextBox within a
>> report? I have a TextBox that I named "txtCount", in which I use an
>> IIf expression to selectively count records when in a group. In the
>> footer of the container group, I'd like to refer to that TextBox's
>> value. I have no idea how to do it. I tried Fields!txtCount.Value
>> and that didn't work. I can't even refer to a TextBox's value in the
>> same detail line, so I must be missing something. Or is it not
>> possible to refer to another TextBox's value?
> OK - I found it online: ReportItems!txtCount.Value.
> I can refer to a TextBox in the same group using that syntax.
> However, what I'm looking to do is as follows:
> Group 1: Client
> Group 2 (inside Group 1): Status
> Details: Claims
> There are 4 statuses possible. What I'm trying to do is get the counts of
> each Status *in the footer of Group 1*. I can't think of a good way to do
> this. I can get the total Claims count within Group 1, and I can get
> counts
> of each Status within Group 2. But I can't figure out how to get a count
> of
> each Status type from Group 1. I need to do a calculation on the Client
> level based on those counts. I tried the following, which didn't work:
> 1) created 4 textboxes in the Group 2 footer to hold the counts for each
> status
> 2) tried summing the values of the textboxes created in step 1 from the
> Group 1 footer
> Any other ideas? Am I approaching this the wrong way?
> --
> Regards,
> Jake Marx
> MS MVP - Excel
> www.longhead.com
> [please keep replies in the newsgroup - email address unmonitored]
>|||Lev Semenets [MSFT] wrote:
> I think, in step 2 you may put expressions into those 4 textboxes
> for 1st status:
> =Sum(iif(Fields!Status.Value == "Status1", 1, 0))
> for 2nd
> =Sum(iif(Fields!Status.Value == "Status2", 1, 0))
> etc.
Great - thanks, Lev!
--
Regards,
Jake Marx
MS MVP - Excel
www.longhead.com
[please keep replies in the newsgroup - email address unmonitored]

Refer to ROWGUID col in update trigger

When writing an Update trigger on a table that has a UniqueIdentifier as the
primary key, how to I refer to the current row being updated.
I am used to using @.@.identity when working with primary keys that are of
type int but a UniqueIdentifier cannot be an identity column. I suspect it
has something to do with the "Is ROWGUID" property but I can't find the
function for getting the GUID of the row being updated.
Thanks,
Andrew.There isn't one. If you need to know this then you should generate the Guid
beforehand and use it in the insert statement.
--
Andrew J. Kelly
SQL Server MVP
"Andrew" <sql@.ses.ca> wrote in message
news:u3lnbAiRDHA.2636@.TK2MSFTNGP10.phx.gbl...
> When writing an Update trigger on a table that has a UniqueIdentifier as
the
> primary key, how to I refer to the current row being updated.
> I am used to using @.@.identity when working with primary keys that are of
> type int but a UniqueIdentifier cannot be an identity column. I suspect
it
> has something to do with the "Is ROWGUID" property but I can't find the
> function for getting the GUID of the row being updated.
> Thanks,
> Andrew.
>|||I want to access the row that is being updated, not inserted. The GUID is
already there.
Does this mean it is not possible to use a trigger to update a
"DateOfLastUpdate" field if the primary key is a GUID? I realize date could
be updated if the update was performed using a stored procedure but I feel
it would be safer to have this functionality on the table itself.
Thanks,
Andrew
"Andrew J. Kelly" <sqlmvpnooospam@.shadhawk.com> wrote in message
news:%237WJLGiRDHA.1552@.TK2MSFTNGP10.phx.gbl...
> There isn't one. If you need to know this then you should generate the
Guid
> beforehand and use it in the insert statement.
> --
> Andrew J. Kelly
> SQL Server MVP
>
> "Andrew" <sql@.ses.ca> wrote in message
> news:u3lnbAiRDHA.2636@.TK2MSFTNGP10.phx.gbl...
> > When writing an Update trigger on a table that has a UniqueIdentifier as
> the
> > primary key, how to I refer to the current row being updated.
> >
> > I am used to using @.@.identity when working with primary keys that are of
> > type int but a UniqueIdentifier cannot be an identity column. I suspect
> it
> > has something to do with the "Is ROWGUID" property but I can't find the
> > function for getting the GUID of the row being updated.
> >
> > Thanks,
> > Andrew.
> >
> >
>|||> You threw me off when you mentioned @.@.IDENTITY. @.@.IDENTITY has nothing to
> do with an UPDATE, it is only useful for Inserts. Any time you want to
> reference a row that is being updated in a trigger you can use the
Inserted
> table. To update a datetime column you would simply do this:
> UPDATE YourTable SET ModDate = GETDATE()
> WHERE PK IN (SELECT i.PK FROM Inserted as i)
> This way it works when more than 1 rows is updated and there is no need to
> know what the actual value of the PK is.
I tend to use a wrapper like:
IF NOT UPDATE(ModDate)
Just to prevent recursion. :-)|||Thanks for your help. I had just "discovered" the inserted table but the
method I came up with is not as clean as yours.
"Andrew J. Kelly" <sqlmvpnooospam@.shadhawk.com> wrote in message
news:uiAkt8iRDHA.3236@.TK2MSFTNGP10.phx.gbl...
> You threw me off when you mentioned @.@.IDENTITY. @.@.IDENTITY has nothing to
> do with an UPDATE, it is only useful for Inserts. Any time you want to
> reference a row that is being updated in a trigger you can use the
Inserted
> table. To update a datetime column you would simply do this:
> UPDATE YourTable SET ModDate = GETDATE()
> WHERE PK IN (SELECT i.PK FROM Inserted as i)
> This way it works when more than 1 rows is updated and there is no need to
> know what the actual value of the PK is.
> --
> Andrew J. Kelly
> SQL Server MVP
>
> "Andrew" <sql@.ses.ca> wrote in message
> news:u53MXdiRDHA.2424@.tk2msftngp13.phx.gbl...
> > I want to access the row that is being updated, not inserted. The GUID
is
> > already there.
> >
> > Does this mean it is not possible to use a trigger to update a
> > "DateOfLastUpdate" field if the primary key is a GUID? I realize date
> could
> > be updated if the update was performed using a stored procedure but I
feel
> > it would be safer to have this functionality on the table itself.
> >
> > Thanks,
> > Andrew
> >
> >
> > "Andrew J. Kelly" <sqlmvpnooospam@.shadhawk.com> wrote in message
> > news:%237WJLGiRDHA.1552@.TK2MSFTNGP10.phx.gbl...
> > > There isn't one. If you need to know this then you should generate
the
> > Guid
> > > beforehand and use it in the insert statement.
> > >
> > > --
> > >
> > > Andrew J. Kelly
> > > SQL Server MVP
> > >
> > >
> > > "Andrew" <sql@.ses.ca> wrote in message
> > > news:u3lnbAiRDHA.2636@.TK2MSFTNGP10.phx.gbl...
> > > > When writing an Update trigger on a table that has a
UniqueIdentifier
> as
> > > the
> > > > primary key, how to I refer to the current row being updated.
> > > >
> > > > I am used to using @.@.identity when working with primary keys that
are
> of
> > > > type int but a UniqueIdentifier cannot be an identity column. I
> suspect
> > > it
> > > > has something to do with the "Is ROWGUID" property but I can't find
> the
> > > > function for getting the GUID of the row being updated.
> > > >
> > > > Thanks,
> > > > Andrew.
> > > >
> > > >
> > >
> > >
> >
> >
>

Refer to a field in a header

Ii,
I have a text box in the body of my report containing:
=Code.setMonth(ReportItems!textbox13.Value) but i want this to appear in
another textbox in my header. I have you read you can't refer directly to a
field. This is what I have in my Header textbox:
=ReportItems("textbox14").Value. Nothing shows up when i run the report. How
can I get this to appear?
Thanks in advance,
RhondaTo update this, it is actually a custom function I am calling, if I place th
e
call in the header textbox nothing appears.
"Rhonda" wrote:

> Ii,
> I have a text box in the body of my report containing:
> =Code.setMonth(ReportItems!textbox13.Value) but i want this to appear in
> another textbox in my header. I have you read you can't refer directly to
a
> field. This is what I have in my Header textbox:
> =ReportItems("textbox14").Value. Nothing shows up when i run the report. H
ow
> can I get this to appear?
> Thanks in advance,
> Rhonda