Showing posts with label dynamic. Show all posts
Showing posts with label dynamic. Show all posts

Monday, March 26, 2012

forming where clause

I wonder if I could write a dynamic where statement in a store procedure.
I have a web page that will pass following information to the store procedur
e.
Lets say I have a parameter @.typeid that can be 1 for rent, 2 for sale, 1 or
2 for either. My store procedure looks like this
create select_apartment_details
(
@.typeid nvarchar(50) -- @.typeid ='1' or @.typeid ='2' or @.typeid='1, 2'
)
AS
SELECT * FROM tbl_apartments WHERE typeid IN (@.typeid)
GO
By the way typeid field in the tbl_apartments is integer.
However, this doesnt work. Can anyone help me pls?If the values in the TypeID Column in the tbl_apartments table are indeed
limited to
1 or 2, then I suggest the following
Pass in @.TypeID = 1 When you want only the 1s,
@.TypeID = 2 When you want only the 2s,
and @.TypeID = 3, when you want 1s and 2s
Then in your where clause, you can do this
Where TypeID ^ @.Type <> 0
This will do a bitwise And comparison such that
Database TypeID
@.TypeID | 1 2
-- | -- --
1 | 1 0
2 | 0 2
3 | 1 2
"regaliel" wrote:

> I wonder if I could write a dynamic where statement in a store procedure.
> I have a web page that will pass following information to the store proced
ure.
> Lets say I have a parameter @.typeid that can be 1 for rent, 2 for sale, 1
or
> 2 for either. My store procedure looks like this
> create select_apartment_details
> (
> @.typeid nvarchar(50) -- @.typeid ='1' or @.typeid ='2' or @.typeid='1, 2'
> )
> AS
> SELECT * FROM tbl_apartments WHERE typeid IN (@.typeid)
> GO
> By the way typeid field in the tbl_apartments is integer.
> However, this doesnt work. Can anyone help me pls?
>|||Sorry Memory tricked me... The bitwise operator yu want is bitwise AND, and
the operator symbol is an Ampersand as in
Where TypeID & @.TypeID <> 0
"regaliel" wrote:

> I wonder if I could write a dynamic where statement in a store procedure.
> I have a web page that will pass following information to the store proced
ure.
> Lets say I have a parameter @.typeid that can be 1 for rent, 2 for sale, 1
or
> 2 for either. My store procedure looks like this
> create select_apartment_details
> (
> @.typeid nvarchar(50) -- @.typeid ='1' or @.typeid ='2' or @.typeid='1, 2'
> )
> AS
> SELECT * FROM tbl_apartments WHERE typeid IN (@.typeid)
> GO
> By the way typeid field in the tbl_apartments is integer.
> However, this doesnt work. Can anyone help me pls?
>|||Try this:
SELECT * FROM tbl_apartments WHERE CHARINDEX(CAST(typeid AS CHAR(1)), @.test)
> 0
"regaliel" <regaliel@.discussions.microsoft.com> wrote in message
news:9B49F533-89B9-492D-B556-96B2199585C9@.microsoft.com...
>I wonder if I could write a dynamic where statement in a store procedure.
> I have a web page that will pass following information to the store
> procedure.
> Lets say I have a parameter @.typeid that can be 1 for rent, 2 for sale, 1
> or
> 2 for either. My store procedure looks like this
> create select_apartment_details
> (
> @.typeid nvarchar(50) -- @.typeid ='1' or @.typeid ='2' or @.typeid='1, 2'
> )
> AS
> SELECT * FROM tbl_apartments WHERE typeid IN (@.typeid)
> GO
> By the way typeid field in the tbl_apartments is integer.
> However, this doesnt work. Can anyone help me pls?
>

Formatting text in using Report Designer

Hello,

I am designing a report which has some static and dynamic data. The static content is a huge text and I want to highlight certain portions of the text with bold font and in some places with different color.

I am using textbox report item to draft the static text. But unfortunately, I am not able to change the font of a portion of the text. If I change the font, by highlighing some text, it changes for all the text in the text box.

Can you please help to solve this problem?

-Srinivas

The bits of text you want to change will have to be treated as separate pieces of data and be in a separate container (ie textbox). Do you know what they are ahead of time? You could try having a bunch of textboxes lined up end to end, and set CanGrow to true - but it would still be difficult to get this looking good.

sluggy

|||Earlier, I have tried having series of textbox's as in the similar way as you have suggested. And that works.

But I want to do that in one control so that it will be easy to format and gives the flexibility to work on complete text (instead of bits of text) and also align the text as needed.

Is there a way?

Friday, March 23, 2012

Formatting Suggestions - Please Help

Hello,

I have a matrix with a dynamic number of columns (1-10). The trouble is that hiding one ore more columns still leaves space reserved for all 10 columns, which is ugly. This is because the size of the TextBox that oversees the columns is not dynamic, and it is set to the size of all 10 text boxes.

In other words, a matrix with 5 columns looks like this:

Item Total

Col1 Col2 Col3 Col4 Col5 Total

5 5 5 5 5 25

While a matrix with 2 columns (the last 3 have visibility set to false) looks like this:

Item Total

Col1 Col2 Total

5 5 25

I am going crazy trying to solve this one. Does anyone have any ideas at all that can help me? Merging all the columns into a single column would not work well for me, as each column is a drill-down for the others. And making each column small (.1in), doesn't work either because there is no "no-wrap" property.

ANY suggestions would be appreciated. How have others dealt with this issue?

Michael

I have also found that the invisible function is SQL reports is no good. What determines how many columns there will be on the report? Can you use that determination to choose between different reports -- say one that is a two column report and another that is a five column report? Don't use invisibility at all.|||

Greg,

That's what I did. I created a small, medium, and large version of my report (1-2, 3-5, 6-10), that seems to be reasonable even when the visibility column is hidden for some of the columns. The problem is that I have a dozen reports I want to use with the variable column in the left axis, and that means I need to create 36 reports instead of 12. Fortunately, the top axis auto-fits items so I only need one report for the top axis, or else I would be in BIG trouble.

sql

Wednesday, March 21, 2012

Formatting in Exported Reports

Hi. I have a matrix report that has very dynamic data attached to it,
specifically text that can vary in length from 5 characters to 100 or more.
I found the best solution for rendering was to keep the actual matrix row and
column widths to a minimum and let the matrix grow as required.
The problem I have run into is, when you export to Excel or PDF, it appears
the export uses these minimum column/row widths, and the report does not look
good and requires alot of formatting by hand (including another problem with
column headings I posted).
So my question is, is there any way to work around this or a best practices?
Any help would definitely be appreciated.Actually, this problem is only in Excel.
"comet61" wrote:
> Hi. I have a matrix report that has very dynamic data attached to it,
> specifically text that can vary in length from 5 characters to 100 or more.
> I found the best solution for rendering was to keep the actual matrix row and
> column widths to a minimum and let the matrix grow as required.
> The problem I have run into is, when you export to Excel or PDF, it appears
> the export uses these minimum column/row widths, and the report does not look
> good and requires alot of formatting by hand (including another problem with
> column headings I posted).
> So my question is, is there any way to work around this or a best practices?
> Any help would definitely be appreciated.sql