Friday, March 30, 2012
Return Different Fields Based On Expression
I have a dataset set up to return a set of billing information. I have this
information displayed in a matrix. However I have requirement where;
a) If the account type = ODC then return the vendor_name field
b) If the account type = ODC and venor_name field is null then return the
employee_name field
c) In any other case return the employee_name field.
Is there a way to set up an expression in a text box on the detail line of a
matrix to reflect the info needed?
There's a little more to be desired with my expression syntax skills so any
help would be greatly appreciated.
ThanksYou should do this in the SQL and return it in a single column.
In SQL Server,
NameField = CASE
WHEN accountType = ODC
CASE
WHEN vendor_name is null then employee_name
ELSE vendor_name
END
else
EMPLOYEE_NAME
END
-tIM
"JDArsenault" <JDArsenault@.discussions.microsoft.com> wrote in message
news:2ADF13EE-A421-4F4A-8E5E-A47C1D55D89B@.microsoft.com...
> Hello Out There,
> I have a dataset set up to return a set of billing information. I have
> this
> information displayed in a matrix. However I have requirement where;
> a) If the account type = ODC then return the vendor_name field
> b) If the account type = ODC and venor_name field is null then return the
> employee_name field
> c) In any other case return the employee_name field.
> Is there a way to set up an expression in a text box on the detail line of
> a
> matrix to reflect the info needed?
> There's a little more to be desired with my expression syntax skills so
> any
> help would be greatly appreciated.
> Thanks|||I often don't see the forest through the trees. Thanks for the quick help.
JD
"Tim Dot NoSpam" wrote:
> You should do this in the SQL and return it in a single column.
> In SQL Server,
> NameField = CASE
> WHEN accountType = ODC
> CASE
> WHEN vendor_name is null then employee_name
> ELSE vendor_name
> END
> else
> EMPLOYEE_NAME
> END
> -tIM
> "JDArsenault" <JDArsenault@.discussions.microsoft.com> wrote in message
> news:2ADF13EE-A421-4F4A-8E5E-A47C1D55D89B@.microsoft.com...
> > Hello Out There,
> >
> > I have a dataset set up to return a set of billing information. I have
> > this
> > information displayed in a matrix. However I have requirement where;
> >
> > a) If the account type = ODC then return the vendor_name field
> > b) If the account type = ODC and venor_name field is null then return the
> > employee_name field
> > c) In any other case return the employee_name field.
> >
> > Is there a way to set up an expression in a text box on the detail line of
> > a
> > matrix to reflect the info needed?
> >
> > There's a little more to be desired with my expression syntax skills so
> > any
> > help would be greatly appreciated.
> >
> > Thanks
>
>
Tuesday, March 20, 2012
Retrieving logged in name for data selection from SQL server
I have a login name being displayed when a user logs in, like so: "Welcome: johndoe23"
This is displayed through the use of the <asp:LoginName> tag.
I want to do a query on the database that only selects data relevant to that userName and wish to
assign that logged in username to a variable so we can use an SQL command similar to:"SELECT something WHERE userID=" + loggedInUserName;
According to MSDN:
By default, theLoginName control displays the name contained in theUser property of thePage class. If theSystem.Web.UI.Page.User.Identity.Name property is empty, the control is not rendered.
**END MSDN**
According to that - the following should work:
sqlStr = "SELECT something WHERE userID=" + Page.User.Identity.Name;
You might need apostrophes - not sure, i use the SqlParameter for everything.
I have never used the built in login features, so give it shot.
|||
We actually progressed to using the guid of the logged in user in order to query the database.
This GUID was a big string of letters. We lost all of this weeks code in a hard drive failure this morning unfortunately and are trying to get back on our feet.
I've found loads about finding the Windows identity of the logged in user, but this is not what we want.
Does anyone know how to retrieve this GUID and assign it to a variable?
Many thanks!
Monday, March 12, 2012
retrieving data from SQL2000
I am trying to retrieve data that has been inserted into the database but only half the text is being displayed.
The field is varchar(8000)
In the Enterprise Manager I can view the data, then I copy and paste it into MS Word and everything is there.
851 Characters with spaces.
However, when I enter the SQL code into SQL Query Analyzer only half the text shows, about 257 characters are displayed with spaces.
When I display the information on the webpage only half the text is displayed (running IIS/PHP 5)
I don't know why this is doing this and not sure what I can do to display the full text.
Please help.
This is Query Analyser setting...
In QA window go to Tools -- Options -- Select "Result" tab -- Change "Maximum Charater Per Column " to whatever setting u want
Madhu
|||Thanks, this resolves the first part of my question however, when I display the information on the web it is still being truncated. If there are any ideas that would be great. Thanks!|||
check the variable size if any ... it may be used as Varchar (4000)
Madhu