Showing posts with label similar. Show all posts
Showing posts with label similar. Show all posts

Friday, March 23, 2012

Replace List

Hi,
I was wondering if SQL Server had a function similar to the ReplaceList()
function in ColdFusion. If you don't know anything about ColdFusion, I'll
explain what I need.
I have a field that I need to verify for "bad" characters from a list and
replace them with the "good" versions.
For example:
ArrayBad('badchar_1', 'badchar_2', 'badchar_3', ...);
ArrayGood('goodchar_1', 'goodchar_2', 'goodchar_3', ...);
Replace all the listed bad characters with their equal good version
repectively.
Anyone now how I can do this in a UDF format?
TIA,
EricT-SQL doesn't have any array or list datatypes. The most direct approach is
that you'll have to nest them. E.g.
CREATE FUNCTION dbo.CleanWord
(
@.dirtyWord VARCHAR(64)
)
RETURNS VARCHAR(64)
AS
BEGIN
DECLARE @.cleanWord VARCHAR(32);
SET @.cleanWord =
REPLACE(
REPLACE(
@.dirtyWord,
'bleep','@.#%$'),
'beep','#^&@.');
RETURN @.cleanWord;
END
GO
SELECT dbo.CleanWord('who the bleep did this beep?');
GO
DROP FUNCTION dbo.CleanWord;
GO
"Eric D." <EricD@.discussions.microsoft.com> wrote in message
news:0BD58B41-D2D8-45F6-ADDA-5707717C7C65@.microsoft.com...
> Hi,
> I was wondering if SQL Server had a function similar to the ReplaceList()
> function in ColdFusion. If you don't know anything about ColdFusion, I'll
> explain what I need.
> I have a field that I need to verify for "bad" characters from a list and
> replace them with the "good" versions.
> For example:
> ArrayBad('badchar_1', 'badchar_2', 'badchar_3', ...);
> ArrayGood('goodchar_1', 'goodchar_2', 'goodchar_3', ...);
> Replace all the listed bad characters with their equal good version
> repectively.
> Anyone now how I can do this in a UDF format?
> TIA,
> Eric
>

Monday, March 12, 2012

Repeated Rows in Matrix

Hi,

I am facing a problem with Matrix control. My requirement is similar to the below problem.

The report should display Manager, Leaders under him, Members under leaders. The data is the working hours of members grouped by Month.

Manager Leader Member Jan Feb Mar Apr .....

M1 L1 E1 170 160 150 180

E2 159 161 130 185

E3 150 180 159 161

L2 E5 159 161 170 160

E6 159 161 130 185

E1 160 150 150 180

M2 L3 E5 150 180 159 161

L1 E1 160 150 150 180

I took Manager, Leader and Member Name columns as Row groups and Month of Working day as Column group. Working hours sum in Data Section. Every thing is working fine but some rows for same Manager are dividing into to parts and displaying as entries for seperate managers as below.

Manager Leader Member Jan Feb Mar Apr .....

M1 L1 E1 140 150 100 120

E2 119 149 50 120

E3 150 180 159 161

L2 E5 159 161 170 160

E6 159 161 130 185

E1 160 150 150 190

M1 L1 E1 30 10 50 60

E2 40 11 80 65

Is this any bug of Matrix control or is there any thing wrong in my design ?( I just dragged respective columns to row, column and data groups, nothing much). Are there any things i need to ensure ?

This could be caused by Manager fields not being exactly the same. There could be extra white space or a different case used for a character or two.

Try using the following as the grouping expression.

"=Fields!FieldName.Value.Trim().ToLower()"

Ian|||It is working. Thank you very much.

Friday, March 9, 2012

Repeat List across page, not just down?

I want to use a List (or similar), but I want the fields from each row of the source datatable to repeat across the page before wrapping to the next line. For example:

row1-FieldA row1-FieldB row2-FieldA row2-FieldB
row3-FieldA row3-FieldB row4... etc

Is this possible?

Quick and dirthy is to write the expression

select the required report item(table in ur list)

choose expression for property(value)

==Iif(RowNumber("table") mod 2,FieldA,"")