Display xero as zero and null as space in BEx excel reports - urgent
How do I set query properties, where difference of 2 key figures is if zero will display zero. but if there is a key figure which has a null value (not assigned), then difference between 2 KFs will be space.
Thanks
Swati
Could you please fix the code below. I need range as A1:Z2000.. covering almost whole worksheet.
Sub SAPBEXonRefresh()
' SAPBEXonRefresh Macro
' Macro recorded 7/24/2008 by RR
Application.Run "ZSD_O01_Q001.xls!SAPBEXonRefresh"
Range("A1:Z2000").Select
Dim c As Range
For Each c In resultArea.Cells
If c.Value = "#" Then c.Value = " " .
Next c
End Sub
End Sub
Edited by: Swati Sharma on Jul 25, 2008 7:02 AM
Similar Messages
-
OBIEE 11g - zeros and nulls and rows, oh my!
Hi, dumb question here, but I need some help with handling zeros and nulls with OBIEE.
First off, I have a fact table that contains five "metrics" - A, B, C, D, and E. Often (but not always), only 1 of the 5 columns is populated, the others are NULL.
In the RPD, I've brought in these 5 columns and set their aggregation to SUM. In addition, I've created other calculated metrics such as F = A+B, G = A+C+E, etc. To get these calculations to work right, I seem to have to use IfNull(metric,0) often, because apparently NULL plus a number equals NULL.
From a usability standpoint, here's what I'm seeing on reports that I don't like (for instance, imagine the particular report is displaying columns A, B, and F only)
#1 - If A and B are both NULL, the F column always shows as a 0 because the formula is IfNull(A,0) + IfNull(B,0). It would be nice if I could get F to also show NULL, without making the formula complicated
#2 - Rows are showing on the report where everything on the row is either NULL or 0. I assume this is because one of the columns not being displayed has numbers in it. Is there a way to get OBIEE to not show rows that have all zeros or NULLs? Or is this due to the fact that the IfNull(A,0) + IfNull(B,0) is returning a non-NULL answer...and if I modified the formula so it did return a NULL it would magically go away?
Thanks!
Scottp.s. regarding issue #2...I suppose I could put a filter on to filter out rows with all zeros or NULLs, but this filter gets uglier and uglier as the number of columns grows...and I wouldn't want developers to have to do this.
Thx,
Scott -
Removing leading zeros and leading blank spaces from an input field
Hi All,
I have an input field which is alphanumeric and i need to remove the leading zeros and blank spaces in it , but intermediate spaces should be kept .
so i used the UDF
String output = input.replaceFirst("^0+","");
return output;
but this code does not remove the leading blank spaces . Can anybody help in modifying this code so that even the leading blank spaces along with leading zeros can be removed .
Regards ,
Loveena .lets say input is a
then
int len = a.length();
for(int i;i< length;i++)
if(a.substring(0,1).equals(" ") || a.substring(0,1).equals("0"))
a = a.substring(1,len);
return a;
hope you got the logic so that you can enhance it better -
Sorting and null for monetary values in a report
All,
I think this should be an easy one, and I've just missed something obvious.
I have a standard report in APEX 3.2.1 that includes a column with a monetary amount in it. I want the column to show the UK Pound sign, be sortable, and show nulls where appropriate.
The issue I have is I can't find a way to achieve all 3 in a satisfctory way. As I see it the options would be:
1) In the SQL for the report, concat the pound sign to the column required, e.g. SELECT '£'||amount FROM....
The issue is that this makes this field a CHAR field, so sorting would not sort in the same way as for a number field.
2) Use the Number format FML999...etc. in the Column Attribute.
The problem with this is that this is a multi-country database, and the default monetary unit is set to the US dollar.
3) Use the HTML expression box in the Column attribute to display £#COL#
This fulfills the pound sign and retaining the number format, but unfortunately a null value is displayed as a £ sign with no numbers. I can't think how to get it to leave that value in the report as completely blank.
As I said, I'm sure I've missed soemthing obvious. If anyone can spot how to achieve this it'd be much appreciated.
Regards,
Jon.>
2) Use the Number format FML999...etc. in the Column Attribute.
The problem with this is that this is a multi-country database, and the default monetary unit is set to the US dollar.
>
The NLS currency symbol can be modified on the fly if you have some means of identifying user location/preference: {thread:id=990848} (ignore the last post)
However, it probably doesn't make sense to do that—£100 ≠ $100 (at least I hope not!)—unless there's some kind of conversion occurring in the report? Is there a currency stored along with the amount?
>
3) Use the HTML expression box in the Column attribute to display £#COL#
This fulfills the pound sign and retaining the number format, but unfortunately a null value is displayed as a £ sign with no numbers. I can't think how to get it to leave that value in the report as completely blank.
>
Use 2 columns, one for the amount, and one for the currency, with a switch to include or exclude the latter as necessary:
select
ename
, comm amount
, nvl2(comm, '£', null) currency
from
emp
where
job in ('SALESMAN', 'MANAGER')
ENAME AMOUNT CURRENCY
ALLEN 300 £
WARD 500 £
JONES
MARTIN 1400 £
BLAKE
CLARK
TURNER 0 £ Then use both columns in the Amount HTML Expression:
#CURRENCY##AMOUNT# -
OBIEE11g display two x- axis and one y- axis in the same report
Hi All,
Please help me in displaying the two x-axis in the chartview of Same Report.
These two x-axis are having two different scales..
Can we do it in OBIEE or not ? We can do this in Excel..
Thanks in Advance
SrinivasSrinivas,
showing 2 X-axis is not at all possible in OBIEE, if you want to show 2 Y'axis then select 2 measures and convert them into combo (Bar-Line) chart. Also these 2 axis won't be visible in case of only Line chart or Bar chart.
Regards,
Jitendra -
Reg : Advantages and Disadvantages of WAD over Bex in Reporting
Hi BW Gurus,
I wish to know the advantages and disadvantages of using WAD Over BEx .Please reply back with some strong points, as I have to project the same to our customer.
Thanks in Advance,
KrishnaHi Krishna,
Here are some:
- User friendly access (less educational cost).
- Web reporting is faster, less overhead in executing Web reports.
- Learning curve for NEW users in BW is lower on Web Reporting.
- Accessibility of reports to a wider audience.
- No SAP front-end is needed anymore to execute reports.
Hope it helps,
David. -
I want to set up my spreadsheet to display two digits to the right of the decimal point, even if zeros, and not have to do it for each individual cell.
Select all the cells you want formatted that way (or the entire table if that's what you want)
Open the cell inspector
Set the format to "number" with 2 decimal places -
How to padding the zeroes and space befoer sending from XI to R3 system.
Hi Experts,
How to padding the zeroes and space befoer sending any data from XI to R3 during mapping, how to write a java code to implement this logic, please help me with the coding or any other alternative.
thanks
dhanushto pad spaces you need to write a simple UDF
for right padding use the following
while( inputField.length() < Integer.parseInt(totalLength))
inputField = inputField + " ";
return inputField;
for left padding use the following
while( inputField.length() < Integer.parseInt(totalLength))
inputField = " " + inputField ;
return inputField;
Note:in the above examples <i>inputField</i> will be the input to UDF i.e. the sender field which you need to pad and send to receiver , and <i>totalLength</i> will be a constant i.e length of the field you want on receiver side after padding.
also i m not a Java expert so please check for syntax and semantics for code:) to me it looks correct
Thanx
Aamir
Message was edited by:
Aamir Suhail -
Hi All
I have a form with two fields
code and name
code name
0100 vikas
01002 singh
10025 niki
2555 tomi want when i save data then no spaces will save in database in starting the name and in code spaces and zero
will remove automatically
Regards
VikasHi,
your question isn't clear.
describe your table.
If code is data type of number, oracle doesnt store leading zero's , trims leading space.
SQL> create table t (x number);
Table created.
SQL> insert into t (x) values(001000);
1 row created.
SQL> commit;
Commit complete.
SQL> select *from t;
X
1000
SQL> insert into t (x) values( 100000);
1 row created.
SQL> commit;
Commit complete.
SQL> select *from t;
X
1000
100000
SQL> select Length(x)len,x from t;
LEN X
4 1000
6 100000Edited by: user291283 on Sep 24, 2009 5:09 PM
Edited by: user291283 on Sep 24, 2009 5:12 PM -
Problem with QofQ and Null Values
Just converted from CF5 to CF7. Finally figured out what was
causing the error message :
"The value "" cannot be converted to a number" when running a
QofQ. It happens whenever there is a NULL (and I think a ZERO)
value in the QofQ. I'm using the QofQ in a seperate chart program.
The main query merges data from a store and a region table.
I'm doing a LEFT OUTER JOIN to combine the REGION with the STORE,
AND so that stores with NO SALES for a given day will show up as
ZERO. On the main report, when I don't use a QofQWhen grouping by
DAY or MONTH, I can test the value in the CFOUTPUT for NULL or ZERO
and display "0" or "N/A" on the report.
But when I try to chart it, using a QofQ to read in the
values from the main query, and format the numbers, I get this
error message. I've tried using the CAST function, using FLOAT,
DOUBLE, BIGINT, etc., but still get same error message.
The only way I could fix this is to add a WHERE statement to
the QofQ, that only includes sales values greater than ZERO. But
then, I have gaps in my chart because stores with NO SALES for a
given day or MONTH don't appear. Because they are removed from the
query. The whole point of LEFT JOINS is to include items with no
values (or NULL) values.
Does anyone know if it's possible to keep these values in a
QofQ? So that items (e.g., store locations in my case) with NULL or
ZERO values for some or all days or months can be charted? Even
with a ZERO value? I've read everything I can get my hands on
regarding QofQ, the CAST function, etc., but nothing seems to work.
Thanks for any help. (FYI, didn't have this problem with CF5. It's
QofQ could handle NULL or ZERO values without providing an error).
GaryWell, I tried the IsNull function on the 3 SUM() values I was
calculating in my SELECT statement (on a LEFT OUTER JOIN QUERY),
and I STILL got another "cannot convert "" to a number" but this
time the error message was more direct, and pointed me to a DATE
field in my query, where I was SORTING AND GROUPING either by DAY
or MONTH (depending on what user selected on form).
In my QofQ, I'm not just reformating the integer SUM()
values, but also the date values. So, I applied the IsNull()
function to the DATE values in my main query. I still kept getting
errors. But after experimenting ((SQL Server BOL docs doesn't give
ISNULL() examples for DATE FIELDS, only NUMBER fields), I tried
putting the dates in SINGLE QUOTES in my IsNull() function, the
QUERY RAN. Then I wasn't sure WHAT date to enter, e.g., 1/1/1889 or
1/1/2001, etc.
Then, I discovered, after experimenting, that you cannot just
blindly enter ANY date when using IsNull in a date field,
especially if you are using CFGRAPH to chart the results by day.
You have to select a date within the date range the user selected,
so this means using the FORM.DATE (or URL.DATE) value from the
form. Here's the working example from my SELECT main query:
SELECT SUM(ISNULL(d.ttldb,0)) AS SumOfDB,
SUM(ISNULL(d.ttldbv,0)) AS SumOfDBV,
SUM(ISNULL(d.ttldbi,0)) AS SumOfDBI,
<CFIF '#url.reptype#' IS "DAILY">
ISNULL(d.depday, '#url.date1#') AS depday
<CFELSE>
month(ISNULL(d.depday, '#url.date2#')) AS TranMonth,
year(ISNULL(d.depday, '#url.date2#')) AS TranYear
</CFIF>
Then I discovered that whatever date was used in the URL.DATE
field (in my case it would be one of the two date field from the
form, and depended on whether you coded DATE1 or DATE2, the chart
would always show ZERO values for that date. So I tried putting the
IsNull() date values in the GROUP BY and ORDER BY statements, e.g.,
<CFIF '#url.reptype#' IS "DAILY">
GROUP BY ISNULL(d.depday, '#url.date1#')
ORDER BY ISNULL(d.depday, '#url.date1#') DESC
<CFELSE>
GROUP BY year(ISNULL(d.depday, '#url.date2#')),
month(ISNULL(d.depday, '#url.date2#'))
ORDER BY year(ISNULL(d.depday, '#url.date2#')),
month(ISNULL(d.depday, '#url.date2#'))
</CFIF>
And this worked. The report ran just fine, and the chart
charted every value correctly.
I guess you have to learn all the little "quirks" about CF7
and how it's QofQ and chart programs work. But so far, so good.
Thank you all for your help. Now I've got to update other old
CF5 programs that are returning errors when there are null values
from my LEFT OUTER JOIN queries. Will take some time, but at least
I know how to do it. Thanks to your help.
I really appreciate your time and efforts to help with this
issue.
Gary -
Display dates with zeros for month, day, year.
I have a date coming from a database as an int (20021215 means 12/15/2002). If the database gives me a "0", meaning no date value is assigned, then it should be displayed as "00/00/0000". The following code snippet works for the non-zero int database values ...
public static String formatDisplayDate(int date) {
String dateAsString = null;
if (date == 0) {
dateAsString = "00000000";
else {
dateAsString = Integer.toString(date);
String strYear = dateAsString.substring(0,4);
String strMonth = dateAsString.substring(4,6);
String strDay = dateAsString.substring(6);
int year = Integer.parseInt(strYear);
int month = (Integer.parseInt(strMonth)) - 1;
int day = Integer.parseInt(strDay);
DateFormat myFormat = DateFormat.getDateInstance(DateFormat.SHORT);
Calendar cal = myFormat.getCalendar();
cal.set(year, month, day);
Date myDate = cal.getTime();
String formattedDate = myFormat.format(myDate);
return formattedDate;
}Although I didn't really expect the zero values case to work, I am not sure how to implement it. How would I go about building a string using all zeros and still have it automatically display in the correct locale format?
Any help is appreciated.Thank you for your response. I agree a blank field would be better, but I think the "zeros" format is there to give the user an idea of expected date entry formatting, not that they'll necessarily follow it. I have made a few changes per your suggestions (shown below for the record, minus the exception handling), and it works perfectly.
public static String formatExternalDate8(int date) {
String dateAsString = null;
if (date == 0) {
dateAsString = "00010101";
else {
dateAsString = Integer.toString(date);
int year = Integer.parseInt(dateAsString.substring(0,4));
int month = (Integer.parseInt(dateAsString.substring(4,6))) - 1;
int day = Integer.parseInt(dateAsString.substring(6));
DateFormat myFormat = DateFormat.getDateInstance(DateFormat.SHORT);
Calendar cal = myFormat.getCalendar();
cal.set(year, month, day);
Date myDate = cal.getTime();
String formattedDate = myFormat.format(myDate);
if (date == 0) {
formattedDate = formattedDate.replace('1', '0');
return formattedDate;
}Thanks again for your assistance. -
How to differentiate the EMPTY Records and Null Values in DSO
Hello....how is everyone here?? Ehehehe!
I try to load some data from the flat file which contains some EMPTY data and Null Values for the records. The data type for the InfoObjects of the fields "Quantity" is "number". The sample data from the flat file (CSV) are as below:
Food Quantity
Hamburger - 12
Cheese - 0
Vegetable - (Empty)
When I try to load the above sample data to the DSO, I get the results of the data as follow:
Food Quantity
Hamburger - 12.000
Cheese - 0.000
Vegetable - 0.000
In this case, how can the user differentiate whether the records is contain empty value of null values in DSO? This is kinda of hard to differentiate the both scenarios above. Is there any way to differentiate the scenarios described here?
Thanks alot =)Hi Fluffy,
It depends on the initial values of the data type
The inital values For quantity/Currency/ Numbers it takes spaces as 0
for char it is SPACE
We cannot differeniate between space and null values.
IF you have to force this then define quantity as char and load the data. we will not have units and aggregation in this case.
Hope this helps.
PV -
How to force simple tags and null attributes to appear when using SQL/XML?
Hello everybody:
I'm developing a non-schema based XMLType view.
When the XML document is generated, i noticed two things I need to manage in order to achieve the desired result:
1. Oracle generates a <tag></tag> pair for each XMLELEMENT defined; in my case, some tags need to appear as <tag/>... how do I do? Is it possible when using schema based XMLType views? Is it possible while using a non-schema approach?
2. When using XMLATTRIBUTE('' AS "attribute") or XMLATTRIBUTE(NULL AS "attribute"), no one attribute with label "attribute" and null value appears at the output; how do I force to Oracle DB to render those attributes which are with no values (needed to render those attributes as another parsing code will await for all the items)?
3. Some tip about how to route the output to an XML text disk file will be appreciated.
Thanks in advance.
Edited by: Enyix on 26/02/2012 11:21 PM
Edited by: Enyix on 26/02/2012 11:22 PMHello odie_63, thanks for your reply:
Reasons why needed single tags are these two next: Needed to generate a single XML file from 50,000,000 rows, where the XML ouput matches not only row data but another default values for another elements and attributes (not from database but using strings and types with default values); by using start and end tag, the generated file is as much twice bigger than using single tags; second, needed a very precise presentation for all the document.
For generating that document, currently focus is based on using a batch process relying on Spring Batch with using a single JDBC query where a join happens between two tables. From my point of view, that approach uses: database resources, network resources, disk resources, and processing resources, including the price of making the join, sending to network, creating objects, validating, and making the file (Expending too much time generating that XML file). That processs currently is in development.
I think possibly another approach is delegating the complete generation of that file to the database using its XML capabilities. My current approach following your recomendations is to generate a clob where I will put all the XML and putting it into a table. It leads me to another issues: Considering limitations on memory, processing and disk space, needed to append a single row-as-xml into the clob as soon as possible, and putting the clob inside the field as soon as possible, or putting the clob inside the field, and appending into it as the data is generated; so How do I manage the process in order to achieve that goals?. Seen these issues aren't related to my original question, so I'll open a new post. Any help will be apreciated.
Thanks again in advance. -
How to check empty string and null? Assign same value to multiple variables
Hi,
1.
How do I check for empty string and null?
in_value IN VARCHAR2
2. Also how do I assign same value to multiple variables?
var_one NUMBER := 0;
var_two NUMBER := 0;
var_one := var_two := 0; --- Gives an error
ThanksMichaelS wrote:
Not always: Beware of CHAR's:
Bug 727361: ZERO-LENGTH STRING DOES NOT RETURN NULL WHEN USED WITH CHAR DATA TYPE IN PL/SQL:
SQL> declare
2 l_str1 char (10) := '';
3 l_str2 char (10) := null;
4 begin
5
6 if l_str1 is null
7 then
8 dbms_output.put_line ('oh STR1 is null');
9 elsif l_str1 is not null
10 then
11 dbms_output.put_line ('oh STR1 is NOT null');
12 end if;
13
14 if l_str2 is null
15 then
16 dbms_output.put_line ('oh STR2 is null');
17 elsif l_str2 is not null
18 then
19 dbms_output.put_line ('oh STR2 is NOT null');
20 end if;
21 end;
22 /
oh STR1 is NOT null
oh STR2 is null
PL/SQL procedure successfully completed.
SQL> alter session set events '10932 trace name context forever, level 16384';
Session altered.
SQL> declare
2 l_str1 char (10) := '';
3 l_str2 char (10) := null;
4 begin
5
6 if l_str1 is null
7 then
8 dbms_output.put_line ('oh STR1 is null');
9 elsif l_str1 is not null
10 then
11 dbms_output.put_line ('oh STR1 is NOT null');
12 end if;
13
14 if l_str2 is null
15 then
16 dbms_output.put_line ('oh STR2 is null');
17 elsif l_str2 is not null
18 then
19 dbms_output.put_line ('oh STR2 is NOT null');
20 end if;
21 end;
22 /
oh STR1 is null
oh STR2 is null
PL/SQL procedure successfully completed.
SQL> SY. -
Varchar2, empty strings and NULL
Hi all,
When inserting an empty string into a column of type varchar2 - is a NULL value stored in the column by the database? I've seen conflicting reports, and I know that the SQL 1992 spec specifies that empty strings not be treated as a NULL value, but that Oracle has traditionally treated zero length strings stored in a varchar2 column as NULL.
So, is there a way to store an empty string in a varchar2 column as an empty string and not a NULL value?
TIA,
SethIt can be even more complicated or annoying than NULL not equal to ASCII NULL.
example:
create table test_null
(fld1 varchar2(10),
fld2 varchar2(10),
fld3 varchar2(20));
insert into test_null values (chr(0),null, 'chr(0) and null');
insert into test_null values (null, null, 'null and null');
insert into test_null values ('', chr(0), ''''' and chr(0)');
insert into test_null values ('', null, ''''' and null');
select * from test_null;
FLD1 FLD2 FLD3
chr(0) and null
null and null
'' and chr(0)
'' and null
1 DECLARE
2 BEGIN
3 for c1 in (select fld1, fld2, fld3 from test_null) loop
4 if c1.fld1 = c1.fld2 then
5 dbms_output.put_line(c1.fld3||' Are equal'||
6 ' Length fld1 = '||to_char(length(c1.fld1))||
7 ' Length fld2 = '||to_char(length(c1.fld2)));
8 else
9 dbms_output.put_line(c1.fld3||' Are NOT equal'||
10 ' Length fld1 = '||to_char(length(c1.fld1))||
11 ' Length fld2 = '||to_char(length(c1.fld2)));
12 end if;
13 dbms_output.put_line(' ');
14 end loop;
15* END;
SQL> /
chr(0) and null Are NOT equal Length fld1 = 1 Length fld2 =
null and null Are NOT equal Length fld1 = Length fld2 =
'' and chr(0) Are NOT equal Length fld1 = Length fld2 = 1
'' and null Are NOT equal Length fld1 = Length fld2 =
PL/SQL procedure successfully completed.
Maybe you are looking for
-
Trying to add more photos to photo stream from albums
Trying to add more photos to photo stream from albums in iPhoto on ipad .would like to view them on my Apple TV. I have 6 photos on the photo stream and lots more in albums but can't seem to be able to get them into the photo stream to view.
-
I've imported an eps file (company logo) and changed the scale with keyframes so that it grows over 5 seconds. The rendered effect displays at a very low resolution, even though the static file appears super crisp in the timeline. Is there a setting
-
how to define a schema for fixed length consisting of multiple records of different types having header detail and footer at positions 22 and 23 namely having 10 for header ,20 for detail and 30 for footer. here is the sample file DDWTYBILL1309250257
-
Hello @all, i have the following idea of scenario: After creating a quality notification (QN) in R3 a BPM on XI-server should start, getting the BO of the QN. My question is how can the workflow in R3 start the BP in XI and also how to send the BO fr
-
MacBook Pro mid-2012 sleeps with 30 sec delay
Hello Community, I've set pmset hypermode to 0 to make macbook faster go to sleep and it worked perfectly. Normally "time-to-stop" was about 3-5 seconds even with running VM (I've used parallels desktop 8). After I upgraded it to version 9 the proble