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

2012年3月26日星期一

Flat Files Containing Dates

Hi everyone.
I'm trying to use a Flat File Connector to read in a fixed field width file that contains some date columns.
The problem is that the date column is in a CCYYMMDD format (with no delimiters) so that todays date, as an example, would be 20050711.
When it attempts to import the file it fails due to a "Data Conversion Failed" error. I can't find any way to specify the format of the column in the FFC dialog so my only option appears to be read in the column as a string and transform it later.
Is that correct?
Steve
Steve,
It sounds like it is, yes. Your other option is to write a custom connection manager and source component but that's like using a sledgehammer to crack a nut.

-Jamie|||Thanks Jamie, that's just what I was expecting.
Steve
|||

Jamie Thomson wrote:

Steve,
It sounds like it is, yes. Your other option is to write a custom connection manager and source component but that's like using a sledgehammer to crack a nut.

-Jamie

Or you could also use a script component as a source. Again, it may be overkill!

-Jamie|||Looks like ISO 8601 sans the '-' character. You can write a simple derived column expression to parse this out and convert it to a date. Like you say, just retrieve it as a string the new column will be a date.

Here's one way to do it:

(DT_DATE)(SUBSTRING(Date,6,2) + "-" + SUBSTRING(Date,8,2) + "-" + SUBSTRING(Date,1,5))

That will convert a string date column like this:

Date Derived Column 1 20050112 1/12/05 20031122 11/22/03 20050509 5/9/05 20010101 1/1/01 20000301 3/1/00 20021003 10/3/02 20022002 2/20/02 19631003 10/3/63 19621002 10/2/62 20051111 11/11/05

|||Thanks for those replies guys.
I'd like to create a derived column transform programmatically using the SSIS object model. I can't find any help in BOL regarding this - but I've managed to get this so far, which creates the derived column transformation object (the dataFlow object is a MainPipe object created elsewhere):



DTSComponentMetaData90 DerivedColumn;
DerivedColumn = dataFlow.ComponentMetaDataCollection.New();
DerivedColumn.Name = "DateTransform";
DerivedColumn.ComponentClassID = "DTSTransform.DerivedColumn.1";
CManagedComponentWrapper instance = DerivedColumn.Instantiate();
instance.ProvideComponentProperties();
instance.AcquireConnections(null);
instance.ReinitializeMetaData();
instance.ReleaseConnections();


The problem I have now is that I don't know how to create new columns from old columns ( as I will need to do in my case ). I have used other components which have mapped the virtual columns from the input to the output, so I'm assuming it's something similar, but I can't get it to work.
I've even tried creating a transform in the BIDS and then opening the package in code to see what the object looks like, but some of the properties were read-only and must be set another way. I'm really stuck now so any help would be really appreciated.
Thanks.
Steve
|||Steve,

