显示标签为“header”的博文。显示所有博文
显示标签为“header”的博文。显示所有博文

2012年3月26日星期一

Flat File With Fixed Length Header and No Delimeter

Hi,

I'm trying to extract data from a Flat File which is as fixed length as they come. The file has a header, which simply contains the number of records in the file, followed by the records, with no header delimeter (No CR/LF, nothing).

For example a file would look like the following:

00000003Name1Address1Name2Address2Name3Address3

So this has 3 records (indicated by the first 8 characters), each consisting of a Name and Address.

I can't see a way to extract the data using a flat file connection, unless we add a delimeter for the header (not possible at this stage). Am I wrong?

Any suggestions on possible solution would be much appreciated - I'm thinking Ill have to write a script to parse the file manually.

Thanks in advance,

Scott

Do you need the data in the first row?

You can just ignore it by setting the "Header rows to skip" setting to 1.

K

|||

Yes. Essentially the file is just one row..Which would include the header details (number fo records) then all of the fixed length records follow (on the same line)

Scott

|||

Scott,

Given the unstructured nature of this file I think you will have to parse it out yourself in a script task. This isn't as daunting as it sounds. First clue I can give you is that it will have to be an asynchronous script task.

You can still import it into the pipeline using a Flat File Connection Manager though. It'll be a 1-column, 1-row file that's all.

-Jamie

|||

Using a script component of type source should be easiest. A little example follows.

Here is my sample file, representing an 8 byte header, followed by three rows of two columns, 10 and 20 bytes respectively.

00000003A234567890B234567890C234567890D234567890E234567890F234567890G234567890H234567890I234567890

The results table will look a bit like this-

Name Address
A234567890 B234567890C234567890
D234567890 E234567890F234567890
G234567890 H234567890I234567890

You will need to create the two columns in the script component , Name and Address as DT_WSTR 10 and 20 in length.

Now the code-

Public Class ScriptMain

Inherits UserComponent

Private stream As StreamReader

Public Overrides Sub CreateNewOutputRows()

Dim headerRecordCount As Integer

Dim recordCount As Integer = 0

'// Get filename from connection, using full acquire method

Dim filename As String = CType(Me.Connections.Connection.AcquireConnection(Nothing), String)

'// Open source file

stream = New StreamReader(filename)

'// Reader header block, 8 characters

Dim headerBuffer(7) As Char

If stream.ReadBlock(headerBuffer, 0, 8) = 8 Then

'// Store record count for later use in validation

headerRecordCount = CType(New String(headerBuffer), Integer)

Else

Throw New Exception("Invalid file format, header not valid.")

End If

With Output0Buffer

While stream.Peek > 0

'// Add data rows

.AddRow()

.Name = ReadColumn(10)

.Address = ReadColumn(20)

recordCount = recordCount + 1

End While

'// Close down buffer

.SetEndOfRowset()

'// Check record count

If recordCount = headerRecordCount Then

Me.Log(String.Format("Header row count ({0}) matched toital rows found.", headerRecordCount), 1, Nothing)

Else

Throw New Exception(String.Format("Invalid file format, header row count ({0}) not equal to rows found ({1}).", headerRecordCount, recordCount))

End If

End With

End Sub

Private Function ReadColumn(ByVal length As Integer) As String

Dim buffer(length - 1) As Char

If stream.Read(buffer, 0, length) = length Then

Return New String(buffer)

Else

Throw New Exception("Invalid file format, full column length not found.")

End If

End Function

End Class

|||Thanks for the answers guys..

Have gone with using a script component of type source, as per code above. With one change...Just ensured that the stream is closed after processing to ensure the resources are released...

I also added an extra Output for the script which holds the header details - my real data file has extra (useful) details in the header.

Thanks again..

Scott

2012年3月21日星期三

Flat File Connection Manager does NOT fail

I use Flat File connection manager where I have defined the format of the file as "Ragged Right" (CR,LF Dos file) with no header rows. The columns are fixed width with Row Delimiter "{CR}{LF}".

The problem is when I process a file with incorrect format. The file execution does not throw an error. Instead it throws a warning " There is a partial row at the end of the file.".

How can I force the Flat file connection manager to FAIL if the format of the file is not matched exactly. I would think this would be the default behavior of Connection manager.

ie. If I have Connection manager setup for a dos file with 2 columns. Column 1 is 5 characters long, column 2 is 3 character long, and the end of line characters are CR, LF. However, if I send in file with 10 rows of 1 character and CR LF, the data flow works and processes these rows incorrectly. How can I force the task to fail if incoming file is not in defined format.

The "Ragged Right" format does not have any limitation on the size of the last column (delimited one), so if your file is missing some row delimiters the flat file parser will continue to look for them and probably swallow succeeding row(s).

