Home » Developer & Programmer » Reports & Discoverer » single line with word wrap in reports filed (reports 10g)
single line with word wrap in reports filed [message #405612] Thu, 28 May 2009 11:04 Go to next message
nastyjillu
Messages: 211
Registered: February 2009
Senior Member
Hi,

i have a requirement.

in my report, there is a description field. that field may have value with 10 lines also.
but i want to display only one line and that too with word wrap.
if iam in the middle of the word at the end of the line, then it shouldnt display the whole word.

i didnt find any word wrap property in report fields.
i didnot find multi line 'yes/no' property also. in forms we have thse properties. not in reports.

thanks
jillu
Re: single line with word wrap in reports filed [message #405639 is a reply to message #405612] Thu, 28 May 2009 14:36 Go to previous messageGo to next message
Littlefoot
Messages: 21808
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Perhaps you could set field's Vertical Elasticity property to "Variable" or "Expand". It would also take care about word wrapping.
Re: single line with word wrap in reports filed [message #405643 is a reply to message #405639] Thu, 28 May 2009 16:58 Go to previous messageGo to next message
nastyjillu
Messages: 211
Registered: February 2009
Senior Member
it takes care of word wrap, but what about single line?? i wanted to display only single line.

do i have to write code in format triggers such that it gets only one line with word wrapped???
Re: single line with word wrap in reports filed [message #405677 is a reply to message #405643] Fri, 29 May 2009 00:27 Go to previous messageGo to next message
Littlefoot
Messages: 21808
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
If you want to display only one line, set field's vertical and horizontal elasticities to "fixed". It will then truncate text that doesn't fit. Though, how can you wrap a word in a single line? If it is wrapped, it then makes at least 2 lines, not 1.

Trigger? What good would it do? A "single line" can be obtained by selecting a SUBSTRING of the text. However, if you choose proportional font (such as Arial or Times New Roman), you can't tell exactly how many letters make one line. Furthermore, it means that non-proportional font might be the right choice (such as Courier, for example).

However, someone might get another, better idea. Wait and see.
Re: single line with word wrap in reports filed [message #406033 is a reply to message #405677] Mon, 01 June 2009 18:18 Go to previous messageGo to next message
nastyjillu
Messages: 211
Registered: February 2009
Senior Member
i got an idea. i wrote a function. that will take the column_name as input. and gives the single line with word wrap as output.
lets suppose that i have only 47 chars in a horizontal line in a report. that we can easily predict. as horizontal line is fixed.

see the function below.

CREATE OR REPLACE function xxtempfunction(m in varchar2)
return varchar2 is
i number;
j varchar2(200);
k number;
l number;
begin
select length(m) into l from dual;
if l<47 then
return(m);
for i in 1..47
loop
select substr(m,i,1) into j from dual;
if j=' ' then
k:=i;
end if;
if i=47 then
  if  j=' ' then
       select substr(m,1,i-1) into j from dual;
    else
       select substr(m,1,k) into j from dual;
  end if;
end if;
end loop;
return(j);
end if;
end;
/


i will call this function in select query in report builder, and pass column name as input parameter. this works fine.

but this is a database function. i want to create funtion in program unit section of report builder.

if i do that, iam getting below error. my select query is as given below. XX is the funtion given above that i created in report builder.

select xx('b') from xxtemp
where a=5;

error is:

ora-00904:"XX" invalid identifier
select ==>xx('b') from xxtemp.


Re: single line with word wrap in reports filed [message #406055 is a reply to message #406033] Tue, 02 June 2009 00:08 Go to previous messageGo to next message
Littlefoot
Messages: 21808
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Quote:
lets suppose that i have only 47 chars in a horizontal line in a report. that we can easily predict. as horizontal line is fixed.
Right, but only if you use non-proportional font.

Quote:
ora-00904:"XX" invalid identifier
You can't use it in query SELECT statement - create a formula column which will return value of your function.
Re: single line with word wrap in reports filed [message #406349 is a reply to message #406055] Wed, 03 June 2009 09:17 Go to previous messageGo to next message
nastyjillu
Messages: 211
Registered: February 2009
Senior Member
yes. i wanted to try formula. but couldnot. can you please give me an example about how to use the formula column ??

thanks
Re: single line with word wrap in reports filed [message #406434 is a reply to message #406349] Thu, 04 June 2009 00:47 Go to previous messageGo to next message
Littlefoot
Messages: 21808
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Quote:
i wanted to try formula. but couldnot.
Why not? What prevented you to do that? It is available in the data model layout editor's toolbar.

You have created a function (its code is in one of the previous messages). Now create a formula column which will return value of that function.
Re: single line with word wrap in reports filed [message #406547 is a reply to message #406434] Thu, 04 June 2009 09:26 Go to previous messageGo to next message
nastyjillu
Messages: 211
Registered: February 2009
Senior Member
so basically i have to create a placeholders column. for example placeholder column is c_p.

i should put this in the group where i have other columns.

and in the formula coulmn i have to assign the output of the function to this place holder right??

for example

in formula column i will write below code.

function cf return char is
begin
select xxtempfunction(b) into :c_p from table_name;
end;



is this correct??
Re: single line with word wrap in reports filed [message #406575 is a reply to message #406547] Thu, 04 June 2009 12:33 Go to previous messageGo to next message
nastyjillu
Messages: 211
Registered: February 2009
Senior Member
i got it.
i created function called xx

then created formula column called c_f, and placeholder column called cp_1

code in formula column is

function CF_1FORMULA0005 return Char is
l varchar2(2000);
begin
  select c.b into l from table_a ci, table_b LA
  WHERE LA.ID = :P_ID
AND LA.L_CODE = :P_CODE
AND LA.CID = CI.ID;
  :cp_1:=XX(l,92);
  return(:cp_1);
end;


assigned cp_q1 to the group.

this works .

have one more question. if the description is hard returned, then???????/

i would be loosing data simply.

how to get the value in next line, if it is hard returned??

for example, my desc is

the item is
valueable.preserve it


i want the whole thing in one line. as there is still empty space in the first line.

hope you understood

thanks
jillu
Re: single line with word wrap in reports filed [message #406595 is a reply to message #406575] Thu, 04 June 2009 16:30 Go to previous messageGo to next message
nastyjillu
Messages: 211
Registered: February 2009
Senior Member
got this too. i can use replace and chr(10).

example:

select replace('this is
jillu',chr(10)) from dual; will remove carriage return where 'this is' and 'jillu' were in 2 different lines
Re: single line with word wrap in reports filed [message #407630 is a reply to message #406595] Wed, 10 June 2009 19:04 Go to previous messageGo to next message
nastyjillu
Messages: 211
Registered: February 2009
Senior Member
Hi, i was wondering about why iam not able to make use of function created in report.

i created a function in the program units section of the report.

and iam using that function in the datamodel query. but it thrws below error :

ORA-00904:"XX_DSC":invalid identifier
SELECT DISTINCT(C.ID),==>
XX_DSC(C.DESC,90)
FROM C_ITMS C,L_ADDS L


XX_DSC is the function. it takes column value and a number. and returns the single line value with word wrap.


if i create the same function in the database, then the report is working fine.
why not with the report builder function??

thanks jillu



Re: single line with word wrap in reports filed [message #407787 is a reply to message #407630] Thu, 11 June 2009 10:47 Go to previous messageGo to next message
nastyjillu
Messages: 211
Registered: February 2009
Senior Member
i got the solution in metalink

[B]ORA-00904 Error When Try To Call Local Function In Report SQL Query[/B]

[B]Cause[/B]
The only things you can reference in a SQL query are columns and functions accessible in the
database (since this is where the query is executed).

[B]Solution[/B]
You need to create the function in the database.


thanks
jillu
Re: single line with word wrap in reports filed [message #407811 is a reply to message #407787] Thu, 11 June 2009 13:19 Go to previous messageGo to next message
Littlefoot
Messages: 21808
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Another workaround is to create a function in a report (as you did); don't call it in query, but create a formula column which will then call this function and return value into report.
Re: single line with word wrap in reports filed [message #407990 is a reply to message #407811] Fri, 12 June 2009 14:35 Go to previous message
nastyjillu
Messages: 211
Registered: February 2009
Senior Member
yes we can do that too
Previous Topic: wasp128 barcode issue
Next Topic: How to run report 10g
Goto Forum:
  


Current Time: Fri Apr 26 00:49:09 CDT 2024