Report totals for non-numerical data
Hello all,
I am trying to update a site for an auto shop. The site is in PHP, MySQL.
What they have in the database is records for each customer that comes in to their shop. So, they will have John Q. Public having multiple entries for the date he came in, and what was done to the car. They want a report that will display the totals for each item that John Public has had done.
So for example the report would be displaying the following:
breaks oil change shocks tune up total visits
John Public 2 4 0 2 8
Jack Private 1 6 4 8 19
The database has this information in it to get the above report:
Name Date Work Cust. Review
John Public 02-05-2007 breaks satisfied
John Public 03-15-2008 breaks satisfied
John Public 01-09-2008 oil change satisfied
Is there a way to do this?
Well, I have done a lot of playing around, and got it to work. Although, I don't completely understand why it works. If someone would be kind enough to give me some insight, I would greatly appreciate it. I have not done JOINS in the past, so I'm trying to learn.
This is what I had originally:
<?php
//Query the unique works to generate the headers
$query = "SELECT DISTINCT reason FROM `call_log` ORDER BY reason";
$result = mysql_query($query) or die(mysql_error());
while($record = mysql_fetch_assoc($result))
$reasons[] = $record['reason'];
//Start the report table including headers
$report = "<table width=\"75%\" cellpadding=\"5\" cellspacing=\"5\" border=\"1\">\n";
$report .= " <tr><th>Store</th><th>" . implode('</th><th>', $reasons) . "</th></tr>\n";
//Query the records
$query = "SELECT t2.location, t2.reason, COUNT(t1.reason) as total
FROM (
SELECT tt1.location, tt2.reason
FROM (SELECT DISTINCT location FROM `call_log`) tt1,
(SELECT DISTINCT reason FROM `call_log`) tt2) t2
LEFT JOIN `call_log` t1
ON t1.location = t2.location AND t1.reason = t2.reason
GROUP BY t2.reason, t2.location
ORDER BY t2.location, t2.reason";
$result = mysql_query($query) or die(mysql_error());
And this is what I changed it to:
<?php
//Query the unique works to generate the headers
$query = "SELECT DISTINCT call_log.reason, call_reason.reason_id, call_reason.reason
FROM call_log LEFT JOIN call_reason
ON call_log.reason = call_reason.reason_id
ORDER BY call_log.reason";
$result = mysql_query($query) or die(mysql_error());
while($record = mysql_fetch_assoc($result))
$reasons[] = $record['reason'];
// Query to get the top headers to have the correct column span
$query = "SELECT COUNT(*) AS reason_id FROM call_reason";
// Execute Query for the correct column span
$result = mysql_query($query);
// Get the result of query named count
$count = mysql_result($result,0);
//Start the report table including subheaders for the reason totals
$report = "<table width=\"75%\" cellpadding=\"5\" cellspacing=\"5\" border=\"1\">\n";
$report .= " <tr><th style=\"border-color:#000;\">Store</th><th colspan=\"$count\" style=\"border-color:#000;\">Reasons for the Call</th></tr>\n";
$report .= " <tr><th></th><th>" . implode('</th><th>', $reasons) . "</th></tr>\n";
//Query the records
$query = "SELECT t2.location, t2.reason, COUNT(t1.reason) as total
FROM (
SELECT tt1.location, tt2.reason
FROM (SELECT DISTINCT location FROM `call_log`) tt1,
(SELECT DISTINCT reason FROM `call_log`) tt2) t2
LEFT JOIN `call_log` t1
ON t1.location = t2.location AND t1.reason = t2.reason
GROUP BY t2.reason, t2.location
ORDER BY t2.location, t2.reason";
$result = mysql_query($query) or die(mysql_error());
It's the first section of:
$query = "SELECT DISTINCT call_log.reason, call_reason.reason_id, call_reason.reason
FROM call_log LEFT JOIN call_reason
ON call_log.reason = call_reason.reason_id
ORDER BY call_log.reason";
$result = mysql_query($query) or die(mysql_error());
while($record = mysql_fetch_assoc($result))
$reasons[] = $record['reason'];
that I'm wodering about. Since I didn't realize that I defined the vairable for call_reason.reason how did it know to display the data from that field? I know I joined the tables, but why would it not display the call_reason.reason_id?
Thank you very much.
Similar Messages
-
Testing for non-Numeric Data in a varchar2
Hello -
What is the easiest way to test see if there is non-numeric data in a varchar2 column? The column holds ssn values, but I am unable to convert these values to numeric data, because somewhere the column is storing non-numeric data.
Thanks in advance.Maybe something like this ?
SQL> create or replace function test_num (var1 in varchar2) return varchar2
2 is
3 num number;
4 begin
5 num := to_number (var1);
6 return ('Number');
7 exception
8 when others then
9 return ('Character');
10* end;
SQL> /
Function created.
SQL> select test_num ('111') from dual;
TEST_NUM('111')
Number
SQL> select test_num ('aaa') from dual;
TEST_NUM('AAA')
Character
SQL> -
Total for a Numeric field in ALV Grid display
Hi all,
I am not getting the Total for a Numeric field in ALV Grid output. What might be the problem.
Regards,
Balavardhan.KCheck this code for subtotals and totals..
REPORT ZYFI_REPT007
NO STANDARD PAGE HEADING
LINE-SIZE 300
LINE-COUNT 50
MESSAGE-ID ZYFI.
TABLES : COOI, " Commitments Management: Line Items
LFA1, " Vendor master (general section)
VBEP,
RKPLN.
TABLE TYPES AND INTERNAL TABLES *
DATA : BEGIN OF TYP_COOI ,
OBJNR LIKE COOI-OBJNR,
SAKTO LIKE COOI-SAKTO,
MEGBTR LIKE COOI-MEGBTR,
MEINH LIKE COOI-MEINH,
WKGBTR LIKE COOI-WKGBTR,
REFBN LIKE COOI-REFBN,
RFPOS LIKE COOI-RFPOS,
SGTXT LIKE COOI-SGTXT,
BUDAT LIKE COOI-BUDAT,
LIFNR LIKE COOI-LIFNR,
END OF TYP_COOI.
DATA : BEGIN OF TYP_LFA1 ,
LIFNR LIKE LFA1-LIFNR,
NAME1 LIKE LFA1-NAME1,
END OF TYP_LFA1.
DATA : BEGIN OF IT_OUTTAB OCCURS 0,
OBJNR LIKE COOI-OBJNR,
SAKTO LIKE COOI-SAKTO,
MEGBTR LIKE COOI-MEGBTR,
MEINH LIKE COOI-MEINH,
WKGBTR LIKE COOI-WKGBTR,
REFBN LIKE COOI-REFBN,
RFPOS LIKE COOI-RFPOS,
SGTXT LIKE COOI-SGTXT,
BUDAT LIKE COOI-BUDAT,
LIFNR LIKE COOI-LIFNR,
NAME1 LIKE LFA1-NAME1,
END OF IT_OUTTAB.
DATA : IT_COOI LIKE TYP_COOI OCCURS 0 WITH HEADER LINE,
IT_LFA1 LIKE TYP_LFA1 OCCURS 0 WITH HEADER LINE.
*-- ALV Declarations
TYPE-POOLS SLIS.
DATA: IT_EVENTS TYPE SLIS_T_EVENT,
GS_EVENT TYPE SLIS_ALV_EVENT,
wa_fldcat type slis_fieldcat_alv.
DATA: S_LAYOUT TYPE SLIS_LAYOUT_ALV,
GT_PRINT TYPE SLIS_PRINT_ALV.
DATA: IT_FLDCAT TYPE SLIS_T_FIELDCAT_ALV.
DATA: IT_SORT TYPE SLIS_T_SORTINFO_ALV.
DATA: V_REPID LIKE SY-REPID.
SELECTION SCREEN *
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
SELECT-OPTIONS : S_KOKRS FOR COOI-KOKRS NO-EXTENSION NO INTERVALS,
" Controlling Area
S_BUKRS FOR COOI-BUKRS NO-EXTENSION NO INTERVALS,
" Company code
S_GJAHR FOR COOI-GJAHR NO-EXTENSION NO INTERVALS,
" Fiscal Year
S_OBJNR FOR RKPLN-AUFNR MATCHCODE OBJECT ORDE,
" Internal order
S_SAKTO FOR COOI-SAKTO MATCHCODE OBJECT KART,
" Cost Element
S_BUDAT FOR COOI-BUDAT, " Debit Date
S_LIFNR FOR COOI-LIFNR. " Vendor
SELECTION-SCREEN END OF BLOCK B1.
S T A R T O F S E L E C T I O N *
START-OF-SELECTION.
*-- Read data
PERFORM GET_DATA.
E N D O F S E L E C T I O N *
END-OF-SELECTION.
*-- Process the data and prepare the output data
PERFORM CALCULATE_FINAL_INFO.
*--Display Report output
PERFORM DISPLAY_REPORT.
FORM CALCULATE_FINAL_INFO *
Process the data and prepare final internal table *
FORM CALCULATE_FINAL_INFO.
DATA : L_OBJNR LIKE COOI-OBJNR.
SORT IT_LFA1 BY LIFNR.
DELETE ADJACENT DUPLICATES FROM IT_LFA1 COMPARING LIFNR.
LOOP AT IT_COOI.
L_OBJNR = IT_COOI-OBJNR+2(20).
SHIFT L_OBJNR LEFT DELETING LEADING '0'.
IF L_OBJNR IN S_OBJNR.
READ TABLE IT_LFA1 WITH KEY LIFNR = IT_COOI-LIFNR.
IF SY-SUBRC EQ 0.
IT_OUTTAB-NAME1 = IT_LFA1-NAME1.
ENDIF.
MOVE-CORRESPONDING IT_COOI TO IT_OUTTAB.
CLEAR IT_OUTTAB-OBJNR.
IT_OUTTAB-OBJNR = L_OBJNR.
APPEND IT_OUTTAB.
CLEAR IT_OUTTAB.
CLEAR IT_LFA1.
CLEAR L_OBJNR.
ENDIF.
ENDLOOP.
ENDFORM.
*& Form GET_DATA
Fetch the Data from the table COOI and LFA1
FORM GET_DATA.
SELECT OBJNR
SAKTO
MEGBTR
MEINH
WKGBTR
REFBN
RFPOS
SGTXT
BUDAT
LIFNR
FROM COOI
INTO TABLE IT_COOI
WHERE BUDAT IN S_BUDAT
AND LIFNR IN S_LIFNR
AND KOKRS IN S_KOKRS
AND BUKRS IN S_BUKRS
AND GJAHR IN S_GJAHR
AND SAKTO IN S_SAKTO.
IF SY-SUBRC EQ 0 .
Get the Vendor name from LFA1
SELECT LIFNR
NAME1
FROM LFA1
INTO TABLE IT_LFA1
FOR ALL ENTRIES IN IT_COOI
WHERE LIFNR EQ IT_COOI-LIFNR.
ELSE.
MESSAGE I999 WITH TEXT-013.
ENDIF.
ENDFORM. " GET_DATA
*& Form DISPLAY_REPORT
Display the output
FORM DISPLAY_REPORT.
PERFORM BUILD_CATALOG.
PERFORM FRM_PREPARE_EVENT_LIST TABLES IT_EVENTS.
IF NOT IT_OUTTAB[] IS INITIAL.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = V_REPID
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
IT_FIELDCAT = IT_FLDCAT
IT_SORT = IT_SORT
IT_EVENTS = IT_EVENTS
TABLES
T_OUTTAB = IT_OUTTAB
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
ELSE.
MESSAGE I999 WITH TEXT-013.
ENDIF.
ENDFORM. " DISPLAY_REPORT
*& Form BUILD_CATALOG
Build the Field catalog for the ALV Report
FORM BUILD_CATALOG.
DATA: V_INDEX LIKE SY-TABIX.
V_REPID = SY-REPID.
DATA: LS_SORT TYPE SLIS_SORTINFO_ALV.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = V_REPID
I_INTERNAL_TABNAME = 'IT_OUTTAB'
I_INCLNAME = V_REPID
CHANGING
CT_FIELDCAT = IT_FLDCAT
EXCEPTIONS
INCONSISTENT_INTERFACE = 1
PROGRAM_ERROR = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
READ TABLE IT_FLDCAT WITH KEY FIELDNAME = 'WKGBTR'
TABNAME = 'IT_OUTTAB' INTO WA_FLDCAT.
IF SY-SUBRC EQ 0.
WA_FLDCAT-DO_SUM = 'X'.
MODIFY IT_FLDCAT FROM WA_FLDCAT INDEX SY-TABIX.
ENDIF.
READ TABLE IT_FLDCAT WITH KEY FIELDNAME = 'OBJNR'
TABNAME = 'IT_OUTTAB' INTO WA_FLDCAT.
IF SY-SUBRC EQ 0.
WA_FLDCAT-SELTEXT_L = 'Order'.
WA_FLDCAT-COL_POS = 1.
WA_FLDCAT-DDICTXT = 'L'.
MODIFY IT_FLDCAT FROM WA_FLDCAT INDEX SY-TABIX.
ENDIF.
LS_SORT-FIELDNAME = 'OBJNR'.
LS_SORT-SPOS = 1.
LS_SORT-UP = 'X'.
LS_SORT-SUBTOT = 'X'.
APPEND LS_SORT TO IT_SORT.
ENDFORM. " BUILD_CATALOG
*& Form FRM_PREPARE_EVENT_LIST
Build the Events
FORM FRM_PREPARE_EVENT_LIST TABLES IT_EVENTS TYPE SLIS_T_EVENT.
CLEAR GS_EVENT.
GS_EVENT-NAME = SLIS_EV_TOP_OF_PAGE.
GS_EVENT-FORM = 'TOP_OF_PAGE_REPORT'.
APPEND GS_EVENT TO IT_EVENTS.
ENDFORM. " FRM_PREPARE_EVENT_LIST
TOP OF PAGE
FORM TOP_OF_PAGE_REPORT.
CALL FUNCTION 'Z_YREPORT_HEADER'
EXPORTING
DL_TITLE = SY-TITLE
DL_REPID = SY-CPROG
DL_LINSZ = SY-LINSZ
EXCEPTIONS
OTHERS = 1.
ENDFORM. " FRM_TOP_OF_PAGE_REPORT
*& Form USER_COMMAND
Drill Down Functionality to Call the Transaction ME23
FORM USER_COMMAND USING P_UCOMM LIKE SY-UCOMM
P_SELFIELD TYPE SLIS_SELFIELD.
DATA : L_INDEX LIKE SY-INDEX,
L_REFBN LIKE COOI-REFBN.
L_INDEX = P_SELFIELD-TABINDEX. " holds the selected table index
CLEAR L_REFBN.
CASE P_UCOMM.
*-- On Double Click
WHEN '&IC1'.
CLEAR L_REFBN.
*-- Read the Current Line
READ TABLE IT_OUTTAB INDEX L_INDEX.
IF SY-SUBRC EQ 0.
L_REFBN = IT_OUTTAB-REFBN.
IF NOT L_REFBN IS INITIAL.
*-- Set the BES Paramater Id to the Current line Purchase Order Number
SET PARAMETER ID 'BES' FIELD L_REFBN.
*-- Call the Transaction Purchase Order Display with the above PO Number
CALL TRANSACTION 'ME23' AND SKIP FIRST SCREEN.
ENDIF.
ELSE.
MESSAGE E999 WITH TEXT-014.
ENDIF.
ENDCASE.
ENDFORM. " USER_COMMAND -
hi could you pls tell me how to do the subtotal for non-numeric fields in ALV.
see the following example
REPORT z_demo_alv_total.
TYPES :
BEGIN OF ty_vbak,
vkorg TYPE vbak-vkorg, " Sales organization
kunnr TYPE vbak-kunnr, " Sold-to party
vbeln TYPE vbak-vbeln, " Sales document
netwr TYPE vbak-netwr, " Net Value of the Sales Order
waerk TYPE vbak-waerk, " Document currency
END OF ty_vbak.
DATA:
vbak TYPE vbak,
gt_vbak TYPE TABLE OF ty_vbak.
SELECT-OPTIONS :
s_vkorg FOR vbak-vkorg, " Sales organization
s_kunnr FOR vbak-kunnr, " Sold-to party
s_vbeln FOR vbak-vbeln. " Sales document
SELECTION-SCREEN :
SKIP, BEGIN OF LINE,COMMENT 5(27) v_1 FOR FIELD p_max.
PARAMETERS p_max(2) TYPE n DEFAULT '20' OBLIGATORY.
SELECTION-SCREEN END OF LINE.
INITIALIZATION.
v_1 = 'Maximum of records to read'.
START-OF-SELECTION.
PERFORM f_read_data.
PERFORM f_display_data.
* Form f_read_data
FORM f_read_data.
SELECT vkorg kunnr vbeln netwr waerk
UP TO p_max ROWS
INTO TABLE gt_vbak
FROM vbak
WHERE kunnr IN s_kunnr
AND vbeln IN s_vbeln
AND vkorg IN s_vkorg.
ENDFORM. " F_READ_DATA
* Form f_display_data
FORM f_display_data.
TYPE-POOLS: slis. " ALV Global types
DEFINE m_fieldcat.
add 1 to ls_fieldcat-col_pos.
ls_fieldcat-fieldname = &1.
ls_fieldcat-ref_tabname = 'VBAK'.
ls_fieldcat-do_sum = &2.
ls_fieldcat-cfieldname = &3.
append ls_fieldcat to lt_fieldcat.
END-OF-DEFINITION.
DEFINE m_sort.
add 1 to ls_sort-spos.
ls_sort-fieldname = &1.
ls_sort-up = 'X'.
ls_sort-subtot = &2.
append ls_sort to lt_sort.
END-OF-DEFINITION.
DATA:
ls_fieldcat TYPE slis_fieldcat_alv,
lt_fieldcat TYPE slis_t_fieldcat_alv,
lt_sort TYPE slis_t_sortinfo_alv,
ls_sort TYPE slis_sortinfo_alv,
ls_layout TYPE slis_layout_alv.
m_fieldcat 'VKORG' '' ''.
m_fieldcat 'KUNNR' '' ''.
m_fieldcat 'VBELN' '' ''.
m_fieldcat 'NETWR' 'X' 'WAERK'.
m_fieldcat 'WAERK' '' ''.
m_sort 'VKORG' 'X'. " Sort by vkorg and subtotal
m_sort 'KUNNR' 'X'. " Sort by kunnr and subtotal
m_sort 'VBELN' ''. " Sort by vbeln
ls_layout-cell_merge = 'X'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
is_layout = ls_layout
it_fieldcat = lt_fieldcat
it_sort = lt_sort
TABLES
t_outtab = gt_vbak.
ENDFORM. " F_DISPLAY_DATA -
Using MODEL clause and COUNT for not numeric data columns....
Hi ,
Is it possible somehow to use the COUNT function to transform a non-numeric data column to a numeric data value (a counter) and be used in a MODEL clause....????
For example , i tried the following in the emp table of SCOTT dataschema with no desired result...
SQL> select deptno , empno , hiredate from emp;
DEPTNO EMPNO HIREDATE
20 7369 18/12/1980
30 7499 20/02/1981
30 7521 22/02/1981
20 7566 02/04/1981
30 7654 28/09/1981
30 7698 01/05/1981
10 7782 09/06/1981
20 7788 18/04/1987
10 7839 17/11/1981
30 7844 08/09/1981
20 7876 21/05/1987
30 7900 03/12/1981
20 7902 03/12/1981
10 7934 23/01/1982
14 rows selected Now , i want to use the MODEL clause in order to 'predict' the number of employees who were going to be hired in the 1990 per deptno...
So , i have constructed the following query which , as expected, does not return the desired results....
SQL> select deptno , month , year , count_
2 from
3 (
4 select deptno , to_number(to_char(hiredate,'mm')) month ,
5 to_number(to_char(hiredate , 'rrrr')) year , count(ename) count_
6 from emp
7 group by deptno , to_number(to_char(hiredate,'mm')) ,
8 to_number(to_char(hiredate , 'rrrr'))
9 )
10 model
11 partition by(deptno)
12 dimension by (month , year)
13 measures (count_ )
14 (
15 count_[1,1990]=count_[1,1982]+count_[11,1982]
16 )
17 /
DEPTNO MONTH YEAR COUNT_
30 5 1981 1
30 12 1981 1
30 2 1981 2
30 9 1981 2
30 1 1990
20 4 1987 1
20 5 1987 1
20 4 1981 1
20 12 1981 1
20 12 1980 1
20 1 1990
10 6 1981 1
10 11 1981 1
10 1 1982 1
10 1 1990 As you see , the measures for the 1990 year is null...because the measure(the count(deptno)) is computed via the group by and not by the MODEL clause...
How should i transform the above query... so as the "count_[1,1982]+count_[11,1982]" will return non-null results per deptno...????
Thanks , a lot
SimonConnected to Oracle Database 10g Express Edition Release 10.2.0.1.0
Connected as hr
SQL>
SQL> SELECT department_id, MONTH, YEAR, count_
2 FROM (SELECT e.department_id
3 ,to_number(to_char(e.hire_date, 'mm')) MONTH
4 ,to_number(to_char(e.hire_date, 'rrrr')) YEAR
5 ,COUNT(e.first_name) count_
6 FROM employees e
7 WHERE e.department_id = 20
8 GROUP BY e.department_id
9 ,to_number(to_char(e.hire_date, 'mm'))
10 ,to_number(to_char(e.hire_date, 'rrrr')));
DEPARTMENT_ID MONTH YEAR COUNT_
20 8 1997 1
20 2 1996 1
SQL> --
SQL> SELECT department_id, MONTH, YEAR, count_
2 FROM (SELECT e.department_id
3 ,to_number(to_char(e.hire_date, 'mm')) MONTH
4 ,to_number(to_char(e.hire_date, 'rrrr')) YEAR
5 ,COUNT(e.first_name) count_
6 FROM employees e
7 WHERE e.department_id = 20
8 GROUP BY e.department_id
9 ,to_number(to_char(e.hire_date, 'mm'))
10 ,to_number(to_char(e.hire_date, 'rrrr')))
11 model
12 PARTITION BY(department_id)
13 dimension BY(MONTH, YEAR)
14 measures(count_)(
15 count_ [1, 1990] = count_ [2, 1996] + count_ [8, 1997]
16 );
DEPARTMENT_ID MONTH YEAR COUNT_
20 8 1997 1
20 2 1996 1
20 1 1990 2
SQL> ---
SQL> SELECT department_id, MONTH, YEAR, count_
2 FROM (SELECT e.department_id
3 ,to_number(to_char(e.hire_date, 'mm')) MONTH
4 ,to_number(to_char(e.hire_date, 'rrrr')) YEAR
5 ,COUNT(e.first_name) count_
6 FROM employees e
7 GROUP BY e.department_id
8 ,to_number(to_char(e.hire_date, 'mm'))
9 ,to_number(to_char(e.hire_date, 'rrrr')))
10 model ignore nav
11 PARTITION BY(department_id)
12 dimension BY(MONTH, YEAR)
13 measures(count_)(
14 count_ [1, 1990] = count_ [2, 1996] + count_ [8, 1997]
15 );
DEPARTMENT_ID MONTH YEAR COUNT_
100 8 1994 2
30 12 1997 1
100 3 1998 1
30 7 1997 1
5 1999 1
30 12 1994 1
30 11 1998 1
30 5 1995 1
100 9 1997 2
100 12 1999 1
30 8 1999 1
1 1990 0
30 1 1990 0
100 1 1990 0
90 9 1989 1
20 8 1997 1
70 6 1994 1
93 rows selected
SQL> -
Compare non numeric data using arithmetic operations
Hi
Is there anyway to compare the non numeric data in a table to a numeric number.
Want to run a query like
SELECT rank_id
FROM mas_rank
WHERE rank_code > 26 Rank_code contains numeric as well as some non numeric data
Thanx for the helpYes, it will work if you just say > '26' See this demo :
SQL> create table mas_rank(rank_id number,rank_code varchar2(2));
Table created.
SQL> insert into mas_rank values (100,'aa');
1 row created.
SQL> insert into mas_rank values (101,'ab');
1 row created.
SQL> insert into mas_rank values (102,'ad');
1 row created.
SQL> insert into mas_rank values (103,'ag');
1 row created.
SQL> insert into mas_rank values (104,'ac');
1 row created.
SQL> insert into mas_rank values (105,'22');
1 row created.
SQL> insert into mas_rank values (106,'25');
1 row created.
SQL> insert into mas_rank values (107,'26');
1 row created.
SQL> insert into mas_rank values (108,'27');
1 row created.
SQL> insert into mas_rank values (109,'aa');
1 row created.
SQL> insert into mas_rank values (110,'28');
1 row created.
SQL> SELECT rank_id
2 FROM mas_rank
3 WHERE rank_code not in ('ab','ad','ag')
4 and rank_code > 26;
and rank_code > 26
ERROR at line 4:
ORA-01722: invalid number
SQL> ed
Wrote file afiedt.buf
1 SELECT rank_id
2 FROM mas_rank
3 WHERE rank_code not in ('ab','ad','ag')
4* and rank_code > '26'
SQL> /
RANK_ID
100
104
108
109
110
SQL>Regards
Girish Sharma -
Hi,
Why Essbase database can store only "numeric" data is there any workaround to store "non-numeric" data in EssbaseTo expand on this, an analytical view of such data is questionable. While you could aggregate/consolidate and even analyze non-numeric (i.e. categorical responses), the business needs of such analysis are almost always better served with more appropriate tools.
Compare this with regions, time, accounts -- where the structure of the database has an inherent consolidation or mathematical relationship. Deriving value from these numeric relationships is where multidimension analysis thrives.
With text information, you would need to create artificial relationships for the different "values" that at best represent weighted values, not completely useless but again, the right tool would do you better. It seems to me like another case of using a hammer to pound a screw in because the screw driver is still in the tool box.
Some over-eager (read: young) essbase developers love to throw the database logs into essbase cubes, too -- which is rather silly to me (if they don't have enough to keep them busy answering the user's needs, perhaps they should look for additional users...). The two issues have one thing in common: allowing the technology to dictate effort, rather than responding to a business need with targeted solutions.
Hmmm, maybe I'll create a cube to store the number of added members by dimension and the database statistics across time so I can prove to my boss that I'm wasting enough time on boondoggles every day. Well, at least THAT data is numeric...
The above was all said tongue in cheek -- you can use oddball things like this to answer some interesting questions. I just think that if you have questions like that, you should go talk to the CFO and finance departments a bit more to see what kind of questions you COULD be answering. -
Is it possible to upload non-numeric data into Planning from ODI?
Dear All,
I have problem to upload non-numeric data into planning?
Regards,
ThomasI am not sure what that has to do with non-numeric data and planning.
If you want to move your ODI environment then have a look at this post :- Re: move full ODI environment to another Machine...
Cheers
John
http://john-goodwin.blogspot.com/ -
How do I import non-numeric data into DIAdem?
I have some non-numeric data in an Excel file which I would like to import into DIAdem. DIAdem recognizes the file and imports some of the data, but it only imports those cells that are purely numeric. Cells containing non-numeric characters are ignored. But I need that non-numeric data! How do I force DIAdem to import everything? (Some controls appear in the import dialog that seem like they might be useful here but they're greyed out.)
Hi There,
You can not load text columns from ASCII files into DIAdem 8.1 DATA channels (numbers only). But the ASCII Import Wizard will let you send those text values to either a separate ASCII file, which DIAdem can use to put them on a graph as labels, or to a DIAdem string array, which DIAdem can use to display them at various places in its environment.
The below attachments demonstrate reading an ASCII text column into a DIAdem string array and displaying the values on a DIAdem table in GRAPH. Note that the index values of the string array are placed in a DIAdem DATA channel.
Ask if you have further questions,
Brad Turpin
NI
Attachments:
ASCII_Text_Column.txt 1 KB
ASCII_Text_Column.STP 1 KB
ASCII_Text_Column.LPD 3 KB -
Mapping deploy for Non-Oracle Data Source hangs
Hi All,
I am trying to deploy mapping for Non-Oracle Data Source and it hangs.
Oracle version is 10.2.0.3 and OWB version is 10.2.0.1.3.1
It would be really appreciated if you can help.
Thanks!
PS.That helpes quite a bit. I still can't get the app to retrieve data, but I am getting a more useful message in the log:
[Error in allocating a connection. Cause: Connection could not be allocated because: ORA-01017: invalid username/password; logon denied]
As you suggested, I removed the <default-resource-principal> stuff from sun-web.xml and modified it to match your example. Additionally, I changed the <res-ref-name> in web.xml from "jdbc/jdbc-simple" to "jdbc/oracle-dev".
The Connection Pool "Ping" from the Admin Console is successful with the user and password I have set in the parameters. (it fails if I change them, so I am pretty sure that is set up correctly) Is there another place I should check for user/pass information? Do I need to do anything to the samples/database.properties file?
By the way, this is the 4th quarter 2004 release of app server. Would it be beneficial to move to the Q1 2005 beta?
Many thanks for your help so far... -
Hi,
I have to check the data in Varchar2 field idtr and if it is numeric some actions are to be done on the data and if it is numeric some other different action is to be done.
So I used some logic for finding whether the data is numeric or non numeric which I got it from the net.
Now my problem is all decimal numbers are to be treated as numeric but this logic is treating decimals as non numeric and I am not able to proceed further.
Can some one help me out in this issue.
Below is the Logic and actions I am doing
select pol_id,lpad(substr(trunc(to_number(idtr),0),1,10),10,0),idtr
from pl_insrd
where length(idtr) - length(translate(idtr,chr(1)||translate(idtr,CHR(1)||'1234567890',CHR(1) ),CHR(1) ) ) = 0
and length(idtr) > 9
UNION
select pol_id,lpad(trunc(idtr,0),10,0),idtr
from pl_insrd
where length(idtr) - length(translate(idtr,chr(1)||translate(idtr,CHR(1)||'1234567890',CHR(1) ),CHR(1) ) ) = 0
and length(idtr) < 10
UNION
select pol_id,substr(idtr,1,10),idtr
from pl_insrd
where length(idtr) - Length(TRANSLATE(idtr,CHR(1)||TRANSLATE(idtr,CHR(1)||'1234567890', CHR(1) ), CHR(1) ) ) > 0
and length(idtr) > 9
UNION
select pol_id,lpad(idtr,10,0),idtr
from pl_insrd
where length(idtr) - Length(TRANSLATE(idtr,CHR(1)||TRANSLATE(idtr,CHR(1)||'1234567890', CHR(1) ), CHR(1) ) ) > 0
and length(idtr) < 10<quote>One I provided was I found at asktom.oracle.com</quote>
So? ... If you'd provided a link then one could see the entire context for that particular snippet of code and decide if it is indeed appropriate. As shown by Angus it is not always appropriate ... add to that, NULL is not a number as that function reports.
<quote>It's using replace and transalate functions which are less expensive then To_Number function.</quote>
Proof?
<quote>I agree with you [John], that's the best function you can use to validate data for numeric.<quote>
I don't agree to_number() is [always] the best way ... the easiest way? ... maybe.
My personal view is that there is no universal way to determine if a string, in all circumstances, can be translated into a number. One has to have knowledge of the source data domain ... only you know if, in your particular circumstance, '1e4' is or is not a NUMBER represented as a string.
flip@FLOP> select to_number('1e3') from dual;
TO_NUMBER('1E3')
1000 -
Creating a Crystal Report from a non-SAP data base
I have the following scenario
server1\myDataBase
server1\SAP\sapDataBases
in sapDataBases I have about 30 company databases. I am trying to create a report, that gets informatino from a table/view/SP from server1\myDataBase, when I try to PREVIEW or SAVE such report on SAP Business One, I always get errors as
I understand that this eerror means taht I can't invoke the data from out of SAP; it needs to be inside SAP (at least the SP, incoking some other data bases and stuff..)
Some bodies have told me that it is beacuase I can only create a report from a table/view/sp that resides in the running/currently SAP company database. Is this right?
Also, If this is the case, this means that If I have an SP taht I use for a crystal report, and 30 companies, I have to create such SP in the 30 companies?
This is my software details:
SQL Server 2012
SAP Business One 9 PL 11
SAP BusinessObjects Crystal Reports 2013 Support Pack 2 version 14.1.2.1121
What I want to do is to create a non-SAP data base to create all the SPs/Views for reports, to centralize it, and the just create one reporte and do the 30-imports in each company database, without the need of creating such sps/views in each company-database. Is this possible?
ThanksMoved to Integration Kit forum.
The people in this forum will know more about the data structure than the CR Design forum which typically doesn't know much about the SAP Data sources Structure.
Don -
Need Help for Non Transactional Data
Hi,
I need your help for getting the non-transactional data. I am looking for some solution where I can have employee list with both transaction and non transaction along with the measure in the report.
Thanks in advance.
Phani.Looks like you either want a procedure with OUT parameters, or to return a record (which you'd need to declare somewhere that your function and calling procedure can both see)
-
Report Painter for Non Leading Ledger (Error GH113)
Hi,
Kindly note that we are in the process of enhancing a report for Monthly Balance Sheet as per our client's requirement. The report is based on report painter and we want to add Ledger as an input selection so that the report can be run for Leading Ledger(0L) and for Non Leading ledger(CL)as well .Initially there was no ledger selection and the report ran only for Leading ledger (0L). However when we try to run it for non leading ledger CL it throws an error message GH113 (more than one ledger not allowed in drill down report.)
Our ABAP Consultants have investigated this issue and suggested that for field (RLDNR) ledger the program is picking up "CL" as per input selection , However 0L is also getting captured thereby resulting in conflict and consequently throwing error GH113.
Concern
1) Does this report has a constraint that it can be run only for leading ledger and not for non leading ledger?
2) Apart from report painter form are there any other default setting which extracts "0L" and puts in the report.
Also note that the report painter form settings have been checked thoroughly and ledger has been defined as local variable for input selection.
ThanksHi,
Thanks for your quick response. I have already added the ledger as part of report selection and declared it as a local variable so that input selection is possible. but When I select the non leading ledger "CL" and try to execute report it throws error message GH113.
have checked all the settings in report painter form and not too sure as to from where the report is picking up Leading ledger "0L" although as a part of input selection i have selected non leading ledger "CL"
Appreciate your response.
Thanks -
Check for non-numeric characters in textbox input
I have a form with several textboxes, each of which can accept numeric input. I want to write a validation/ plsql block that checks for a non-numeric character in the input, so that my user sees a customized error message rather than a database error. Any tips on how I can achieve that? Is there any function like "isalpha" in C, which can directly do the job?
Also, some of these numeric fields should allow commas, since people put commas in larger numbers.
Any help is greatly appreciated.Arie,
i figured it out. turns out, i had some confusion in my mind. i modified Taneal's solution to use it in my already existing validations of type 'function returning error text' and it works fine.
the problem before was that i was running 2 separate validations on the same field, and probably due to the sequence numbers, i was getting a numeric or value error. now, i've combined all validations into a single validation and it works fine.
and honestly, i'm pretty bad with reg. ex. :D
Maybe you are looking for
-
Hi, I would like to know how to calculate the depreciation when we are implementing the sap in middle of the finacial year With regards, V.K
-
10.5.8 vs. Adobe Acrobat -- Can't create PDFs
Upgraded to OS X 10.5.8 on my G4 Powerbook. Lost ability to create PDFs. Won't create them from the menu on Word, Excel, or when I tell an InDesign item to print as a PDF, for example If I try to create PDF through Adobe Acrobat (7.1.0) the message s
-
Strange behaviour when placing text frame on top of image
Hi, Win XP, FM 8.04 I have a front cover that consists of a TIF image that bleeds off the page. On top of that image I want to put a text frame with the book title. The strange thing is that when I create the text frame and use the toolbar buttons to
-
View with outer join results wrong number of rows
Hi, When i run a query on a view it returns 2 rows(2 distinct rows), when i run the same query with the select statement which the view is created , it returns only 1 row. According to data the 1 row result is correct, how come twi results. A coding
-
User Field (in Cost Activity)
Hi, Someone knows where are stored (which table) the data enter in the User Field Tab on a Cost Activity in PS ? Thanks in advance Aleksi