Need pattern to display negative value in red
I am having one xdp form which contains multiples objects having some textfields mapped with some xsd.
requirement is if values is negative need to display it in red color as "-$18,970.50"
currently it is getting displayed as "$-18,970.50"
I have used pattern num{$z,zzz,zz9.99}
Is any ready made format available for this?
Your requirement ("-$18,970.50") is not so common and may have to do major changes to meet this....I will start using a textField rather than a NumberField and Format using scripting not using out of box functionality. Changing text color to red is easy and can be easily done using scripting again.
I am sure you can try your self if you have some idea about JS or FC scripting....I can help you if you post additional requirements.....like...
1. Is the value prefilled / keyed in / calculated from other fields or combination of one or more?
2. Max and Min value allowed/ expected.
3. Any involvement of user actions there on?
Similar Messages
-
Hi SDNers,
We are on BI 7.0 SP 16.
We have created custom Web Templates for our customer and are using Portal Themes to control the "look & feel" of the Web Reports, which are presented via the Consumer portal (not BI Portal but EP Portal).
My Question is : Is there a way to show negative values in Red Font color (we are not talking about background cell colour for negative values as RED which can be acheived by exception reporting).
The Reports are presented on WEB via EP Portal ,so no excel here...
Any suggestions will be appreciated.
Thanks
TCHi Tony,
Suggestion of code in method DATA_CELL will be below:. The only thing is that below code is doing a left justification instead of displaying in red. You will need to find out how to display in red in HTML and replace it in the codes. Hope it help.
l_value type i,
l_replace type string,
l_new type string,
l_txt(20),
l_valn(20).
move i_value to l_value.
if l_value lt 0.
write l_value to l_valn left-justified.
concatenate '>' l_valn '<' into l_replace.
condense l_replace no-gaps.
concatenate 'style="float:left;" ' '>' l_txt '<' into l_new. " replace value and left justify text
condense l_new no-gaps.
replace l_replace in c_cell_content with l_new.
endif.
Regards
Kate -
Negative values in red and Positive values in black CONDITIONAL FORMATTING
Hi ... Everyone
I have to show Negative values in red and Positive values in black in one of my report.
i tried these conditions
1. <?if:GAIN<0.00?><?attribute@inlines:color;'red'?><?end if?>
but it shows negative values only in red ,positive values in black are missing
2. <?if:GAIN<0.00?><?attribute@incontext:color;'red'?><?end if?><?if:GAIN>0.00?><?attribute@incontext:color;'black'?><?end if?>
This gives the exact result what i wanted ...but the problem is i have five tables in my report ... so the above condition only allow changes in ONE TABLE ONLY. :(
Plzzzz anyone who can help me to sort out my problem or else SUGGEST ANOTHER WORKING CONDITION
Regards
Subham MittalSubham,
This should not be difficult and moreover the BI Publisher Desktop installation comes with a set of examples:
Start -> Programs -> BI Publisher Desktop -> Samples -> RTF Templates -> Advanced -> Conditional
There you can find two templates with the exact same situation like yours, highlighting either the foreground color or background color.
regards
Jorge -
How to display negative values in a screen field of a screen
Hi All,
Please let me know how to display negative values in a screen field of a screen.
thanksHi Kishore,
You can do this method. In the screen , create a text field of CHAR instead fo creating an INT4 field.
I have created a field of CHAR of name say TEXT.
In the main program,
declare a variable of the same name ie. TEXT.
data: TEXT(5) TYPE C.
In PBO, just assign the negative values.
It will work.Since there is automatic conversion between character and integer data types, it will work for positive values as well.
Regards,
Sylendra. -
WebLogic 9.2MP2.Messages Pending topic count JMS display negative value
on admin console. Services -> Messaging -> JMS Modules in JMS System Modules -> JMS queue name -> Monitoring role tab .
I use WebLogic 9.2MP2 version . I found that JMS destination summaize page, Messages Pending topic count display negative value.
What is mean negative value ? or that bug of WebLogic9.2 MP2.
Thank you.
BR,A negative value indicates a bug -- quite likely in internal statistics gathering code itself. I don't know if the problem has been addressed in later MPs or later versions.
Tom -
Set Negative values in red color
Hi, i want to set the negative values in the table in the red color.I have created the table dynamically.So i have created a context node called "ColorData" and in that i created a context attribute "grossSemantic". I have set the type of this attribute as "com.sap.ide.webdynpro.uielementdefinitions.TextViewSemanticColor" .And i have written the below code.
But there is no effect at all. Where am i going wrong? Please suggest.
String color = "ColorData";
IPrivate<ViewName>.IColorDataNode colorNode = wdContext.nodeColorData();
IPrivate<ViewName>.IColorDataElement colorElem = colorNode.createColorDataElement();
for(int flag = 0; flag < wdContext.node<BapiNodeName>.size(); flag++){
IPrivate<ViewName>.I<BapiNodeElement> tableElem = bapiNode.get<BapiElement>(flag);
if(tableElem.get<ColumnName()>.signum() == -1){
editor.bindDesign(color "." "grossSemantic");
colorElem.setGrossSemantic(WDTextViewSemanticColor.NEGATIVE);
column.setTableCellEditor(editor);
Regards,
Padmalatha.KSay the table data source is named "Rows".
Add a calculated context attribute "color" of type TextViewSemanticColor to node "Rows" (or an 1:1 subnode if needed).
Bind the table cell editor (TextView) property "semanticColor" to attribute "color".
Implement calculated attribute as
WDTextViewSemanticColor getRowsColor(..., IRowsElement element)
return element.getSign() == -1 : WDTextViewSemanticColor.NEGATIVE : WDTextViewSemanticColor.STANDARD;
Armin -
Dvt:gauge StatusMeter displaying negative value strangely
Hi,
I'm creating a number of dvt:gauge components to display some retrieved numeric values. My aesthetic preference is to use the STATUSMETER gauge type. The values to be displayed vary greatly in scale and may be positive or negative. As a result I'm letting Oracle determine the best Min and Max values for the gauge(s).
The problem is that when a negative value is displayed, the status bar is still shown starting from left to right. This looks quite odd to our users as we would expect the bar to start at 0 (zero) and move from right to left. Currently it looks as if the value starts at an arbitrary negative value and is moving towards zero...?!
I've tried configuring the Min and Max values myself with no joy. Are there some additional attributes that I'm missing that enable the Status Meter to be shown in a more sensible way? Thanks.
FYI. I'm using JDeveloper Studio Edition Version 11.1.2.1.0.Hi,
Any help on this would be really appreciated.
Thanks. -
Need Help: Dynamically displaying parameter values for a procedure.
Problem Statement: Generic Code should display the parameter values dynamically by taking "package name" and "procedure name" as inputs and the values needs to be obtained from the parameters of the wrapper procedure.
Example:
a) Let us assume that there is an application package called customer.
create or replace package spec customer
as
begin
TYPE cust_in_rec_type IS RECORD
cust_id NUMBER,
,cust_name VARCHAR2(25) );
TYPE cust_role_rec_type IS RECORD
(cust_id NUMBER,
role_type VARCHAR2(20)
TYPE role_tbl_type IS TABLE OF cust_role_rec_type INDEX BY BINARY_INTEGER;
Procedure create_customer
p_code in varchar2
,p_cust_rec cust_in_rec_type
,p_cust_roles role_tbl_type
end;
b) Let us assume that we need to test the create customer procedure in the package.For that various test cases needs to be executed.
c) We have created a testing package as mentioned below.
create or replace package body customer_test
as
begin
-- signature of this wrapper is exactly same as create_customer procedure.
procedure create_customer_wrapper
p_code in varchar2
,p_cust_rec customer.cust_in_rec_type
,p_cust_roles customer.role_tbl_type
as
begin
//<<<<<---Need to display parameter values dynamically for each test case-->>>>>
Since the signature of this wrapper procedure is similar to actual app procedure, we can get all the parameter definition for this procedure using ALL_ARGUMENTS table as mentioned below.
//<<
select * from ALL_ARGUMENTS where package_name = CUSTOMER' and object_name = 'CREATE_CUSTOMER'
but the problem is there are other procedures exists inside customer package like update_customer, add_address so need to have generalized code that is independent of each procedure inside the package.
Is there any way to achieve this.
Any help is appreciated.
// >>>>
create_customer
p_code => p_code
,p_cust_rec => p_cust_rec
,p_cust_roles => p_cust_roles
end;
procedure testcase1
as
l_cust_rec customer.cust_in_rec_type ;
l_cust_roles customer.role_tbl_type;
begin
l_cust_rec.cust_id := 1;
l_cust_rec.cust_name := 'ABC';
l_cust_roles(1).cust_id := 1;
l_cust_roles(1).role_type := 'Role1';
create_customer_wrapper
p_code => 'code1'
,p_cust_rec => l_cust_rec
,p_cust_roles => l_cust_role
end;
procedure testcase2
as
l_cust_rec customer.cust_in_rec_type ;
l_cust_roles customer.role_tbl_type;
begin
l_cust_rec.cust_id := 2;
l_cust_rec.cust_name := 'DEF';
l_cust_roles(1).cust_id := 2;
l_cust_roles(1).role_type := 'Role2';
create_customer_wrapper
p_code => 'code2'
,p_cust_rec => l_cust_rec
,p_cust_roles => l_cust_role
end;
end;Not possible to dynamically in a procedure, deal with the parameter values passed by a caller. There is no struct or interface that a procedure can use to ask the run-time to give it the value of the 1st or 2nd or n parameter.
There could perhaps be some undocumented/unsupported method - as debugging code (<i>DBMS_DEBUG</i>) is able to dynamically reference a variable (see Get_Value() function). But debugging requires a primary session (the debug session) and the target session (session being debugged).
So easy answer is no - the complex answer is.. well, complex as the basic functionality for this do exists in Oracle in its DBMS_DEBUG feature, but only from a special debug session.
The easiest way would be to generate the wrapper itself, dynamically. This allows your to generate code that displays the parameter values and add whatever other code needed into the wrapper. The following example demonstrates the basics of this approach:
SQL> -- // our application proc called FooProc
SQL> create or replace procedure FooProc( d date, n number, s varchar2 ) is
2 begin
3 -- // do some stuff
4 null;
5 end;
6 /
Procedure created.
SQL>
SQL> create or replace type TArgument is object(
2 name varchar2(30),
3 datatype varchar2(30)
4 );
5 /
Type created.
SQL>
SQL> create or replace type TArgumentList is table of TArgument;
2 /
Type created.
SQL>
SQL> -- // create a proc that creates wrappers dynamically
SQL> create or replace procedure GenerateWrapper( procName varchar2 ) is
2 procCode varchar2(32767);
3 argList TArgumentList;
4 begin
5 select
6 TArgument( argument_name, data_type )
7 bulk collect into
8 argList
9 from user_arguments
10 where object_name = upper(procName)
11 order by position;
12
13 procCode := 'create or replace procedure Test'||procName||'( ';
14 for i in 1..argList.Count
15 loop
16 procCode := procCode||argList(i).name||' '||argList(i).datatype;
17 if i < argList.Count then
18 procCode := procCode||', ';
19 end if;
20 end loop;
21
22 procCode := procCode||') as begin ';
23 procCode := procCode||'DBMS_OUTPUT.put_line( '''||procName||''' ); ';
24
25 for i in 1..argList.Count
26 loop
27 procCode := procCode||'DBMS_OUTPUT.put_line( '''||argList(i).name||'=''||'||argList(i).name||' ); ';
28 end loop;
29
30 -- // similarly, a call to the real proc can be added into the test wrapper
31 procCode := procCode||'end;';
32
33 execute immediate procCode;
34 end;
35 /
Procedure created.
SQL>
SQL> -- // generate a wrapper for a FooProc
SQL> exec GenerateWrapper( 'FooProc' );
PL/SQL procedure successfully completed.
SQL>
SQL> -- // call the FooProc wrapper
SQL> exec TestFooProc( sysdate, 100, 'Hello World' )
FooProc
D=2011-01-07 13:11:32
N=100
S=Hello World
PL/SQL procedure successfully completed.
SQL> -
Displaying negative value while % calculation
Hello Experts,
I'm having issues with the following sceanario.
There is one Percentage calculation column in report layout, but the result shows negative value even if Numerator & Denoinator having negative values. I'm using %A function and also NODIM.
I'm using like nodim(-2) %A nodim(-1) and result gives -200% instead of 200%.....
Please give me clarification to achieve the actual results.
Regards,
Navin AchantaHi Navin,
I hope you are working on BI 7.0. And this is a known issue from SAP and they have some notes to be applied for this to get the new %A functionality. What is happening here is, the denominator negative sign is not working and always it is taking an absolute value, i.e, only 1 in your case.
Please check with your basis guys or SAP. One of my friend got this problem and that is why i come to know this solution. But, sorry for the providing the exact notes applied for this.
Regards,
Srinivas. -
Why is it displaying negative value?
Hi friends when i tried to execute the following command
it is displaying the following answer.....
sql> select cos(60) from dual;
COS(90)
-.44807362
what's the reason to display negitive value for cos(60).....As anish pointed out, most computer languages tend to work in radians rather than degrees....
SQL> CREATE FUNCTION radians(p_degrees IN NUMBER) RETURN NUMBER IS
2 pi NUMBER(9,7) := 3.1415926;
3 BEGIN
4 -- There are 2*PI radians in a circle
5 -- Therefore 2*PI = 360 degrees
6 -- Therefore PI = 180 degrees
7 RETURN (p_degrees/180)*pi;
8 END;
9 /
Function created.
SQL> with t as (select rownum-1 as degrees from dual connect by rownum <= 360)
2 select t.degrees,
3 round(sin(radians(t.degrees)),6) SIN,
4 round(cos(radians(t.degrees)),6) COS
5 from t;
DEGREES SIN COS
0 0 1
1 .017452 .999848
2 .034899 .999391
3 .052336 .99863
4 .069756 .997564
5 .087156 .996195
6 .104528 .994522
7 .121869 .992546
8 .139173 .990268
9 .156434 .987688
10 .173648 .984808
11 .190809 .981627
12 .207912 .978148
13 .224951 .97437
14 .241922 .970296
15 .258819 .965926
16 .275637 .961262
17 .292372 .956305
18 .309017 .951057
19 .325568 .945519
20 .34202 .939693
21 .358368 .93358
22 .374607 .927184
23 .390731 .920505
24 .406737 .913545
25 .422618 .906308
26 .438371 .898794
27 .45399 .891007
28 .469472 .882948
29 .48481 .87462
30 .5 .866025
31 .515038 .857167
32 .529919 .848048
33 .544639 .838671
34 .559193 .829038
35 .573576 .819152
36 .587785 .809017
37 .601815 .798636
38 .615661 .788011
39 .62932 .777146
40 .642788 .766044
41 .656059 .75471
42 .669131 .743145
43 .681998 .731354
44 .694658 .71934
45 .707107 .707107
46 .71934 .694658
47 .731354 .681998
48 .743145 .669131
49 .75471 .656059
50 .766044 .642788
51 .777146 .62932
52 .788011 .615661
53 .798636 .601815
54 .809017 .587785
55 .819152 .573576
56 .829038 .559193
57 .838671 .544639
58 .848048 .529919
59 .857167 .515038
60 .866025 .5
61 .87462 .48481
62 .882948 .469472
63 .891007 .453991
64 .898794 .438371
65 .906308 .422618
66 .913545 .406737
67 .920505 .390731
68 .927184 .374607
69 .93358 .358368
70 .939693 .34202
71 .945519 .325568
72 .951057 .309017
73 .956305 .292372
74 .961262 .275637
75 .965926 .258819
76 .970296 .241922
77 .97437 .224951
78 .978148 .207912
79 .981627 .190809
80 .984808 .173648
81 .987688 .156434
82 .990268 .139173
83 .992546 .121869
84 .994522 .104528
85 .996195 .087156
86 .997564 .069756
87 .99863 .052336
88 .999391 .0349
89 .999848 .017452
90 1 0
91 .999848 -.017452
92 .999391 -.034899
93 .99863 -.052336
94 .997564 -.069756
95 .996195 -.087156
96 .994522 -.104528
97 .992546 -.121869
98 .990268 -.139173
99 .987688 -.156434
100 .984808 -.173648
101 .981627 -.190809
102 .978148 -.207912
103 .97437 -.224951
104 .970296 -.241922
105 .965926 -.258819
106 .961262 -.275637
107 .956305 -.292372
108 .951057 -.309017
109 .945519 -.325568
110 .939693 -.34202
111 .93358 -.358368
112 .927184 -.374607
113 .920505 -.390731
114 .913545 -.406737
115 .906308 -.422618
116 .898794 -.438371
117 .891007 -.45399
118 .882948 -.469472
119 .87462 -.48481
120 .866025 -.5
121 .857167 -.515038
122 .848048 -.529919
123 .838671 -.544639
124 .829038 -.559193
125 .819152 -.573576
126 .809017 -.587785
127 .798636 -.601815
128 .788011 -.615661
129 .777146 -.62932
130 .766044 -.642788
131 .75471 -.656059
132 .743145 -.669131
133 .731354 -.681998
134 .71934 -.694658
135 .707107 -.707107
136 .694658 -.71934
137 .681998 -.731354
138 .669131 -.743145
139 .656059 -.75471
140 .642788 -.766044
141 .62932 -.777146
142 .615662 -.788011
143 .601815 -.798635
144 .587785 -.809017
145 .573576 -.819152
146 .559193 -.829038
147 .544639 -.838671
148 .529919 -.848048
149 .515038 -.857167
150 .5 -.866025
151 .48481 -.87462
152 .469472 -.882948
153 .453991 -.891007
154 .438371 -.898794
155 .422618 -.906308
156 .406737 -.913545
157 .390731 -.920505
158 .374607 -.927184
159 .358368 -.93358
160 .34202 -.939693
161 .325568 -.945519
162 .309017 -.951057
163 .292372 -.956305
164 .275637 -.961262
165 .258819 -.965926
166 .241922 -.970296
167 .224951 -.97437
168 .207912 -.978148
169 .190809 -.981627
170 .173648 -.984808
171 .156435 -.987688
172 .139173 -.990268
173 .121869 -.992546
174 .104529 -.994522
175 .087156 -.996195
176 .069757 -.997564
177 .052336 -.99863
178 .0349 -.999391
179 .017452 -.999848
180 0 -1
181 -.017452 -.999848
182 -.034899 -.999391
183 -.052336 -.99863
184 -.069756 -.997564
185 -.087156 -.996195
186 -.104528 -.994522
187 -.121869 -.992546
188 -.139173 -.990268
189 -.156434 -.987688
190 -.173648 -.984808
191 -.190809 -.981627
192 -.207912 -.978148
193 -.224951 -.97437
194 -.241922 -.970296
195 -.258819 -.965926
196 -.275637 -.961262
197 -.292372 -.956305
198 -.309017 -.951057
199 -.325568 -.945519
200 -.34202 -.939693
201 -.358368 -.93358
202 -.374607 -.927184
203 -.390731 -.920505
204 -.406737 -.913545
205 -.422618 -.906308
206 -.438371 -.898794
207 -.45399 -.891007
208 -.469472 -.882948
209 -.48481 -.87462
210 -.5 -.866025
211 -.515038 -.857167
212 -.529919 -.848048
213 -.544639 -.838671
214 -.559193 -.829038
215 -.573576 -.819152
216 -.587785 -.809017
217 -.601815 -.798636
218 -.615661 -.788011
219 -.62932 -.777146
220 -.642788 -.766044
221 -.656059 -.75471
222 -.669131 -.743145
223 -.681998 -.731354
224 -.694658 -.71934
225 -.707107 -.707107
226 -.71934 -.694658
227 -.731354 -.681998
228 -.743145 -.669131
229 -.75471 -.656059
230 -.766044 -.642788
231 -.777146 -.62932
232 -.788011 -.615662
233 -.798635 -.601815
234 -.809017 -.587785
235 -.819152 -.573576
236 -.829038 -.559193
237 -.838671 -.544639
238 -.848048 -.529919
239 -.857167 -.515038
240 -.866025 -.5
241 -.87462 -.48481
242 -.882948 -.469472
243 -.891006 -.453991
244 -.898794 -.438371
245 -.906308 -.422618
246 -.913545 -.406737
247 -.920505 -.390731
248 -.927184 -.374607
249 -.93358 -.358368
250 -.939693 -.34202
251 -.945519 -.325568
252 -.951056 -.309017
253 -.956305 -.292372
254 -.961262 -.275637
255 -.965926 -.258819
256 -.970296 -.241922
257 -.97437 -.224951
258 -.978148 -.207912
259 -.981627 -.190809
260 -.984808 -.173648
261 -.987688 -.156435
262 -.990268 -.139173
263 -.992546 -.121869
264 -.994522 -.104529
265 -.996195 -.087156
266 -.997564 -.069757
267 -.99863 -.052336
268 -.999391 -.0349
269 -.999848 -.017452
270 -1 0
271 -.999848 .017452
272 -.999391 .034899
273 -.99863 .052336
274 -.997564 .069756
275 -.996195 .087156
276 -.994522 .104528
277 -.992546 .121869
278 -.990268 .139173
279 -.987688 .156434
280 -.984808 .173648
281 -.981627 .190809
282 -.978148 .207912
283 -.97437 .224951
284 -.970296 .241922
285 -.965926 .258819
286 -.961262 .275637
287 -.956305 .292372
288 -.951057 .309017
289 -.945519 .325568
290 -.939693 .34202
291 -.93358 .358368
292 -.927184 .374607
293 -.920505 .390731
294 -.913545 .406737
295 -.906308 .422618
296 -.898794 .438371
297 -.891007 .45399
298 -.882948 .469471
299 -.87462 .48481
300 -.866025 .5
301 -.857167 .515038
302 -.848048 .529919
303 -.838671 .544639
304 -.829038 .559193
305 -.819152 .573576
306 -.809017 .587785
307 -.798636 .601815
308 -.788011 .615661
309 -.777146 .62932
310 -.766045 .642788
311 -.75471 .656059
312 -.743145 .669131
313 -.731354 .681998
314 -.71934 .694658
315 -.707107 .707107
316 -.694658 .71934
317 -.681998 .731354
318 -.669131 .743145
319 -.656059 .75471
320 -.642788 .766044
321 -.62932 .777146
322 -.615662 .788011
323 -.601815 .798635
324 -.587785 .809017
325 -.573577 .819152
326 -.559193 .829038
327 -.544639 .838671
328 -.529919 .848048
329 -.515038 .857167
330 -.5 .866025
331 -.48481 .87462
332 -.469472 .882948
333 -.453991 .891006
334 -.438371 .898794
335 -.422618 .906308
336 -.406737 .913545
337 -.390731 .920505
338 -.374607 .927184
339 -.358368 .93358
340 -.34202 .939693
341 -.325568 .945519
342 -.309017 .951056
343 -.292372 .956305
344 -.275637 .961262
345 -.258819 .965926
346 -.241922 .970296
347 -.224951 .97437
348 -.207912 .978148
349 -.190809 .981627
350 -.173648 .984808
351 -.156435 .987688
352 -.139173 .990268
353 -.121869 .992546
354 -.104529 .994522
355 -.087156 .996195
356 -.069757 .997564
357 -.052336 .99863
358 -.0349 .999391
359 -.017453 .999848
360 rows selected.
SQL> -
APEX 4 Interactive Report set font color of negative values to red
I have an interactive report with several columns containing numerical values. If the value is negative, I want the font color to be red. Can someone help me with this process please.
Application Express 4.1.1.00.23
Thanks!
ChrisHi,
Use build in highlight
http://docs.oracle.com/cd/E23903_01/doc/doc.41/e21674/ir_using.htm#sthref1343
Then save report default layout
http://docs.oracle.com/cd/E23903_01/doc/doc.41/e21674/ir_using.htm#CHDDDBCG
Regards,
Jari
My Blog: http://dbswh.webhop.net/dbswh/f?p=BLOG:HOME:0
Twitter: http://www.twitter.com/jariolai -
Need Help In Displaying Numberic Values In app.alert
How can I display a two placed decimal value in an app.alert, correctly?
app.alert("Invalid - " + this.getField("Sub-Total-2").value, 1);
In the above alert, Sub-Total-2 is defined with 2 decimal places, within its Text Field Properties. But if its value is 2.50, it is displayed as 2.5 from within the alert. And still othertimes, its value is displayed values such as 56.33333333, when it should display 56.40
Use util.printf()
-
In query display sales negative values
Hi Friends
Iam Exicuting query based on these selection parameters
Sales Org: 5360
cal Month/Year: 04.2007 to 04.2008
When am exucuting the query above parameters some values display negative values like
04.2007 month display -39
07.2007 month display -253
the key-fig is sales turnover Qty display negative values
in BW side cube also display negative values
why display the negative values
anybody help meCheck the Source where data is coming if it is negative value. If source has positive value, in Cube also it should be positive.
Whatever value you have in your infoprovider, it will display in query. -
Using decode function without negative values
Hi friends
I am using oracle 11g
I have at doubt regarding the following.
create table Device(Did char(20),Dname char(20),Datetime char(40),Val char(20));
insert into Device values('1','ABC','06/13/2012 18:00','400');
insert into Device values('1','abc','06/13/2012 18:05','600');
insert into Device values('1','abc','06/13/2012 18:55','600');
insert into Device values('1','abc','06/13/2012 19:00','-32768');
insert into Device values('1','abc','06/13/2012 19:05','800');
insert into Device values('1','abc','06/13/2012 19:10','600');
insert into Device values('1','abc','06/13/2012 19:15','900');
insert into Device values('1','abc','06/13/2012 19:55','1100');
insert into Device values('1','abc','06/13/2012 20:00','-32768');
insert into Device values('1','abc','06/13/2012 20:05','-32768');
Like this I am inserting data into table for every 5 minutes Here i need the result like
output:
Dname 18:00 19:00 20:00
abc 400 -32768 -32768
to retrieve this result i am using decode function
SELECT Dname,
MAX(DECODE ( rn , 1,val )) h1,
MAX(DECODE ( rn , 2, val )) h2,
FROM
(SELECT Dname,Datetime,row_number() OVER
(partition by Dname order by datetime asc) rn FROM Device
where substr(datetime,15,2)='00' group by Dname.
According to above data expected result is
Dname 18:00 19:00 20:00
abc 400 600(or)800 1100
This means I dont want to display negative values instead of that values i want to show previous or next value.
Edited by: 913672 on Jul 2, 2012 3:44 AMAre you looking for something like this?
select * from
select dname,
datetime,
val,
lag(val) over (partition by upper(dname) order by datetime) prev_val,
lead(val) over (partition by upper(dname) order by datetime) next_val,
case when nvl(val,0)<0 and lag(val) over (partition by upper(dname) order by datetime) >0 then
lag(val) over (partition by upper(dname) order by datetime)
else
lead(val) over (partition by upper(dname) order by datetime)
end gt0_val
from device
order by datetime
where substr(datetime,15,2)='00';Please take a look at the result_column gt0_val.
Edited by: hm on 02.07.2012 04:06 -
Showing negative values in parentheses
Hi Gurus,
As per clients request, I am trying to display negative values in parentheses.
I have editable input text field showing margin.
If the margin is negative value, then it is display in parentheses with dollar sign($).
my code is as below:
<af:inputText value="#{bindings.margin.inputValue}"
label="#{bindings.margin.hints.label}"
<af:convertNumber type="currency"/>
</af:inputText>
However, margin may be in other currency.
I want to get rid of the $ sign.
Please help how to hide $ sign.
Thanks
NagHi,
if you know the currency, then you can EL in trinidad-config.xml to switch the currency formatting accordingly.
http://download.oracle.com/docs/cd/E17904_01/web.1111/b31973/ap_config.htm#sthref2825
Of course, this would not change it on a per row basis in a table.
Other options are as explained in the convertNumber tag doc
http://download.oracle.com/docs/cd/E17904_01/apirefs.1111/e12419/tagdoc/af_convertNumber.html
You could provide a code format pattern in which case the currency icon is not added. Or, you could provide a pattern and have it formatted as a number, not currency
Frank
Maybe you are looking for
-
Web Dynpro ABAP: Assigning of Conversion Exits in ALV
Hi, We are currently developing a generic data display application using ALV technology in Web Dynpro ABAP. "Generic" means that the structure of the data is created dynamically during runtime (using RTTS) and that even the contained data elements ar
-
Trying to combine audio from a video clip with a photo
Is there a way to allow the audio of a video clip to continue, while the visual is changed? I'm trying to insert a photo to replace the last few seconds of a video as the song in the video finishes.
-
What is the purpose of Configuring Database Security Store
in 11g R2 or 11gR2 PS1.... Experts ... please clarify ...
-
Hi All, I'm Ramli from NCSI Brunei and I'm quite new to SAP. I'm more on BASIS support . I need some Expert/Guru on how to hide the 'Get Support' Icon on the web portal. Our user are Mindef Brunei and they requested to have the 'Get Support' icon to
-
Patterns for complex parsers, scanner, compilers
Can anyone suggest some good pattern sequence or some resurces on the net that can help in designing complex language parsers, scanners and things like that? I developed a simple sql parser in java that starting from a query string extract a kind of