Home » Developer & Programmer » Reports & Discoverer » Problem While Creating Excel (because of CHR(44))
Problem While Creating Excel (because of CHR(44)) [message #478079] |
Wed, 06 October 2010 01:59 |
swapnil_naik
Messages: 269 Registered: December 2009 Location: Mumbai
|
Senior Member |
|
|
[Topics merged by LF, as it appears that both discuss the same problem.]
Hello I creating a report in excel format...
But there is one problem which i shown in colour when excel created.... i dont know why this problem come..
Here i m attched my .fmb file and excel sheet [When i run my form].....
please let me know why this problem comes????
My Code is :
When Excel Button pressed
PROCEDURE EXCEL_P IS
cursor c1 is
select distinct BPT_DOC_DT BNP_REF_DT, BPT_DOC_NO BNP_REF_NO,
BPT_VEN_NM Vendor_Name,
BPT_BIL_NO Bill_No, BPT_BIL_DT Bill_Date ,
BPT_CNTRCT_CD CONTRACT_NO,
BPT_NET_VOU Total_Amount,
DECODE(BPT_BAS_RT, NULL, BPT_BIL_RT, BPT_BAS_RT) Basic_Amt,
BPT_SAL_RT VAT_AMOUNT,
BPT_SAL_CLU VAT_Rate ,
B.VMT_VAT_NO vendor_tin_no,
(B.VMT_VNDR_ADDR1 ||','|| B.VMT_VNDR_ADDR2||','||VMT_VNDR_ADDR3 ||','|| B.VMT_VNDR_ADDR4 ||','|| B.VMT_VNDR_ADDR5)
Vendor_address
FROM BILL_HDR1_TAB , VNDR_MST1_TAB B
WHERE BPT_LOC = :BLK_ENTER.LOC
AND BPT_VEN_CD = B.VMT_VNDR_CD
AND TO_DATE(BPT_DOC_DT, 'DD-MON-RRRR') > TO_DATE('01-apr-'||:BLK_ENTER.FYYEAR,'DD-MON-RRRR')
AND TO_DATE(BPT_BIL_DT, 'DD-MON-RRRR') <= TO_DATE('31-MAR-'||:BLK_ENTER.FYYEAR,'DD-MON-RRRR')
order by BPT_doc_DT ;
FILE_PTR CLIENT_TEXT_IO.FILE_TYPE;-------capture only text data
tot number := 0;
begin
FILE_PTR:= CLIENT_TEXT_IO.FOPEN(:FILENAME,'w');---w window , chr(44)-Delimeter comma separated
CLIENT_TEXT_IO.NEW_LINE(FILE_PTR);------space
client_text_io.put_line(file_ptr,'Location: '||:BLK_ENTER.LOC);
client_text_io.new_line(file_ptr);
client_text_io.put_line(file_ptr,'Financial Year is '||:BLK_ENTER.FYYEAR);
client_text_io.new_line(file_ptr);
client_text_io.put_line(file_ptr,'BNP REF DATE'||CHR(44)||'BNP REF NO.'||CHR(44)||'VENDOR NAME'||CHR(44)||'BILL NO'||CHR(44)||'BILL DATE'||CHR(44)||'CONTRACT NO'||CHR(44)||'TOT AMOUNT'||CHR(44)||'BASIC AMT'||CHR(44)||'VAT AMT'||CHR(44)||'VAT RATE'||CHR(44)||'VENDOR TIN NO'||CHR(44)||'VENDOR ADDRESS');
client_text_io.new_line(file_ptr);
-- message('4');
FOR I IN c1
LOOP
EXIT WHEN c1%NOTFOUND;
-- synchronize;
CLIENT_TEXT_IO.PUT_LINE(FILE_PTR,I.BNP_REF_DT||chr(44)||I.BNP_REF_NO||chr(44)||I.Vendor_Name||chr(44)||I.Bill_No||chr(44)||I.Bill_Dat e||CHR(44)||I.CONTRACT_NO||CHR(44)||I.Total_Amount||CHR(44)||I.Basic_Amt||CHR(44)||I.VAT_AMOUNT||CHR(44)||I.VAT_Rate||CHR(44)||I.vend or_tin_no||CHR(44)||REPLACE(I.Vendor_address,',',' '));
tot := tot + 1 ;
synchronize;
END LOOP ;
client_text_io.new_line(file_ptr);
client_text_io.put_line(file_ptr,' '||chr(44)||'Total No. of Bill Booked ' || chr(44)||tot);
IF c1%ISOPEN THEN
CLOSE c1;
END IF;
synchronize;
CLIENT_TEXT_IO.FCLOSE(FILE_PTR);
message(' The File'||:FILENAME||'has been generated successfully');
END;
-
Attachment: swapnil2.csv
(Size: 14.74KB, Downloaded 1808 times)
[Updated on: Fri, 08 October 2010 03:11] by Moderator Report message to a moderator
|
|
|
|
|
|
|
|
Re: Problem While Creating Excel [message #478205 is a reply to message #478204] |
Thu, 07 October 2010 01:58 |
cookiemonster
Messages: 13962 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
Best guess - the vendor_name on the line before has a carriage return or other special character in it that's causing the problem.
Use the dump funciton to find out what's actually in there.
|
|
|
|
|
Re: Problem While Creating Excel [message #478214 is a reply to message #478208] |
Thu, 07 October 2010 03:40 |
swapnil_naik
Messages: 269 Registered: December 2009 Location: Mumbai
|
Senior Member |
|
|
That means may i use CHR(31) insted of CHR(44)...
I Use dump for thsi record i get following result for vendor name
11 5/13/2009 1090100121 TRAVEL CORPORATION (INDIA) LTD.
33/412/00225 Typ=1 Len=31: 84,82,65,86,69,76,32,67,79,82,80,79,82,65,84,73,79,78,32,40,73,78,68,73,65,41,32,76,84,68,46
|
|
|
Re: Problem While Creating Excel [message #478215 is a reply to message #478214] |
Thu, 07 October 2010 04:15 |
cookiemonster
Messages: 13962 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
I doubt you want to use CHR(31) not sure what it does. I'd stick with ch4(44) personally.
I can't see anything obvious in the dump output either.
You're just going to have to debug this.
Limit the query to just retrieve the one record we're looking at and see if it gets split over two lines.
If it does output the line to a text item in the form rather than write it to a file so you can see what is in it.
If necessary remove columns to isolate which one is causing the problem.
|
|
|
|
Re: Problem While Creating Excel [message #478218 is a reply to message #478216] |
Thu, 07 October 2010 04:46 |
swapnil_naik
Messages: 269 Registered: December 2009 Location: Mumbai
|
Senior Member |
|
|
As per your suggestion , i check this code for sing le line wheer i stuck ..
i get rsult..
1 5/13/2009 1090100121 TRAVEL CORPORATION (INDIA) LTD.
Typ=1 Len=32: 84,82,65,86,69,76,32,67,79,82,80,79,82,65,84,73,79,78,32,40,73,78,68,73,65,41,32,76,84,68,46,10 33/412/00225 Typ=1 Len=12: 51,51,47,52,49,50,47,48,48,50,50,53 3/12/2009 1465.00 1465 65-PURCHASE FORM TAX FREE 999 CHANDER MUKHI, 1ST FLOOR,,NARIMAN POINT, MUMBAI - 400 021.,,,
Bold line ascii value define new line ..
How to suppress this value from my data...is any function used for this field...so i replace this value...
|
|
|
|
|
|
Excel Convesion Pblm Because of chr(44) [message #478234 is a reply to message #478079] |
Thu, 07 October 2010 06:14 |
swapnil_naik
Messages: 269 Registered: December 2009 Location: Mumbai
|
Senior Member |
|
|
There is one example where i taken dump of that field...
I get result this way
My Query is like this
select distinct BPT_DOC_DT BNP_REF_DT, BPT_DOC_NO BNP_REF_NO,
BPT_VEN_NM Vendor_Name,
replace(BPT_BIL_NO,',','.') Bill_No,dump( BPT_BIL_NO), BPT_BIL_DT Bill_Date ,
BPT_CNTRCT_CD CONTRACT_NO,
BPT_NET_VOU Total_Amount,
DECODE(BPT_BAS_RT, NULL, BPT_BIL_RT, BPT_BAS_RT) Basic_Amt,
BPT_SAL_RT VAT_AMOUNT,
BPT_SAL_CLU VAT_Rate ,
B.VMT_VAT_NO vendor_tin_no,
(B.VMT_VNDR_ADDR1 ||','|| B.VMT_VNDR_ADDR2||','||VMT_VNDR_ADDR3 ||','|| B.VMT_VNDR_ADDR4 ||','|| B.VMT_VNDR_ADDR5)
Vendor_address
FROM BILL_HDR1_TAB , VNDR_MST1_TAB B
WHERE BPT_LOC = '01'
AND BPT_VEN_CD = B.VMT_VNDR_CD
AND TO_DATE(BPT_DOC_DT, 'DD-MON-RRRR') > TO_DATE('01-apr-'||2009,'DD-MON-RRRR')
AND TO_DATE(BPT_BIL_DT, 'DD-MON-RRRR') <= TO_DATE('31-MAR-'||2009,'DD-MON-RRRR')
AND BPT_DOC_NO = '1090100097'
order by BPT_doc_DT
I only show output that bold bold line
O/P Like this
BILL_NO DUMP(BPT_BIL_NO)
MAR.,09 Typ=1 Len=7: 77,65,82,46,44,48,57
Because of 44 in Dump(BPT_BIL_NO)...My Excel convesrion somehow wrong...how to replace this code....
|
|
|
|
|
|
Re: Excel Convesion Pblm Because of chr(44) [message #478337 is a reply to message #478336] |
Thu, 07 October 2010 23:30 |
swapnil_naik
Messages: 269 Registered: December 2009 Location: Mumbai
|
Senior Member |
|
|
I did as you say..but
still geeting a problem for one row only..
cursor c1 is
select distinct "BPT_DOC_DT" BNP_REF_DT, "BPT_DOC_NO" BNP_REF_NO,
"BPT_VEN_NM" Vendor_Name,
"BPT_BIL_NO" Bill_No, "BPT_BIL_DT" Bill_Date ,
"BPT_CNTRCT_CD" CONTRACT_NO,
"BPT_NET_VOU" Total_Amount,
DECODE(BPT_BAS_RT, NULL, BPT_BIL_RT, BPT_BAS_RT) Basic_Amt,
"BPT_SAL_RT" VAT_AMOUNT,
"BPT_SAL_CLU" VAT_Rate ,
B.VMT_VAT_NO vendor_tin_no,
(B.VMT_VNDR_ADDR1 ||','|| B.VMT_VNDR_ADDR2||','||VMT_VNDR_ADDR3 ||','|| B.VMT_VNDR_ADDR4 ||','|| B.VMT_VNDR_ADDR5)
Vendor_address
FROM BILL_HDR1_TAB , VNDR_MST1_TAB B
WHERE BPT_LOC = :BLK_ENTER.LOC
AND BPT_VEN_CD = B.VMT_VNDR_CD
AND TO_DATE(BPT_DOC_DT, 'DD-MON-RRRR') > TO_DATE('01-apr-'||:BLK_ENTER.FYYEAR,'DD-MON-RRRR')
AND TO_DATE(BPT_BIL_DT, 'DD-MON-RRRR') <= TO_DATE('31-MAR-'||:BLK_ENTER.FYYEAR,'DD-MON-RRRR')
-- AND BPT_DOC_NO = '1090100121'
order by BPT_doc_DT ;
|
|
|
|
|
Re: Excel Convesion Pblm Because of chr(44) [message #478358 is a reply to message #478343] |
Fri, 08 October 2010 03:40 |
cookiemonster
Messages: 13962 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
Scroll up to my example.
Read it.
Compare it to what you've done.
Correct what you've done so that it actually looks like what I said.
And will you please start using [code] tags. I've asked you to do this already.
|
|
|
|
|
|
Goto Forum:
Current Time: Tue Jan 21 20:48:21 CST 2025
|