To create a new column from an existing column you need to add an output column to the derived column transform (InsertOutputColumAt) and then set the FriendlyExpression (or Expression) custom property on that column (SetOutputColumnProperty). The FriendlyExpression would be something like LEFT([oldcolname], 5) to take the left 5 chars of the [oldcolname] column (assuming the oldcolname column was a string or wstring). You could use the expression property but it isn't as obvious and you need to get the existing column's lineage id (e.g. LEFT(#27, 5) if 27 was oldcolname's lineageid). Additionally, you have to set the virtual input column's usage type (IDTSDesigntimeComponent90::SetUsageType) to read only to tell the dataflow that this component needs to use this column for reading.

HTH,|||I tried this but got following error:

Derived Column [2497]: An error occurred while attempting to perform a type cast.
thanks,
Nitesh Ambastha
nitesh.ambastha@.csfb.com

|||

KirkHaselden wrote:

Looks like ISO 8601 sans the '-' character. You can write a simple derived column expression to parse this out and convert it to a date. Like you say, just retrieve it as a string the new column will be a date.

Here's one way to do it:

(DT_DATE)(SUBSTRING(Date,6,2) + "-" + SUBSTRING(Date,8,2) + "-" + SUBSTRING(Date,1,5))

That will convert a string date column like this:

Date Derived Column 1 20050112 1/12/05 20031122 11/22/03 20050509 5/9/05 20010101 1/1/01 20000301 3/1/00 20021003 10/3/02 20022002 2/20/02 19631003 10/3/63 19621002 10/2/62 20051111 11/11/05


To be more specific, I used the above idea and wrote this expression:
(DT_DATE)(SUBSTRING((YYYYMM + "01"),6,2) + "-" + SUBSTRING((YYYYMM + "01"),8,2) + "-" + SUBSTRING((YYYYMM + "01"),1,5))

This throws a cast exception.
Any suggestions?

thanks,
Nitesh Ambastha
nitesh.ambastha@.csfb.com|||May be the cast error is due to the fact that input YYYYMM can be null or empty string. Can someone suggest a better expression? Or I have to write a script?|||

What do you mean when you say it "throws a cast exception"?

Have you tried entering this expression in the derived column UI to see if it gives an error message?

If you think the input column might be null or empty, you could check that with ISNULL() or LEN() calls first using a conditional operator.

sql

2012年3月19日星期一

FixedHeader JavaScript Bug?

Hi
I have a report with a table containing 26 columns, the tableheader is fixed when scrolling (nice) and I have set the leftmost column to FixedHeader. It is possible via paramters for the user to select which columns that should be visible. But when some columns not are visible then I get a script exception after rendering, 'children.0.style' is null or not an object, resulting in no fixed headers at all.

If I remove som columns so that there is only 18... it works.
Seems lika bug to me?
Where can I supply bug reports, I also have one upgrading bug concerning code page?

Regards

I can take care of getting the issue investigated and verified. Do you have a sample RDL file you can post here? That would be helpful in reproducing the bug.|||

Hi!
Thank You for youre response.
I can send You the .rdl if I only had some way of contact You. I dont want to publish it here.
Look at my profile for my e-mail.

|||

Hi

I too have this same problem.

When i am previewing the rdl file, the header is getting fixed But when

i try to see the report throgh the report viewer from the web page the header is not getting fixed

and i am getting a javascript error children.0.style is null or not an object

Can anybody suggest a way to deal with this problem?

|||

Hi Fredrike

Did you get any solution to fix the header of a rdl file which was showing the javascript error

children.0.style is null or not an object ?

Can you give me some solutions to solve this issue?

my mail id is bikram.mallick@.lntinfotech.com

Thank you

Vikram

|||

There are some fixes to bugs in fixed headers in SP2. Without more details, there is no way I can know if these apply to your situation.

Can you post an rdl file that is causing this problem?

|||

Hi Fredrike

Did you get any solution to fix the header of a rdl file which was showing the javascript error

children.0.style is null or not an object ?

Can you give me some solutions to solve this issue?

my mail adds is it@.foodchina.com.tw

Thank you

Johnny from Taiwan

|||

I have just had the same problem and in my case it appears to have been caused by cells being merged in a row that are across both fixed and scrolling columns. I had to re-design my report so that the cells in the fixed columns are not merged with any that are not fixed, then it worked fine.

|||

Hi, no sorry no fix. No one contacted me and now I have left that customer so... can't send no .rdl.

I hope someone else finds the proper solution and posts here.

Regards

/Fredrike

FixedHeader JavaScript Bug?

Hi
I have a report with a table containing 26 columns, the tableheader is fixed when scrolling (nice) and I have set the leftmost column to FixedHeader. It is possible via paramters for the user to select which columns that should be visible. But when some columns not are visible then I get a script exception after rendering, 'children.0.style' is null or not an object, resulting in no fixed headers at all.

If I remove som columns so that there is only 18... it works.
Seems lika bug to me?
Where can I supply bug reports, I also have one upgrading bug concerning code page?

Regards

I can take care of getting the issue investigated and verified. Do you have a sample RDL file you can post here? That would be helpful in reproducing the bug.|||

Hi!
Thank You for youre response.
I can send You the .rdl if I only had some way of contact You. I dont want to publish it here.
Look at my profile for my e-mail.

|||

Hi

I too have this same problem.

When i am previewing the rdl file, the header is getting fixed But when

i try to see the report throgh the report viewer from the web page the header is not getting fixed

and i am getting a javascript error children.0.style is null or not an object

Can anybody suggest a way to deal with this problem?

|||

Hi Fredrike

Did you get any solution to fix the header of a rdl file which was showing the javascript error

children.0.style is null or not an object ?

Can you give me some solutions to solve this issue?

my mail id is bikram.mallick@.lntinfotech.com

Thank you

Vikram

|||

There are some fixes to bugs in fixed headers in SP2. Without more details, there is no way I can know if these apply to your situation.

Can you post an rdl file that is causing this problem?

|||

Hi Fredrike

Did you get any solution to fix the header of a rdl file which was showing the javascript error

children.0.style is null or not an object ?

Can you give me some solutions to solve this issue?

my mail adds is it@.foodchina.com.tw

Thank you

Johnny from Taiwan

|||

I have just had the same problem and in my case it appears to have been caused by cells being merged in a row that are across both fixed and scrolling columns. I had to re-design my report so that the cells in the fixed columns are not merged with any that are not fixed, then it worked fine.

|||

Hi, no sorry no fix. No one contacted me and now I have left that customer so... can't send no .rdl.

I hope someone else finds the proper solution and posts here.

Regards

/Fredrike

FixedHeader JavaScript Bug?

Hi
I have a report with a table containing 26 columns, the tableheader is fixed when scrolling (nice) and I have set the leftmost column to FixedHeader. It is possible via paramters for the user to select which columns that should be visible. But when some columns not are visible then I get a script exception after rendering, 'children.0.style' is null or not an object, resulting in no fixed headers at all.

If I remove som columns so that there is only 18... it works.
Seems lika bug to me?
Where can I supply bug reports, I also have one upgrading bug concerning code page?

Regards

I can take care of getting the issue investigated and verified. Do you have a sample RDL file you can post here? That would be helpful in reproducing the bug.|||

Hi!
Thank You for youre response.
I can send You the .rdl if I only had some way of contact You. I dont want to publish it here.
Look at my profile for my e-mail.

|||

Hi

I too have this same problem.

When i am previewing the rdl file, the header is getting fixed But when

i try to see the report throgh the report viewer from the web page the header is not getting fixed

and i am getting a javascript error children.0.style is null or not an object

Can anybody suggest a way to deal with this problem?

|||

Hi Fredrike

Did you get any solution to fix the header of a rdl file which was showing the javascript error

children.0.style is null or not an object ?

Can you give me some solutions to solve this issue?

my mail id is bikram.mallick@.lntinfotech.com

Thank you

Vikram

|||

There are some fixes to bugs in fixed headers in SP2. Without more details, there is no way I can know if these apply to your situation.

Can you post an rdl file that is causing this problem?

|||

Hi Fredrike

Did you get any solution to fix the header of a rdl file which was showing the javascript error

children.0.style is null or not an object ?

Can you give me some solutions to solve this issue?

my mail adds is it@.foodchina.com.tw

Thank you

Johnny from Taiwan

|||

I have just had the same problem and in my case it appears to have been caused by cells being merged in a row that are across both fixed and scrolling columns. I had to re-design my report so that the cells in the fixed columns are not merged with any that are not fixed, then it worked fine.

|||

Hi, no sorry no fix. No one contacted me and now I have left that customer so... can't send no .rdl.

I hope someone else finds the proper solution and posts here.

Regards

/Fredrike

FixedHeader JavaScript Bug?

Hi
I have a report with a table containing 26 columns, the tableheader is fixed when scrolling (nice) and I have set the leftmost column to FixedHeader. It is possible via paramters for the user to select which columns that should be visible. But when some columns not are visible then I get a script exception after rendering, 'children.0.style' is null or not an object, resulting in no fixed headers at all.

If I remove som columns so that there is only 18... it works.
Seems lika bug to me?
Where can I supply bug reports, I also have one upgrading bug concerning code page?

Regards

I can take care of getting the issue investigated and verified. Do you have a sample RDL file you can post here? That would be helpful in reproducing the bug.|||

Hi!
Thank You for youre response.
I can send You the .rdl if I only had some way of contact You. I dont want to publish it here.
Look at my profile for my e-mail.

|||

Hi

I too have this same problem.

When i am previewing the rdl file, the header is getting fixed But when

i try to see the report throgh the report viewer from the web page the header is not getting fixed

and i am getting a javascript error children.0.style is null or not an object

Can anybody suggest a way to deal with this problem?

|||

Hi Fredrike

Did you get any solution to fix the header of a rdl file which was showing the javascript error

children.0.style is null or not an object ?

Can you give me some solutions to solve this issue?

my mail id is bikram.mallick@.lntinfotech.com

Thank you

Vikram

|||

There are some fixes to bugs in fixed headers in SP2. Without more details, there is no way I can know if these apply to your situation.

Can you post an rdl file that is causing this problem?

|||

Hi Fredrike

Did you get any solution to fix the header of a rdl file which was showing the javascript error

children.0.style is null or not an object ?

Can you give me some solutions to solve this issue?

my mail adds is it@.foodchina.com.tw

Thank you

Johnny from Taiwan

|||

I have just had the same problem and in my case it appears to have been caused by cells being merged in a row that are across both fixed and scrolling columns. I had to re-design my report so that the cells in the fixed columns are not merged with any that are not fixed, then it worked fine.

|||

Hi, no sorry no fix. No one contacted me and now I have left that customer so... can't send no .rdl.

I hope someone else finds the proper solution and posts here.

Regards

/Fredrike