Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » Empty flat files
Empty flat files [message #525651] Wed, 07 April 2010 11:32 Go to next message
Helmut Neubauer is currently offline Helmut NeubauerFriend
Messages: 54
Registered: July 2009
Member
Hello,

I have some empty flat files as data sets (sometimes there is no data
there) and I'm getting a "The flatfile data source is not valid"
message. How can I get the empty data set?

By the way, I'm also using a beforeOpen script to parameterize the flat
file name.

Please help. Thanks, Helmut
Re: Empty flat files [message #525804 is a reply to message #525651] Wed, 07 April 2010 20:01 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Helmut,

Do you have headers in the flat files that have data? One option would
be to check the file size in the beforeOpen, then if the size is 0 swap
in a dummy flat file with data that can be filtered out using a
dataset/table filter.

importPackage(Packages.java.ip);
tstfile = new File(yourfullpathfilename);
if(tstfile.exists()){
fsize = tstfile.length();
if( fsize == 0 ){
//do something;
}else{
//do something else;
}
}

Jason

Helmut Neubauer wrote:
> Hello,
>
> I have some empty flat files as data sets (sometimes there is no data
> there) and I'm getting a "The flatfile data source is not valid"
> message. How can I get the empty data set?
>
> By the way, I'm also using a beforeOpen script to parameterize the flat
> file name.
>
> Please help. Thanks, Helmut
Re: Empty flat files [message #525988 is a reply to message #525804] Thu, 08 April 2010 13:13 Go to previous messageGo to next message
Helmut Neubauer is currently offline Helmut NeubauerFriend
Messages: 54
Registered: July 2009
Member
Jason,

thanks for your answer. I think it will help :).

I tried to use headers. Than BIRT doesn't filter this headers. How can I
filter this header using a scripted query? If I don't use scripting
sometimes BIRT displays the header in the preview, sometimes not. I
wasn't able to see the reason, yet. Can you tell me?

Ok, checking the file size is an ugly way, but I will try this. Perhaps
there will be a better way in future.

Helmut

Jason Weathersby schrieb:
> Helmut,
>
> Do you have headers in the flat files that have data? One option would
> be to check the file size in the beforeOpen, then if the size is 0 swap
> in a dummy flat file with data that can be filtered out using a
> dataset/table filter.
>
> importPackage(Packages.java.ip);
> tstfile = new File(yourfullpathfilename);
> if(tstfile.exists()){
> fsize = tstfile.length();
> if( fsize == 0 ){
> //do something;
> }else{
> //do something else;
> }
> }
>
> Jason
>
> Helmut Neubauer wrote:
>> Hello,
>>
>> I have some empty flat files as data sets (sometimes there is no data
>> there) and I'm getting a "The flatfile data source is not valid"
>> message. How can I get the empty data set?
>>
>> By the way, I'm also using a beforeOpen script to parameterize the flat
>> file name.
>>
>> Please help. Thanks, Helmut
Re: Empty flat files [message #526035 is a reply to message #525988] Thu, 08 April 2010 14:50 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Helmut,

I tried this with BIRT 2.5.2 and only got the error if the headers where
not present. So if you flat files always have a header then you should
not get an error if no data is in the flat file.

Jason

Helmut Neubauer wrote:
> Jason,
>
> thanks for your answer. I think it will help :).
>
> I tried to use headers. Than BIRT doesn't filter this headers. How can I
> filter this header using a scripted query? If I don't use scripting
> sometimes BIRT displays the header in the preview, sometimes not. I
> wasn't able to see the reason, yet. Can you tell me?
>
> Ok, checking the file size is an ugly way, but I will try this. Perhaps
> there will be a better way in future.
>
> Helmut
>
> Jason Weathersby schrieb:
>> Helmut,
>>
>> Do you have headers in the flat files that have data? One option would
>> be to check the file size in the beforeOpen, then if the size is 0 swap
>> in a dummy flat file with data that can be filtered out using a
>> dataset/table filter.
>>
>> importPackage(Packages.java.ip);
>> tstfile = new File(yourfullpathfilename);
>> if(tstfile.exists()){
>> fsize = tstfile.length();
>> if( fsize == 0 ){
>> //do something;
>> }else{
>> //do something else;
>> }
>> }
>>
>> Jason
>>
>> Helmut Neubauer wrote:
>>> Hello,
>>>
>>> I have some empty flat files as data sets (sometimes there is no data
>>> there) and I'm getting a "The flatfile data source is not valid"
>>> message. How can I get the empty data set?
>>>
>>> By the way, I'm also using a beforeOpen script to parameterize the flat
>>> file name.
>>>
>>> Please help. Thanks, Helmut
Re: Empty flat files (+additional question concerning CSV flat file queries with column names) [message #526561 is a reply to message #526035] Mon, 12 April 2010 09:44 Go to previous messageGo to next message
Helmut Neubauer is currently offline Helmut NeubauerFriend
Messages: 54
Registered: July 2009
Member
Jason,

thanks, this works!

First I forgot to check "Use first line as column name indicator" in the
edit data source dialog. So BIRT told me the flat file data source isn't
valid even if I was using the headers. Now all is ok :).

Perhaps one more question, because I use headers the first time in my
CSV files in combination with BIRT: In the past I was scripting my CSV
queries like (found an example in the newsgroups, which I understand
only partially):

queryText= "select \"COLUMN_1\", \"COLUMN_2\" " +
"from " +
params["id"].value + "-1.csv" +
" : {\"COLUMN_1\",\"COLUMN_1\",DATE;\"COLUMN_2\",\"COLUMN_2\ ",INTEGER}";

Now BIRT tells me this isn't ok. I think, because I don't use the
correct names (headers). Where Do I have to use the column names? Can
you explain me how to use the flat file queries?

Thanks,
Helmut

Jason Weathersby schrieb:
> Helmut,
>
> I tried this with BIRT 2.5.2 and only got the error if the headers where
> not present. So if you flat files always have a header then you should
> not get an error if no data is in the flat file.
>
> Jason
>
> Helmut Neubauer wrote:
>> Jason,
>>
>> thanks for your answer. I think it will help :).
>>
>> I tried to use headers. Than BIRT doesn't filter this headers. How can I
>> filter this header using a scripted query? If I don't use scripting
>> sometimes BIRT displays the header in the preview, sometimes not. I
>> wasn't able to see the reason, yet. Can you tell me?
>>
>> Ok, checking the file size is an ugly way, but I will try this. Perhaps
>> there will be a better way in future.
>>
>> Helmut
>>
>> Jason Weathersby schrieb:
>>> Helmut,
>>>
>>> Do you have headers in the flat files that have data? One option would
>>> be to check the file size in the beforeOpen, then if the size is 0 swap
>>> in a dummy flat file with data that can be filtered out using a
>>> dataset/table filter.
>>>
>>> importPackage(Packages.java.ip);
>>> tstfile = new File(yourfullpathfilename);
>>> if(tstfile.exists()){
>>> fsize = tstfile.length();
>>> if( fsize == 0 ){
>>> //do something;
>>> }else{
>>> //do something else;
>>> }
>>> }
>>>
>>> Jason
>>>
>>> Helmut Neubauer wrote:
>>>> Hello,
>>>>
>>>> I have some empty flat files as data sets (sometimes there is no data
>>>> there) and I'm getting a "The flatfile data source is not valid"
>>>> message. How can I get the empty data set?
>>>>
>>>> By the way, I'm also using a beforeOpen script to parameterize the flat
>>>> file name.
>>>>
>>>> Please help. Thanks, Helmut
Re: Empty flat files (+additional question concerning CSV flat file queries with column names) [message #526696 is a reply to message #526561] Mon, 12 April 2010 15:48 Go to previous message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Helmut

The column names must match what you have in the flat file, unless you
are not using the first line for headers. Ie you should have something
like:
COLUMN_1,COLUMN_2
111,222
..
..

In your flat file.
The query text just has the column names that you are selecting and from
which flatfile. After the : is a list of each column available in the
flat file. These will be in the {} and separated by ;. Each column
will have name alias and type separated by ,.

Jason

Helmut Neubauer wrote:
> Jason,
>
> thanks, this works!
>
> First I forgot to check "Use first line as column name indicator" in the
> edit data source dialog. So BIRT told me the flat file data source isn't
> valid even if I was using the headers. Now all is ok :).
>
> Perhaps one more question, because I use headers the first time in my
> CSV files in combination with BIRT: In the past I was scripting my CSV
> queries like (found an example in the newsgroups, which I understand
> only partially):
>
> queryText= "select \"COLUMN_1\", \"COLUMN_2\" " +
> "from " +
> params["id"].value + "-1.csv" +
> " : {\"COLUMN_1\",\"COLUMN_1\",DATE;\"COLUMN_2\",\"COLUMN_2\ ",INTEGER}";
>
> Now BIRT tells me this isn't ok. I think, because I don't use the
> correct names (headers). Where Do I have to use the column names? Can
> you explain me how to use the flat file queries?
>
> Thanks,
> Helmut
>
> Jason Weathersby schrieb:
>> Helmut,
>>
>> I tried this with BIRT 2.5.2 and only got the error if the headers where
>> not present. So if you flat files always have a header then you should
>> not get an error if no data is in the flat file.
>>
>> Jason
>>
>> Helmut Neubauer wrote:
>>> Jason,
>>>
>>> thanks for your answer. I think it will help :).
>>>
>>> I tried to use headers. Than BIRT doesn't filter this headers. How can I
>>> filter this header using a scripted query? If I don't use scripting
>>> sometimes BIRT displays the header in the preview, sometimes not. I
>>> wasn't able to see the reason, yet. Can you tell me?
>>>
>>> Ok, checking the file size is an ugly way, but I will try this. Perhaps
>>> there will be a better way in future.
>>>
>>> Helmut
>>>
>>> Jason Weathersby schrieb:
>>>> Helmut,
>>>>
>>>> Do you have headers in the flat files that have data? One option would
>>>> be to check the file size in the beforeOpen, then if the size is 0 swap
>>>> in a dummy flat file with data that can be filtered out using a
>>>> dataset/table filter.
>>>>
>>>> importPackage(Packages.java.ip);
>>>> tstfile = new File(yourfullpathfilename);
>>>> if(tstfile.exists()){
>>>> fsize = tstfile.length();
>>>> if( fsize == 0 ){
>>>> //do something;
>>>> }else{
>>>> //do something else;
>>>> }
>>>> }
>>>>
>>>> Jason
>>>>
>>>> Helmut Neubauer wrote:
>>>>> Hello,
>>>>>
>>>>> I have some empty flat files as data sets (sometimes there is no data
>>>>> there) and I'm getting a "The flatfile data source is not valid"
>>>>> message. How can I get the empty data set?
>>>>>
>>>>> By the way, I'm also using a beforeOpen script to parameterize the flat
>>>>> file name.
>>>>>
>>>>> Please help. Thanks, Helmut
Previous Topic:Birt word wrap
Next Topic:Render report as image?
Goto Forum:
  


Current Time: Tue Sep 24 00:46:24 GMT 2024

Powered by FUDForum. Page generated in 0.03372 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top