You can restrict the size of your "ragged right" column by setting the OutputColumnWidth property of those columns on the Advanced page of the Flat File Connection Manager UI. That will make the flat file source fail if the truncation happens. If you would rather to redirect such rows, you can do that by setting "Redirect Row" for Truncation on the Error Output page of the Flat File Source UI, and then define your error flow.

HTH.|||Thanks. It worked.

2012年3月19日星期一

Fixing Table Headers

Hi,
the problem in one of our reports is, that there are a lot of detail lines
for each group, so if you scroll down to see them, the table header is not
visible. Our customers are complaining about that, because they have to
scroll up and down to see to which field the detail belongs.
Moreover it is not possible to split the table, because all details are a
logical group.
My question: Is it possible to fix a table header like the fixing function
in excel, so it can always be seen when you scroll down the details?
Thanks,
BjörnTable headers can be repeated on each page, but you can not do the excel
like thing... You can make your page smaller, but that's about it I think.
--
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.
"Björn Grünberg" <BjrnGrnberg@.discussions.microsoft.com> wrote in message
news:DE7380C6-C5A0-47C0-9C0E-F267976BCC4A@.microsoft.com...
> Hi,
> the problem in one of our reports is, that there are a lot of detail lines
> for each group, so if you scroll down to see them, the table header is not
> visible. Our customers are complaining about that, because they have to
> scroll up and down to see to which field the detail belongs.
> Moreover it is not possible to split the table, because all details are a
> logical group.
> My question: Is it possible to fix a table header like the fixing function
> in excel, so it can always be seen when you scroll down the details?
> Thanks,
> Björn|||Wayne is right, Reporting Services 2000 does not this particular feature.
Look for this in Reporting Services 2005 (shipping as part of Yukon),
though.
--
This posting is provided "AS IS" with no warranties, and confers no rights.
"Wayne Snyder" <wayne.nospam.snyder@.mariner-usa.com> wrote in message
news:uhCnpeBRFHA.3020@.TK2MSFTNGP12.phx.gbl...
> Table headers can be repeated on each page, but you can not do the excel
> like thing... You can make your page smaller, but that's about it I think.
> --
> 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.
> "Björn Grünberg" <BjrnGrnberg@.discussions.microsoft.com> wrote in message
> news:DE7380C6-C5A0-47C0-9C0E-F267976BCC4A@.microsoft.com...
>> Hi,
>> the problem in one of our reports is, that there are a lot of detail
>> lines
>> for each group, so if you scroll down to see them, the table header is
>> not
>> visible. Our customers are complaining about that, because they have to
>> scroll up and down to see to which field the detail belongs.
>> Moreover it is not possible to split the table, because all details are a
>> logical group.
>> My question: Is it possible to fix a table header like the fixing
>> function
>> in excel, so it can always be seen when you scroll down the details?
>> Thanks,
>> Björn
>|||On Mon, 18 Apr 2005 03:57:19 -0700, "Björn Grünberg"
<BjrnGrnberg@.discussions.microsoft.com> wrote:
>Hi,
>the problem in one of our reports is, that there are a lot of detail lines
>for each group, so if you scroll down to see them, the table header is not
>visible. Our customers are complaining about that, because they have to
>scroll up and down to see to which field the detail belongs.
>Moreover it is not possible to split the table, because all details are a
>logical group.
>My question: Is it possible to fix a table header like the fixing function
>in excel, so it can always be seen when you scroll down the details?
>Thanks,
>Björn
Bjorn,
It's a little bit of a kludge but why not add a table footer and
simply repeat the information that is in the table header? That should
make the relevant information visible in a larger part of the page.
Andrew Watt
MVP - InfoPath

2012年3月11日星期日

fixed table header overlays text

Wondering if anyone else has had this problem? I'm using RS for SQL 2005 and
checked the option "Header should remain visible while scrolling" on my
table. And the header line does remain visible, but it's on top of the data
as you scroll down the page. (the header line is 3 lines long - if that
matters).
Thanks for any help.
MarkWe had this issue. To keep it from looking badly when the user scrolled
down the resultset, we set the background of the header to White instead of
transparent.
Regards.
Chris E.
"Mark" <Mark@.discussions.microsoft.com> wrote in message
news:16C3E1FF-7CB5-47F6-9C6B-C4136B96CE5E@.microsoft.com...
> Wondering if anyone else has had this problem? I'm using RS for SQL 2005
> and
> checked the option "Header should remain visible while scrolling" on my
> table. And the header line does remain visible, but it's on top of the
> data
> as you scroll down the page. (the header line is 3 lines long - if that
> matters).
> Thanks for any help.
> Mark|||Chris - thanks. worked perfectly.
m
"Chris" wrote:
> We had this issue. To keep it from looking badly when the user scrolled
> down the resultset, we set the background of the header to White instead of
> transparent.
> Regards.
> Chris E.
> "Mark" <Mark@.discussions.microsoft.com> wrote in message
> news:16C3E1FF-7CB5-47F6-9C6B-C4136B96CE5E@.microsoft.com...
> > Wondering if anyone else has had this problem? I'm using RS for SQL 2005
> > and
> > checked the option "Header should remain visible while scrolling" on my
> > table. And the header line does remain visible, but it's on top of the
> > data
> > as you scroll down the page. (the header line is 3 lines long - if that
> > matters).
> >
> > Thanks for any help.
> > Mark
>
>|||I just want to say "Thank you!". work for me too.
"Chris" wrote:
> We had this issue. To keep it from looking badly when the user scrolled
> down the resultset, we set the background of the header to White instead of
> transparent.
> Regards.
> Chris E.
> "Mark" <Mark@.discussions.microsoft.com> wrote in message
> news:16C3E1FF-7CB5-47F6-9C6B-C4136B96CE5E@.microsoft.com...
> > Wondering if anyone else has had this problem? I'm using RS for SQL 2005
> > and
> > checked the option "Header should remain visible while scrolling" on my
> > table. And the header line does remain visible, but it's on top of the
> > data
> > as you scroll down the page. (the header line is 3 lines long - if that
> > matters).
> >
> > Thanks for any help.
> > Mark
>
>

Fixed header rowin Reporting Services

Hi,
I've been devloping reports using Reporting Services. It's useful and fast.
However, I've this group of users who would like to fix the header row while
the data is able to scoll down and up without moving the header row. Is
there any configuration that can solve my problem? Below is a simple
illustration, hope anyone can help me in this.
| X header | Y header | Z header | ... | => This row must be fixed
| X data1 | Y data1 | Z data1 |... | ^
| X data2 | Y data2 | Z data2 |... | |
| X data3 | Y data3 | Z data3 |... | |
| X data4 | Y data4 | Z data4 |... | | These data rows
should be able to
| X data5 | Y data5 | Z data5 |... | | scroll up and down
| ........ | ........ | ........ |... | |
| X dataN | Y dataN | Z dataN |... | v
Best Regards,
Samie
I don't know how to do this.
I suspect that you will have a better response within the Reporting Services
newsgroup. I am including that group in this reply. Hopefully someone in
that group will be able to help.
Keith
"Samie" <Samie@.discussions.microsoft.com> wrote in message
news:D12C8438-E59D-49D5-9E2D-31C4D3A6B17C@.microsoft.com...
> Hi,
> I've been devloping reports using Reporting Services. It's useful and
fast.
> However, I've this group of users who would like to fix the header row
while
> the data is able to scoll down and up without moving the header row. Is
> there any configuration that can solve my problem? Below is a simple
> illustration, hope anyone can help me in this.
> | X header | Y header | Z header | ... | => This row must be fixed
> | X data1 | Y data1 | Z data1 |... | ^
> | X data2 | Y data2 | Z data2 |... | |
> | X data3 | Y data3 | Z data3 |... | |
> | X data4 | Y data4 | Z data4 |... | | These data rows
> should be able to
> | X data5 | Y data5 | Z data5 |... | | scroll up and down
> | ........ | ........ | ........ |... | |
> | X dataN | Y dataN | Z dataN |... | v
>
> Best Regards,
> Samie
>
|||Thanks Keith...
I'm hoping someone can help me too.
Regards,
samie
"Keith Kratochvil" wrote:

> I don't know how to do this.
> I suspect that you will have a better response within the Reporting Services
> newsgroup. I am including that group in this reply. Hopefully someone in
> that group will be able to help.
> --
> Keith
>
> "Samie" <Samie@.discussions.microsoft.com> wrote in message
> news:D12C8438-E59D-49D5-9E2D-31C4D3A6B17C@.microsoft.com...
> fast.
> while
>
|||Samie,
Fixed headers are not supported with version 1.0 but on the wish list for
2005.
Hope this helps.
Teo Lachev, MVP [SQL Server], MCSD, MCT
Author: "Microsoft Reporting Services in Action"
Publisher website: http://www.manning.com/lachev
Buy it from Amazon.com: http://shrinkster.com/eq
Home page and blog: http://www.prologika.com/
"Samie" <Samie@.discussions.microsoft.com> wrote in message
news:119F060E-C479-4AF6-97E2-B59600B8D383@.microsoft.com...[vbcol=seagreen]
> Thanks Keith...
> I'm hoping someone can help me too.
> Regards,
> samie
>
> "Keith Kratochvil" wrote:
Services[vbcol=seagreen]
in[vbcol=seagreen]
row[vbcol=seagreen]
Is[vbcol=seagreen]
fixed[vbcol=seagreen]
rows[vbcol=seagreen]
down[vbcol=seagreen]

Fixed Header issue in SSRS 2005

I am tryign to keep the headers fixed, on a 2005 report.

Hence In the Layout section for table settings properties,I Set the FixedHeader setting to True to keep the headers visible as you scroll down .

However, when I scroll down the report, the headers stay fixed, BUT IT OVERLAPS With the rows of data.

Any idea why this would happen?

To keep it from looking like it is overlapping you can change the background color from transparent to white (or whatever color you choose).

Simone

|||Yes, thats what I did and then it does not appear like it overlaps. However, is there any reason why this happens. AND how can we prevent this from happening, besides changing the Background color?|||I believe it is by design. The background color defaults to transparent. When the header is set to fixed, it doesn't move but the rest of the page does. The transparency results in the "overlap".

Fixed header in Sql Reporting

Hi All,
I have an issue with SQL reports. Once I set FixedHeader Property of Table
used in SQl report TURE. The detail of data getting overlapped on fixed
header of the report.
Is there any way to resolve this?
Thankin advance.
ShaileshSet you header line(s) BackgroundColor to White instead of the default
Transparent.
"Shailesh K" wrote:
> Hi All,
> I have an issue with SQL reports. Once I set FixedHeader Property of Table
> used in SQl report TURE. The detail of data getting overlapped on fixed
> header of the report.
> Is there any way to resolve this?
> Thankin advance.
> Shailesh|||Thanks William...It works well.
"William" wrote:
> Set you header line(s) BackgroundColor to White instead of the default
> Transparent.
>
> "Shailesh K" wrote:
> > Hi All,
> >
> > I have an issue with SQL reports. Once I set FixedHeader Property of Table
> > used in SQl report TURE. The detail of data getting overlapped on fixed
> > header of the report.
> > Is there any way to resolve this?
> > Thankin advance.
> >
> > Shailesh

Fixed Header in Reporting Service 2000

I want to create a report with SQL Server Reporting Service 2000 where I need to have a fixed header and one fixed column containg names of each row items. I tried to find "Fixed Header" property in table but could not locate it anywhere.Can anyone please kindly tell me where should i look for it?Or how to achieve this functionality?

Thank you in advance.

Bharat Gadhia.

FixedHeader is a new feature that got added in RS 2005. It was not available in 2000.|||

Hi Fang,

Thank you for the reply.

Can you tell me how to achieve this functionality in SQL Server Reporting Service 2000?

Bharat Gadhia.

Fixed Header Error

I get the error:
[rsInvalidFixedTableColumnHeaderSpacing] The table â'table1â' includes
improperly placed columns with FixedHeader set to true. These columns must
be side-by-side, must start with either the left-most or right-most table
column, and cannot be applied to all columns on the table.
I've tried changing the table property "Fixed Header" to False, but this
does not fix the error. This property only seems to be available for the
table and not the columns, so there seems to be no other way to fix this.
HELP!
--
Systems AnalystSelect and set fixedHeader=false for all columns one by one on the report.
Save your report. Now Start from begining or end of the columns, set
fixedHeader=true one by one sequentially, but not for all. Hope report will
work.
"schmidtkaren" wrote:
> I get the error:
> [rsInvalidFixedTableColumnHeaderSpacing] The table â'table1â' includes
> improperly placed columns with FixedHeader set to true. These columns must
> be side-by-side, must start with either the left-most or right-most table
> column, and cannot be applied to all columns on the table.
> I've tried changing the table property "Fixed Header" to False, but this
> does not fix the error. This property only seems to be available for the
> table and not the columns, so there seems to be no other way to fix this.
> HELP!
> --
> Systems Analyst

Fixed header

Hello!

I have a report that the users reach from an url. In the url I have rc:parameters = false. That part works fine. But when I use rc:parameters = false, the property fixed header doesn't seem to work. If I run the report from the report server it works fine, but not from the url.

Any ideas?

/C

Fixed headers don't work if the url access displays more than one page at the same time. The best way to ensure that fixed headers work is to run with rc:toolbar=true|||

Ok, I see...
I tried with "rc:toolbar=true" and set all parameters to "hidden" instead. It works fine, even though it feels a little bit slower when the report is rendering.
Another problem I faced before when I had rc:Parameters = false was that when I did a user sort on any column, the ability to go to next page was gone.
Before the user sort, I could scroll down to next page but when I sorted a column, I could only scroll the first page.
Is it a bug?