Help in mandatory query - pulling data from two tables and inserting a
Hi allI need your help for the modification of the query to get the desired result.
I have two tables A and b. using source Insert and select the command, I need to extract data from tables A and B, then insert and C.
Data and table structures are available below.
Table (Source Table)
Status of payment $
MUL DC 20
ONLY DC 20
ONLY 40 PA
MUL NY 50
Table B (Source Table)
State of lang units
E DC 10
S DC 10
NY E 5
PA S 5
Based on query, I need the values in table C as mentioned below.
Table C (Table of Destination) (necessary output query must also be as below)
The State value
PA 8
DC 1
My query is
INSERT INTO C(STATE,VALUE)
SELECT A.STATE, SUM ($) /SUM (UNITS)
OF A, B
WHERE PAYMENT = "SINGLE".
AND A.STATE = B.STATE
GROUP OF A.STATE, B.STATE
But the output I get is
PA 8
DC 2
Essentially to DC, I should get 1, i.e., for payment only $ DC is 20 and divided by 20 DC must be 1.
Let me know where I'm missing.
Hello
It will work you need to add units in the group by clause
SELECT a.state, SUM (dollars) / units
FROM a, (SELECT state, SUM (units) units
FROM b
GROUP BY state) sub
WHERE payment = 'SINGLE' AND a.state = sub.state
GROUP BY a.state, units;
Concerning
Tags: Database
Similar Questions
-
Extraction of data from two tables without discounting
Hi friends,
I have a problem I want to extract data from two tables without discount in the text field when I will enter any value in a text field, then the value of corressponding must come to textfield corressponding.
for example. There are two table A and B.
Table A has Colunm
S_ID number;
C_ID Varchar2 (30);
VARCHAR2 (4) s;
Second table B Colunm name
S_ID number;
What varchar (30);
L_Name varchar (20);
When I enter in a text field then the c_id 101 s_id, dry, first_name and last_name should come to corressponding text without refresh fields.
How can I do that.
Thank you
MauryYou can use Ajax and there are tons of good examples out there for this purpose;
For example [http://apex.oracle.com/pls/otn/f?p=31517:236:1876567353842241] -
Display data from two tables based on date criteria
Hi all
I have two tables, using these two tables and a few conditions I want to recover under result. Oracle version is (Oracle9i Enterprise Edition Release 9.2.0.8.0 - 64 bit Production)
logon_histories_r table records the information of each user who connects to the system. Subscriber Details table contains all the information corresponding to subscriber_no, only 1 row should be returned.LOGON_ID USER_ID LOGON_TIME LOGON_TYPE SUBSCRIBER_NO CUSTOMER_ID 26063548 4528890298 4/5/2010 12:03:58 AM MSISDN GSM04528890298 581751708
I'm confused usage date condition for the table of the Subscriber, the input parameter date 04/04/2006 to 15/04/06
Select lh.logon_id, lh.user_id, lh.logon_time, lh.logon_type, subs.subscriber_no, subs.customer_id
of logon_histories_r lh, subscribed subs
where lh.logon_time > = to_date('05-04-2010','dd-mm-yyyy')--to_date('04-04-2006','dd-mm-yyyy')
and lh.logon_time < to_date('06-04-2010','dd-mm-yyyy')--to_date('15-01-2007','dd-mm-yyyy')
and lh.user_id = substr (subs.subscriber_no,-10);
If the date range is 04/05/2010 to 04/06/2010 then the data related to the BAN 581751708 must be the result,
If the date range is 04/04/2006 to 15/01/2007 data related to the BAN 502499502 must be the result.
Please find DDL and data relevant to these results. There are millions of records of Subscriber & logon_histories_r table, I am given appropriate providing a subscriber_id.
CREATE TABLE LOGON_HISTORIES_R ( LOGON_ID NUMBER(12) NOT NULL, USER_ID VARCHAR2(15 BYTE) NOT NULL, LOGON_TIME DATE NOT NULL, LOGOUT_TIME DATE, LOGOUT_METHOD VARCHAR2(15 BYTE), LOGON_TYPE VARCHAR2(15 BYTE) DEFAULT 'MSISDN' ); CREATE TABLE SUBSCRIBER ( SUBSCRIBER_NO VARCHAR2(20 BYTE) NOT NULL, CUSTOMER_ID NUMBER(9) NOT NULL, SYS_CREATION_DATE DATE NOT NULL, SYS_UPDATE_DATE DATE, OPERATOR_ID NUMBER(9), APPLICATION_ID CHAR(6 BYTE), DL_SERVICE_CODE CHAR(5 BYTE) NOT NULL, DL_UPDATE_STAMP NUMBER(4), EFFECTIVE_DATE DATE NOT NULL, INIT_ACTIVATION_DATE DATE NOT NULL, SUB_STATUS CHAR(1 BYTE) NOT NULL, SUB_STATUS_DATE DATE NOT NULL, ORIGINAL_INIT_DATE DATE NOT NULL, SUB_STATUS_LAST_ACT CHAR(3 BYTE), SUB_STATUS_RSN_CODE CHAR(4 BYTE), PRODUCT_TYPE CHAR(3 BYTE), CUSTOMER_BAN NUMBER(9), CTN_SEQ_NO NUMBER(9), REQ_ST_GRACE_PERIOD DATE, REQ_END_GRACE_PERIOD DATE, COMMIT_START_DATE DATE, COMMIT_END_DATE DATE, COMMIT_REASON_CODE CHAR(3 BYTE), COMMIT_ORIG_NO_MONTH NUMBER(3), SUSP_RC_RATE_TYPE CHAR(1 BYTE), CONTRACT_NO VARCHAR2(10 BYTE), CNT_SEQ_NO NUMBER(9), DEALER_CODE CHAR(5 BYTE), ORG_DEALER_CODE CHAR(5 BYTE), SALES_AGENT CHAR(5 BYTE), ORG_SALES_AGENT CHAR(5 BYTE), REQ_DEPOSIT_AMT NUMBER(13,2), LEADING_NUMBER VARCHAR2(20 BYTE), PABX_IND CHAR(1 BYTE), NEXT_CTN VARCHAR2(20 BYTE), NEXT_CTN_CHG_DATE DATE, PRV_CTN VARCHAR2(20 BYTE), PRV_CTN_CHG_DATE DATE, NEXT_BAN NUMBER(9), NEXT_BAN_MOVE_DATE DATE, PRV_BAN NUMBER(9), PRV_BAN_MOVE_DATE DATE, SUB_STS_ISSUE_DATE DATE, ACTIVATE_WAIVE_RSN CHAR(6 BYTE), EARLIEST_ACTV_DATE DATE, SUB_ACTV_LOCATION CHAR(4 BYTE), CUST_WATCH_LMT NUMBER(11,2), CUST_WATCH_DATE DATE, BASIC_WATCH_LMT NUMBER(11,2), CREDIT_WATCH_PIN_CD NUMBER(4), SUB_MARKET_CODE CHAR(3 BYTE) NOT NULL, LIMIT_RESERVED_DAYS NUMBER(4), FF_EXPIRATION_DATE DATE, FLEX_IND CHAR(1 BYTE), DUO_IND CHAR(1 BYTE), LISTED_IND CHAR(1 BYTE), SUB_DEPARTMENT_CD CHAR(4 BYTE), LAST_SUBS_DISC_DT DATE, LAST_SUBS_DISC_DT_UD DATE, LAST_SUBSCR_DISC_SN NUMBER(3), LAST_SUBSCR_DISC_SN_UD NUMBER(3), PNI VARCHAR2(10 BYTE), RMS_REF_STORE_ID CHAR(4 BYTE), RMS_REF_TYPE CHAR(1 BYTE), RMS_REF_OD NUMBER(9), DLR_ACT_FEE NUMBER(11,2), PREP_AMOUNT NUMBER(11,2), SUBSCRIBER_ID NUMBER(9) NOT NULL, SUB_LANG CHAR(2 BYTE), SMS_RCV_STYLE_CODE CHAR(2 BYTE), CONV_RUN_NO NUMBER(3), ALLOW_ADVERTISING_IND CHAR(1 BYTE), IVR_WRONG_ACCESS_NO NUMBER(2), THRESHOLD_AMT NUMBER(11,2), PUBLISH_LEVEL CHAR(30 BYTE), AUTO_RELEASE_IND CHAR(1 BYTE), CUST_WATCH_EFF_DATE DATE, CUST_WATCH_EXP_DATE DATE, OPERATOR_CW_LMT NUMBER(11,2), SEND_SMS_FOR_MATCH CHAR(1 BYTE), CPS_STATUS CHAR(1 BYTE), CPS_TRANSACTION NUMBER(3), CPS_TYPE NUMBER(3), ISP_PASS VARCHAR2(30 BYTE), ISP_TYPE CHAR(2 BYTE), OPERATOR_TMP_DATE DATE, OPERATOR_TMP_LMT NUMBER(11,2), SUB_ORG_CD CHAR(10 BYTE), ORG_MEMBER_NO VARCHAR2(20 BYTE) ); Insert into LOGON_HISTORIES_R (LOGON_ID, USER_ID, LOGON_TIME, LOGOUT_TIME, LOGOUT_METHOD, LOGON_TYPE) Values (26063548, '4528890298', TO_DATE('04/05/2010 00:03:58', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('04/05/2010 00:06:58', 'MM/DD/YYYY HH24:MI:SS'), NULL, 'MSISDN'); Insert into logon_histories_r (LOGON_ID, USER_ID, LOGON_TIME, LOGOUT_TIME, LOGOUT_METHOD, LOGON_TYPE) Values (2649592, '4528890298', TO_DATE('04/10/2006 19:19:20', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('04/10/2006 19:19:48', 'MM/DD/YYYY HH24:MI:SS'), 'TIMEOUT', 'MSISDN'); Insert into SUBSCRIBER (SUBSCRIBER_NO, CUSTOMER_ID, SYS_CREATION_DATE, SYS_UPDATE_DATE, OPERATOR_ID, APPLICATION_ID, DL_SERVICE_CODE, DL_UPDATE_STAMP, EFFECTIVE_DATE, INIT_ACTIVATION_DATE, SUB_STATUS, SUB_STATUS_DATE, ORIGINAL_INIT_DATE, SUB_STATUS_LAST_ACT, SUB_STATUS_RSN_CODE, PRODUCT_TYPE, CUSTOMER_BAN, CTN_SEQ_NO, REQ_ST_GRACE_PERIOD, REQ_END_GRACE_PERIOD, COMMIT_START_DATE, COMMIT_END_DATE, COMMIT_REASON_CODE, COMMIT_ORIG_NO_MONTH, SUSP_RC_RATE_TYPE, CONTRACT_NO, CNT_SEQ_NO, DEALER_CODE, ORG_DEALER_CODE, SALES_AGENT, ORG_SALES_AGENT, REQ_DEPOSIT_AMT, LEADING_NUMBER, PABX_IND, NEXT_CTN, NEXT_CTN_CHG_DATE, PRV_CTN, PRV_CTN_CHG_DATE, NEXT_BAN, NEXT_BAN_MOVE_DATE, PRV_BAN, PRV_BAN_MOVE_DATE, SUB_STS_ISSUE_DATE, ACTIVATE_WAIVE_RSN, EARLIEST_ACTV_DATE, SUB_ACTV_LOCATION, CUST_WATCH_LMT, CUST_WATCH_DATE, BASIC_WATCH_LMT, CREDIT_WATCH_PIN_CD, SUB_MARKET_CODE, LIMIT_RESERVED_DAYS, FF_EXPIRATION_DATE, FLEX_IND, DUO_IND, LISTED_IND, SUB_DEPARTMENT_CD, LAST_SUBS_DISC_DT, LAST_SUBS_DISC_DT_UD, LAST_SUBSCR_DISC_SN, LAST_SUBSCR_DISC_SN_UD, PNI, RMS_REF_STORE_ID, RMS_REF_TYPE, RMS_REF_OD, DLR_ACT_FEE, PREP_AMOUNT, SUBSCRIBER_ID, SUB_LANG, SMS_RCV_STYLE_CODE, CONV_RUN_NO, ALLOW_ADVERTISING_IND, IVR_WRONG_ACCESS_NO, THRESHOLD_AMT, PUBLISH_LEVEL, AUTO_RELEASE_IND, CUST_WATCH_EFF_DATE, CUST_WATCH_EXP_DATE, OPERATOR_CW_LMT, SEND_SMS_FOR_MATCH, CPS_STATUS, CPS_TRANSACTION, CPS_TYPE, ISP_PASS, ISP_TYPE, OPERATOR_TMP_DATE, OPERATOR_TMP_LMT, SUB_ORG_CD, ORG_MEMBER_NO) Values ('GSM04528890298', 110069191, TO_DATE('12/04/2001 17:06:17', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('01/01/2004 22:42:49', 'MM/DD/YYYY HH24:MI:SS'), NULL, 'FUTRX ', 'CS016', NULL, TO_DATE('01/02/2004 00:08:32', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('07/31/2000 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'C', TO_DATE('01/02/2004 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('07/31/2000 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'CAN', 'CNP3', 'GSM', 110069191, 7013986, NULL, NULL, TO_DATE('07/31/2000 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('01/31/2001 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'PPD', 6, NULL, NULL, 1008631, 'DCNV ', 'DCNV ', 'DFLT ', 'DFLT ', 0, NULL, 'S', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, TO_DATE('01/02/2004 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), NULL, TO_DATE('07/31/2000 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'TEMO', 0, NULL, 0, NULL, 'TEL', NULL, NULL, 'N', 'N', 'Y', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 8635, 'DK', '01', 1, 'N', NULL, 0, '1234', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); Insert into SUBSCRIBER (SUBSCRIBER_NO, CUSTOMER_ID, SYS_CREATION_DATE, SYS_UPDATE_DATE, OPERATOR_ID, APPLICATION_ID, DL_SERVICE_CODE, DL_UPDATE_STAMP, EFFECTIVE_DATE, INIT_ACTIVATION_DATE, SUB_STATUS, SUB_STATUS_DATE, ORIGINAL_INIT_DATE, SUB_STATUS_LAST_ACT, SUB_STATUS_RSN_CODE, PRODUCT_TYPE, CUSTOMER_BAN, CTN_SEQ_NO, REQ_ST_GRACE_PERIOD, REQ_END_GRACE_PERIOD, COMMIT_START_DATE, COMMIT_END_DATE, COMMIT_REASON_CODE, COMMIT_ORIG_NO_MONTH, SUSP_RC_RATE_TYPE, CONTRACT_NO, CNT_SEQ_NO, DEALER_CODE, ORG_DEALER_CODE, SALES_AGENT, ORG_SALES_AGENT, REQ_DEPOSIT_AMT, LEADING_NUMBER, PABX_IND, NEXT_CTN, NEXT_CTN_CHG_DATE, PRV_CTN, PRV_CTN_CHG_DATE, NEXT_BAN, NEXT_BAN_MOVE_DATE, PRV_BAN, PRV_BAN_MOVE_DATE, SUB_STS_ISSUE_DATE, ACTIVATE_WAIVE_RSN, EARLIEST_ACTV_DATE, SUB_ACTV_LOCATION, CUST_WATCH_LMT, CUST_WATCH_DATE, BASIC_WATCH_LMT, CREDIT_WATCH_PIN_CD, SUB_MARKET_CODE, LIMIT_RESERVED_DAYS, FF_EXPIRATION_DATE, FLEX_IND, DUO_IND, LISTED_IND, SUB_DEPARTMENT_CD, LAST_SUBS_DISC_DT, LAST_SUBS_DISC_DT_UD, LAST_SUBSCR_DISC_SN, LAST_SUBSCR_DISC_SN_UD, PNI, RMS_REF_STORE_ID, RMS_REF_TYPE, RMS_REF_OD, DLR_ACT_FEE, PREP_AMOUNT, SUBSCRIBER_ID, SUB_LANG, SMS_RCV_STYLE_CODE, CONV_RUN_NO, ALLOW_ADVERTISING_IND, IVR_WRONG_ACCESS_NO, THRESHOLD_AMT, PUBLISH_LEVEL, AUTO_RELEASE_IND, CUST_WATCH_EFF_DATE, CUST_WATCH_EXP_DATE, OPERATOR_CW_LMT, SEND_SMS_FOR_MATCH, CPS_STATUS, CPS_TRANSACTION, CPS_TYPE, ISP_PASS, ISP_TYPE, OPERATOR_TMP_DATE, OPERATOR_TMP_LMT, SUB_ORG_CD, ORG_MEMBER_NO) Values ('GSM04528890298', 502499502, TO_DATE('12/05/2006 15:55:13', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('01/12/2007 00:45:22', 'MM/DD/YYYY HH24:MI:SS'), NULL, 'FUTRX ', 'CS058', NULL, TO_DATE('01/12/2007 00:45:22', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('12/05/2006 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'C', TO_DATE('01/12/2007 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('12/05/2006 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'CCN', 'NP ', 'GSM', 502499502, 14419730, NULL, NULL, TO_DATE('12/05/2006 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('06/04/2007 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'PPD', 6, NULL, '1035393', 6976424, '2311 ', '2311 ', 'DFLT ', 'DFLT ', NULL, '045', 'S', 'GSM04525210338', TO_DATE('01/12/2007 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), NULL, NULL, NULL, NULL, NULL, NULL, TO_DATE('01/12/2007 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), NULL, TO_DATE('12/05/2006 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'TEMO', NULL, NULL, NULL, NULL, 'TEL', NULL, NULL, 'N', 'N', 'Y', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 6834900, 'DK', '01', NULL, 'N', NULL, 9999999.99, '4321', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); Insert into SUBSCRIBER (SUBSCRIBER_NO, CUSTOMER_ID, SYS_CREATION_DATE, SYS_UPDATE_DATE, OPERATOR_ID, APPLICATION_ID, DL_SERVICE_CODE, DL_UPDATE_STAMP, EFFECTIVE_DATE, INIT_ACTIVATION_DATE, SUB_STATUS, SUB_STATUS_DATE, ORIGINAL_INIT_DATE, SUB_STATUS_LAST_ACT, SUB_STATUS_RSN_CODE, PRODUCT_TYPE, CUSTOMER_BAN, CTN_SEQ_NO, REQ_ST_GRACE_PERIOD, REQ_END_GRACE_PERIOD, COMMIT_START_DATE, COMMIT_END_DATE, COMMIT_REASON_CODE, COMMIT_ORIG_NO_MONTH, SUSP_RC_RATE_TYPE, CONTRACT_NO, CNT_SEQ_NO, DEALER_CODE, ORG_DEALER_CODE, SALES_AGENT, ORG_SALES_AGENT, REQ_DEPOSIT_AMT, LEADING_NUMBER, PABX_IND, NEXT_CTN, NEXT_CTN_CHG_DATE, PRV_CTN, PRV_CTN_CHG_DATE, NEXT_BAN, NEXT_BAN_MOVE_DATE, PRV_BAN, PRV_BAN_MOVE_DATE, SUB_STS_ISSUE_DATE, ACTIVATE_WAIVE_RSN, EARLIEST_ACTV_DATE, SUB_ACTV_LOCATION, CUST_WATCH_LMT, CUST_WATCH_DATE, BASIC_WATCH_LMT, CREDIT_WATCH_PIN_CD, SUB_MARKET_CODE, LIMIT_RESERVED_DAYS, FF_EXPIRATION_DATE, FLEX_IND, DUO_IND, LISTED_IND, SUB_DEPARTMENT_CD, LAST_SUBS_DISC_DT, LAST_SUBS_DISC_DT_UD, LAST_SUBSCR_DISC_SN, LAST_SUBSCR_DISC_SN_UD, PNI, RMS_REF_STORE_ID, RMS_REF_TYPE, RMS_REF_OD, DLR_ACT_FEE, PREP_AMOUNT, SUBSCRIBER_ID, SUB_LANG, SMS_RCV_STYLE_CODE, CONV_RUN_NO, ALLOW_ADVERTISING_IND, IVR_WRONG_ACCESS_NO, THRESHOLD_AMT, PUBLISH_LEVEL, AUTO_RELEASE_IND, CUST_WATCH_EFF_DATE, CUST_WATCH_EXP_DATE, OPERATOR_CW_LMT, SEND_SMS_FOR_MATCH, CPS_STATUS, CPS_TRANSACTION, CPS_TYPE, ISP_PASS, ISP_TYPE, OPERATOR_TMP_DATE, OPERATOR_TMP_LMT, SUB_ORG_CD, ORG_MEMBER_NO) Values ('GSM04528890298', 581751708, TO_DATE('03/31/2010 19:10:33', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('04/01/2010 16:17:40', 'MM/DD/YYYY HH24:MI:SS'), 10077, NULL, 'CS009', NULL, TO_DATE('03/31/2010 19:10:33', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('03/31/2010 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'A', TO_DATE('03/31/2010 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('03/31/2010 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'NAC', 'CA ', 'GSM', 581751708, 24798333, NULL, NULL, TO_DATE('03/31/2010 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('09/29/2010 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), NULL, 6, NULL, NULL, 12093584, '2357 ', '2357 ', 'DFLT ', 'DFLT ', NULL, '045', 'S', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, TO_DATE('03/31/2010 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), NULL, TO_DATE('03/31/2010 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'TEMO', NULL, NULL, NULL, NULL, 'TEL', NULL, TO_DATE('12/31/4700 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'N', 'N', 'Y', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 9474437, 'DK', '01', NULL, 'N', NULL, 999999999.99, '12', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); Insert into SUBSCRIBER (SUBSCRIBER_NO, CUSTOMER_ID, SYS_CREATION_DATE, SYS_UPDATE_DATE, OPERATOR_ID, APPLICATION_ID, DL_SERVICE_CODE, DL_UPDATE_STAMP, EFFECTIVE_DATE, INIT_ACTIVATION_DATE, SUB_STATUS, SUB_STATUS_DATE, ORIGINAL_INIT_DATE, SUB_STATUS_LAST_ACT, SUB_STATUS_RSN_CODE, PRODUCT_TYPE, CUSTOMER_BAN, CTN_SEQ_NO, REQ_ST_GRACE_PERIOD, REQ_END_GRACE_PERIOD, COMMIT_START_DATE, COMMIT_END_DATE, COMMIT_REASON_CODE, COMMIT_ORIG_NO_MONTH, SUSP_RC_RATE_TYPE, CONTRACT_NO, CNT_SEQ_NO, DEALER_CODE, ORG_DEALER_CODE, SALES_AGENT, ORG_SALES_AGENT, REQ_DEPOSIT_AMT, LEADING_NUMBER, PABX_IND, NEXT_CTN, NEXT_CTN_CHG_DATE, PRV_CTN, PRV_CTN_CHG_DATE, NEXT_BAN, NEXT_BAN_MOVE_DATE, PRV_BAN, PRV_BAN_MOVE_DATE, SUB_STS_ISSUE_DATE, ACTIVATE_WAIVE_RSN, EARLIEST_ACTV_DATE, SUB_ACTV_LOCATION, CUST_WATCH_LMT, CUST_WATCH_DATE, BASIC_WATCH_LMT, CREDIT_WATCH_PIN_CD, SUB_MARKET_CODE, LIMIT_RESERVED_DAYS, FF_EXPIRATION_DATE, FLEX_IND, DUO_IND, LISTED_IND, SUB_DEPARTMENT_CD, LAST_SUBS_DISC_DT, LAST_SUBS_DISC_DT_UD, LAST_SUBSCR_DISC_SN, LAST_SUBSCR_DISC_SN_UD, PNI, RMS_REF_STORE_ID, RMS_REF_TYPE, RMS_REF_OD, DLR_ACT_FEE, PREP_AMOUNT, SUBSCRIBER_ID, SUB_LANG, SMS_RCV_STYLE_CODE, CONV_RUN_NO, ALLOW_ADVERTISING_IND, IVR_WRONG_ACCESS_NO, THRESHOLD_AMT, PUBLISH_LEVEL, AUTO_RELEASE_IND, CUST_WATCH_EFF_DATE, CUST_WATCH_EXP_DATE, OPERATOR_CW_LMT, SEND_SMS_FOR_MATCH, CPS_STATUS, CPS_TRANSACTION, CPS_TYPE, ISP_PASS, ISP_TYPE, OPERATOR_TMP_DATE, OPERATOR_TMP_LMT, SUB_ORG_CD, ORG_MEMBER_NO) Values ('GSM04528890298', 816370100, TO_DATE('09/03/2005 10:12:13', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('03/14/2006 12:20:09', 'MM/DD/YYYY HH24:MI:SS'), 14462, NULL, 'CS016', NULL, TO_DATE('03/14/2006 12:20:08', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('09/03/2005 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'C', TO_DATE('03/14/2006 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('09/03/2005 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'CAN', 'CNP3', 'GSM', 816370100, 12575966, NULL, NULL, TO_DATE('09/03/2005 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('03/02/2006 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'PPD', 6, NULL, '690925', 3436964, '4243 ', '4243 ', 'DFLT ', 'DFLT ', NULL, '045', 'S', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, TO_DATE('03/14/2006 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), NULL, TO_DATE('09/03/2005 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'TEMO', NULL, NULL, NULL, NULL, 'TEL', NULL, NULL, 'N', 'N', 'Y', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1436383, 'DK', '01', NULL, 'N', NULL, 9999999.99, '0', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
Hello
Welcome to the froum!
Thanks for posting the CREATE TABLE and INSERT! It's very nigra.
user12990691 wrote:
...
logon_histories_r table records the information of each user who connects to the system. Subscriber Details table contains all the information corresponding to subscriber_no, only 1 row should be returned.Do you mean a line by the user, or a line every time that you run the report, regardless of the number of users connected during the period that interests us?
Anyway, if there are multiple logons, how do you decide that one? Or the output of logon_histories_r columns will be a sort of composite?I'm confused usage date condition for the table of the Subscriber, the input parameter date 04/04/2006 to 15/04/06
Select lh.logon_id, lh.user_id, lh.logon_time, lh.logon_type, subs.subscriber_no, subs.customer_id
of logon_histories_r lh, subscribed subs
where lh.logon_time > = to_date('05-04-2010','dd-mm-yyyy')--to_date('04-04-2006','dd-mm-yyyy')
and lh.logon_time< to_date('06-04-2010','dd-mm-yyyy')="" --="">
and lh.user_id = substr (subs.subscriber_no,-10);Must LH.LOGON_TIME match something in the subscruber table? If so, you need to addsome extra join pathological.
For example, if lh.logon_time must be between d1 and d2 (where d1 and d2 are DATE columns), then:select lh.logon_id , lh.user_id , lh.logon_time , lh.logon_type , subs.subscriber_no , subs.customer_id from logon_histories_r lh , subscriber subs where lh.logon_time >= to_date ('05-04-2010','dd-mm-yyyy') -- to_date('04-04-2006','dd-mm-yyyy') and lh.logon_time < to_date ('06-04-2010','dd-mm-yyyy') -- to_date('15-01-2007','dd-mm-yyyy') and lh.user_id = substr (subs.subscriber_no, -10) and lh.logon_time >= subs.d1 -- New condition added and lh.logon_time <= subs.d2 -- New condition added ;
Please find DDL and data relevant to these results. There are millions of records of Subscriber & logon_histories_r table, I am given appropriate providing a subscriber_id.
That's smart, don't not post each row of the table: looks like you posted just enough to show what the problem is.
Try to do the same thing with the columns. Do not post every single column, just the columns that have something to do with the problem. -
help in registration of the records from two tables
HI: I have two tables joined the first field. The field is the primary key in the first table. Need help listing records from both tables with each a line/record results.
I want to print each record in the table of EVENTS such as a line and the corresponding records in EVENT_UPDATES as a line like this recordcreate table EVENTS ( event_key varchar2(64) primary key, event_description varchar2(64), create_time int ); create table EVENT_UPDATES ( event_key varchar2(64) NOT NULL , update_description varchar2(64), update_time int ); insert into EVENTS values('Event1', 'This is event1', 1); insert into EVENT_UPDATES values('Event1', 'Ticket created', 3); insert into EVENT_UPDATES values('Event1', 'Event cleared', 10); insert into EVENTS values('Event2', 'This is event2', 4); insert into EVENT_UPDATES values('Event2', 'Ticket created', 6); insert into EVENT_UPDATES values('Event2', 'Event cleared', 8);
TIAEvent1 1 This is event1 3 Ticket created 10 Event cleared Event2 4 This is event2 6 Ticket created 8 Event cleared
Raviselect case weight when 1 then event_key end key, time_val, description from ( select event_key, create_time time_val, event_description description, 1 weight from events union all select event_key, update_time, update_description, 2 weight from event_updates ) order by event_key, weight / KEY TIME_VAL DESCRIPTION ---------- ---------- ------------------------- Event1 1 This is event1 3 Ticket created 10 Event cleared Event2 4 This is event2 6 Ticket created 8 Event cleared 6 rows selected. SQL>
SY.
-
Inserting data into a table and insert many records into newtable
Hi all
I have table A and table b.
Suppose that if I insert the data into the table, this table is inserted, the number of records records Count I want to insert in the table B
I have to write a procedure for this cannot so any help on this.
Thanks in advance.
Sikora.Hello
You can use this anonymous block and extend it to create the procedure. You can delete loop or leave it there and use the cursor loop
DECLARE j NUMBER; BEGIN FOR i IN 1 .. 100 LOOP INSERT INTO A VALUES ('col1', 'col2', 'col3'); j := j+ sql%ROWCOUNT; END LOOP; INSERT INTO B VALUES ('table name ', j); COMMIT; EXCEPTION WHEN OTHERS THEN ROLLBACK; DBMS_OUTPUT.put_line (SUBSTR (SQLERRM, 1, 200)); RAISE; END;
Published by: OrionNet on January 21, 2009 12:53 AM
-
Read data from the Table and load it into the csv file
Hello
I would like to read a table (select * from employees) and load the data into a csv file.
What methods are available?
Records will be at high volume.
Thank you
If it is to do a lot, use APEX.
Create a new page with an interactive report based on the SQL code you want. When you go to download Excel, it is actually a CSV file.
If it is large, you may need to go on the FILE_UTL road.
If it is only once, use an interface such as SQL tool * or SQL * Developer.
If it's a learning experience, you must do all three.
MK
-
Extraction of data from a XML and inserting into a table
Hi all
I have a problem for which I couldn't find any convincing solution
I have an XML format
<data> <students> <student> <studentname>Raymond<studentname> <StudentId>1</StudentId> <StudentAge>11</StudentAge> <StudentMark>0</StudentMark> </student> </students>
Now I have to insert this XML DB, the table consists of the following columns
(line number, property name, value)
Wait it out put is
(1, studentname, Raymond).
(1, studentid, 1)
(1, studentAge, 11)
(1, Studentmark, 0)
The challenge here
1. how to get the tag names and fill in the property name column?
2. the number of properties for a student can be variable, how can I deal with them?
I am very new to PLSQL XML manipulation. Can someone give me some advice I can start with the creation of a solution? I hope, I've been able to describe my use case. If this isn't the case, please let me know.
Thanks in advance,
Cherif
Here is an example:
SQL > with sample_data like)
2. Select xmlparse (document
3'
4
5
6
Raymond 7
1 8
11 9
0 10
11
12
John 13
2 14
18 15
15 16
17
18
') xmldoc19 of the double
20)
21 select x1.record_id
22, x2.*
sample_data 23 t
24, xmltable)
25 ' / data/students/pupils.
26 passage t.xmldoc
record_id 27 columns for ordinalite
28, property xmltype path ' *'
(29) x 1
30, xmltable)
31 '*'
32 passage x1.properties
path of varchar2 (30) 33 columns property_name "local - name (.)".
34, path name varchar2 (30) '.'
(35) x 2
36;
RECORD_ID PROPERTY-NAME NAME
---------- ------------------------------ ------------------------------
1 studentname Raymond
StudentId 1 1
1 StudentAge 11
1 StudentMark 0
2 John studentname
StudentId 2 2
2 StudentAge 18
2 StudentMark 15
8 selected lines
-
Is it to extract data from a database and insert it into a session variable?
$_SESSION ['Stud_FirstName'] = $row_rs_Login ["Stud_FirstName"];
because it is not work. I swear to you that the more I learn, the less I know.
What to do to change?
Thank you!
Yes. However, the recordset must exist before you can assign value to another variable. The last line of code that creates a recordset object looks like this:
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
If you attempt to create the variable session before this line, as you are, I suspect, is not really surprising that it does not work.
Even if you don't want to write all the code yourself, you must understand the code that Dreamweaver is written for you. Otherwise you will be constantly bumping your head on the keyboard. A PHP script is executed from top to bottom, and the flow of the script is controlled by loops and conditional statements. Get your head around these concepts, and you can find customizing Dreamweaver code much easier.
-
Kindly help me with the request to find the data in two tables
Hello Guru
Kindly help me to recover the data from two tables-
BASEBALL
LEGAL_ENT_ID (PK)
GAME_ID (FK)
LEGAL_ENT_NM
INACTIVE_DT
DATE OF INS_TS
INS_LOGIN
DATE OF UPD_TS
UPD_LOGIN
FOOTBALL
GAME_ID (PK)
BRKR_NM,
BRKR_ISR_ID
BROKER_SYMBOL
INACTIVE_DT
BRKR_SWIFT_FLG
BRKR_INTERNAL_FLG
BRKR_CATEGORY
UPD_TS
MINORITY_FLG
BROKER_TYP
STATUS
INS_TS
INS_LOGIN
UPD_LOGIN
APP_USER
ACTIVE_FLG
and if I want fecth data from these two tables according to the following condition then it is fine with the suite of applications.
1 select distinct values only table of BASEBALL by using the following query.
SELECT DISTINCT B.GAME_ID as 'CLEARING GAME ID', B.BRKR_NM "NAME of THE GAME of COMPENSATION" OF BASEBALL A, FOOTBALL B WHERE A.BROKER_RELATION_CD IN ('FUTBRKR1', 'FUTBRKR2') AND A.GAME_ID = B.GAME_ID
2 Select all the table BRKR_NM OF FOOTBALL as well by using the query - next
SELECT GAME_ID "RUNNING GAME ID", 'NAME OF THE GAME OF EXECUTION' BRKR_NM SOCCER
Now, my query is that--
I want a query that gives me a combination of above mentioned queries... and if I tried to use Union or Union All, then she is not giving me the result as expected.
I like the result to look like who has a few conditions such as -
1 - the records in the table Football are high vs Baseball table because there is no condition to filter the records of the Football.
2 - football is a superset of records and Baseball is a subset.
3 - COMPENSATION NOM_JEU and RUNNING NOM_JEU may return the same values as well.
I want the result to be in the following form-
EXECUTION ID GAME | NAME OF THE GAME TO RUN. COMPENSATION ID GAME | DELETE THE NAME OF THE GAME.
2123 test1 2345 test5
2456 test10 2456 test10
Thanks in advance. Kindly help me.
Published by: user555994 on January 4, 2011 23:48In the output you want.
All the values of baseball;
Values of football that are matched;
But on what condition you want to match? -
How to get data from a database table and insert into a file
Hello
I'm new to soa, I want to create an xml with the data from database tables, I'll have the xsd please suggest me how to get the data in the tables and insert in a file
concerningin your bpel process, you can use the db adapter to communicate with the database.
with this type of adapter, you can use stored procedures, selects, etc to get the data from your database into your bpel workflow.When did it call in your bpel to the db adapter process it will return an output_variable with the contents of your table data, represented in a style of xml form.
After that, you can use the second card (a file synchronization adapter) to write to the content of this variable in output to the file system
-
I have the data into two table with the structure of similar column, I want to loop through the data in these two tables
based on some condition and runtime that I want to put the query in loop for example, the example is given, please help me
create table ab (a number, b varchar2 (20));
Insert into ab
Select rownum, rownum. "" sample "
of the double
connect by level < = 10
create table bc (a number, b varchar2 (20));
Insert into BC.
Select rownum + 1, rownum + 1 | "" sample "
of the double
connect by level < = 10
declare
l_statement varchar2 (2000);
Boolean bool;
Start
bool: = true;
If it is true, then
l_statement: =' select * ab ';
on the other
l_statement: =' select * from bc';
end if
I'm in execute immediate l_statement - something like that, but I don't know
loop
dbms_output.put_line (i.a);
end loop;
end;
Something like that, but this isn't a peace of the code work.
Try this and adapt according to your needs:
declare
l_statement varchar2 (2000);
c SYS_REFCURSOR;
l_a number;
l_b varchar2 (20);
Boolean bool;
Start
bool: = true;
If it is true, then
l_statement: = "select a, b, AB;
on the other
l_statement: = "select a, b from bc;
end if;
--
Open c for l_statement;
--
loop
extract the c in l_a, l_b;
When the output c % notfound;
dbms_output.put_line (l_a |') -' || l_b);
end loop;
close c;
end;
/
-
Tracing data from two locations on the block diagram on the same graph
Hello world
I'm trying to plot data from two distinct processes on a chart. These processes occur in the order.
I have developed several solutions, which none produce the result I want. What I want is for the data to trace in real time each process is running.
The two processes are functionally identical - one loop "for". With each iteration of these loops, data is produced and traced.
The data are plotted in real time, which means that each reference appears on the chart as soon as it is produced.
However, I am not able to get the second process data on the same graph in the same way.
The closest I got combines the graphic with a local variable. This allows the data for the two processes to draw in real time, but the second set of data replaces the first.
I have attached a very simple test VI showing my problem.
Any help with this would be greatly appreciated.
Thank you
You can do something like this. Is the second process just a continuation of the first? If so, it becomes even easier and you can just to keep construction of the table in the second loop.
-
How to effectively create a single waveform based on data from two other waveforms?
I have a table 1 d of waveform with size = 4 which contain data of voltage potentiometer "gross". I need to handle index 0 & 1 waveform data using the formula below to calculate a single waveform of angle data. I need to do the same for the 2 & 3 index because it is a redundant circuit. I was hoping that the formula node can operate on whole berries and even if it may take a table as input, it asks me to the array index in the formula so that it becomes a scalar value.
As the formula is quite complex, I would like to keep as text, but run automatically on each point of the two input tables. This math is done online with pulling data from a data acquisition and so I need it to be as effective as possible, so that I do not spend too much time on it and likely to overflow the buffer DAQ.
The naïve solution would be to wrap nodes formulas with curls, but I don't know if it is this is an effective way to do it. I'd like suggestions on how best to address this issue.
Thank you!
Here's how I would do it with no formula requires knots or loops:
If you want to use the formula node, you can then run a loop inside each node formula while the index of you through the berries. The difference in performance between the nodes of the formulas and graphic approach expected to be negligible. Note that my approach assumes that the table sizes are the same. You can also create a sub VI to contain the math so you don't have to maintain two copies of the same piece of code.
Chris M
-
Copy the data from two rows together in a new line
Hello everyone.
I have a question for copying data from two lines together in a new third line.
See this short example:
This is the current situation. The lines STATE_1 and STATE_2 contain different information separate.
In the past data were recorded at random in one of these lines.
It's the state table:
ID Cust_id STATE_1 STATE_2 STATE_3 1 88 Customer is waiting. Call since yesterday. 2 11 Mr. Smith, no answer. Wait until December 3 11 Pls Create PO. Old PO has been cancelled 4 5 No access to the system. Now, everything must be recorded in the STATE_3 void, but I also need than the old entries from the past which must also be copied together in STATE_3
Like this:
ID Cust_id STATE_1 STATE_2 STATE_3 1 88 Customer is waiting. Call since yesterday. Customer is waiting. Call since yesterday 2 11 Mr. Smith, no answer. Wait until December. Mr. Smith, no answer. Wait until December. 3 11 Pls Create PO. Old PO has been cancelled. Pls create in. old PO was canceled. 4 5 No access to the system. No access to the system. Y at - it an SQL-easy order?
Thanks for any help.
What:
update set state_3 = state_1 State | » '|| state_2;
?
-
Pulling data from the class on a MovieClip array
I am trying to create this slideshow application that displays product information (Tennis rackets) issues of different categories. A great programmer advised me that OOP would be a way to go, however I'm having a difficulty with it.
I created:
A document class called CustomClass--> This class downloads all data from the server and pushing the content in the XML based on a category tables. These berries are public, there is also a funciton iterateArray that places the children information somewhere.
I would like to have 3 different movie clips
1 screen-> Welcome Message
2nd screen-> first table
3rd screen-> second table Dispalyed
package { import flash.display.*; import fl.transitions.*; import fl.transitions.easing.*; import flash.net.*; import flash.events.*; import flash.text.*; import flash.text.AntiAliasType; import flash.utils.*; import bucket_right; import bucket_left; import firstScreen; import secondScreen; public class CustomClass extends MovieClip { [Embed(source="C:/WINDOWS/Fonts/Eurosti.ttf", fontFamily="Euro")] public var EuroEmbedded:Class; //XML responsible variables private var xmlLoader:URLLoader; private var xmlContainer:XML; private var xmlList:XMLList; //Array specific variables public var rackUSA:Array; public var rackOther:Array; public var imagesArray:Array; //Position Variables public var position:Number; //Movie Clip Related Data public var bucket:MovieClip; public var firstScreenShow:MovieClip; public var secondScreenShow:MovieClip; //Text Field Formatting private var brandnameTxt:TextFormat; private var detailsTxt:TextFormat; private var priceTxt:TextFormat; public var euroEmbeddedFont:Font; private var fontNeeded:String; //Set up Timer Vars private var applicationStart:Timer; private var delay:Number; private var repeat:Number; //Positioning Variable private var positionBuckets:Boolean = true; //This is the constructor of the application public function CustomClass() { euroEmbeddedFont = new EuroEmbedded(); fontNeeded = euroEmbeddedFont.fontName; position = 5; rackUSA = new Array(); rackOther = new Array(); imagesArray = new Array(); delay = 2000; repeat = 1; applicationStart = new Timer(delay, repeat); LoadXML(); } private function LoadXML() { xmlLoader = new URLLoader(); xmlLoader.load(new URLRequest("http://localhost/xml/index.php")); xmlLoader.addEventListener(Event.COMPLETE, populateInfo); } public function populateImages(imgname:String, imgurl:String):* { var imageLoader:Loader = new Loader(); //imgname = imgname.split(".gif").join(""); //imageLoader.name = imgname; //imagesArray.push(imageLoader); imageLoader.load(new URLRequest(imgurl)); return imageLoader; } public function getArray(arrayName:Array) { return arrayName; } /*public function startApplication() { applicationStart.start(); applicationStart.addEventListener(TimerEvent.TIMER_COMPLETE, firstScreen); } public function firstScreen(e:TimerEvent) { removeChild(secondScreenShow); applicationStart.reset(); applicationStart.removeEventListener(TimerEvent.TIMER_COMPLETE, firstScreen); firstScreenShow = new firstScreen(); addChild(firstScreenShow); //firstScreenShow.iterateArray(rackUSA); applicationStart.start(); applicationStart.addEventListener(TimerEvent.TIMER_COMPLETE, secondScreen); } public function secondScreen(e:TimerEvent) { applicationStart.reset(); applicationStart.removeEventListener(TimerEvent.TIMER_COMPLETE, secondScreen); removeChild(firstScreenShow); secondScreenShow = new secondScreen(); addChild(secondScreenShow); //secondScreenShow.iterateArray(rackOther); applicationStart.start(); applicationStart.addEventListener(TimerEvent.TIMER_COMPLETE, firstScreen); }*/ public function setFontFormat() { //Text Formatting for Brand Name Field brandnameTxt = new TextFormat(); brandnameTxt.font = fontNeeded; brandnameTxt.color = 0x006699; brandnameTxt.size = 20; brandnameTxt.bold = true; // //Text Formatting for Country/Material detailsTxt = new TextFormat(); detailsTxt.font = fontNeeded; detailsTxt.color = 0x006699; detailsTxt.size = 10; detailsTxt.bold = false; //Text Formatting for Country/Material priceTxt = new TextFormat(); priceTxt.font = fontNeeded; priceTxt.color = 0x9DE36E; priceTxt.size = 20; priceTxt.bold = true; } public function tweenBucket(bucket:MovieClip) { var bucketImgTrans = new TransitionManager(bucket); bucketImgTrans.startTransition({type:Zoom, direction:Transition.IN, duration:3, easing:Strong.easeOut}); } private function iterateArray(contentInfo:Array) { this.setFontFormat(); for (var c:uint = 0; c < contentInfo.length; c++) { var brand:TextField = new TextField(); var country:TextField = new TextField(); var made:TextField = new TextField(); var cost:TextField = new TextField(); var img:Loader; brand.embedFonts = true; img = contentInfo[c].picture; brand.text = contentInfo[c].brand; country.text = contentInfo[c].country; made.text = contentInfo[c].made; cost.text = contentInfo[c].cost; if (positionBuckets) { bucket = new bucket_left(); //Align Data bucket.y = position; bucket.x = 70; brand.x = -50; brand.y = -35; country.x = -45; country.y = -10; made.x = -45; made.y = 5; cost.x = 45; cost.y = -10; img.x = -105; img.y = -35; brandnameTxt.align = TextFormatAlign.LEFT; priceTxt.align = TextFormatAlign.LEFT; positionBuckets = false; } else { bucket = new bucket_right(); //Align Data bucket.y = position; bucket.x = 240; brand.x = -50; brand.y = -35; country.x = -45; country.y = -10; made.x = -45; made.y = 5; cost.x = -110; cost.y = -10; img.x = 70; img.y = -35; brandnameTxt.align = TextFormatAlign.RIGHT; positionBuckets = true; } brand.setTextFormat(brandnameTxt); country.setTextFormat(detailsTxt); made.setTextFormat(detailsTxt); cost.setTextFormat(priceTxt); //this.tweenBucket(bucket); addChildAt(bucket, 0); bucket.addChild(DisplayObject(img)); bucket.addChild(brand); bucket.addChild(country); bucket.addChild(made); bucket.addChild(cost); position += 70; } } private function populateInfo(event:Event) { //Incoming XML Data xmlContainer = new XML(event.target.data); xmlList = xmlContainer.product; // //Variables to hold the string var brandTxt:String; var country:String; var material:String; var price:String; var image:String; for (var i:uint = 0; i < xmlList.length(); i++) { if (xmlList.country.text()[i] == "USA") { brandTxt = xmlList.brand.text()[i]; country = "product of " + xmlList.country.text()[i]; material = "made of " + xmlList.material.text()[i]; price = "$" + xmlList.price.text()[i]; image = xmlList.image.text()[i]; rackUSA.name = brandTxt.toLowerCase(); var imgVar:* = this.populateImages(image, "http://localhost/rackets/" + image); rackUSA.push({brand: brandTxt, country: country, made: material, cost: price, pic: image, picture: imgVar}); //addChild(DisplayObject(rackUSA[0].picture)); } else if (xmlList.country.text()[i] == "Other") { brandTxt = xmlList.brand.text()[i]; country = "product of " + xmlList.country.text()[i]; material = "made of " + xmlList.material.text()[i]; price = "$" + xmlList.price.text()[i]; image = xmlList.image.text()[i]; var imgVarOther:* = this.populateImages(image, "http://localhost/rackets/" + image); rackOther.push({brand: brandTxt, country: country, made: material, cost: price, pic: image, picture: imgVarOther}); } } //this.startApplication(); } } }
If I clip named firstScreen how to fill with data from the rackUSA of the table, using the presented functions iterateArray
I tried in a movieClip
CustomClass.iterateArray (rackUSA); but it does not work
Any suggestions
I want to clarify the use cases.
1 load data into the document class
2. display a welcome message
3 allow users to navigate through the products.
Q1: Do you mean by 'welcome message' a user interface that allows to start navigation?
Q2: Products appears the same way. I mean, consider that product display will have a uniform provision?
If the answer to Q2 is Yes, I would:
1. create a class that features products. Call ProductDisplay
2 transfer data (subset of XML related to a particular product - in your case, it may be an object in the position of the table) in an instance of ProductDisplay
I would like you to consider the following.
It is a good practice to do OBJECT oriented programming class as little as possible each. This means that a class must have a very focused functionality. For example, ProductClass you perform tasks related to laying on the presentation of the product. With this in mind, it is best to delegate, say, loading image to a separate category. Believe me, when you do – your life will be much easier if you do features as granular as possible even if sometimes it feels like an overdose.
So here's the sketch of your classes. I wrote it just to illustrate the idea. I did not check the code during execution is definitely buggy.
Read my comments below also.
It is a class of product image that load the image:
package { import flash.display.Loader; import flash.display.Sprite; import flash.events.Event; import flash.events.ProgressEvent; import flash.net.URLRequest; public class ProductImage extends Sprite { // image url private var _url:String; // loader private var _loader:Loader; public function ProductImage() { if (stage) init(); else addEventListener(Event.ADDED_TO_STAGE, init); } private function init(e:Event = null):void { removeEventListener(Event.ADDED_TO_STAGE, init); _loader = new Loader(); _loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoad); _loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, onProgress); _loader.load(new URLRequest(url)); } private function onProgress(e:ProgressEvent):void { // display progress if needed } private function onLoad(e:Event):void { _loader.contentLoaderInfo.removeEventListener(Event.COMPLETE); _loader.contentLoaderInfo.removeEventListener(ProgressEvent.PROGRESS, onProgress); addChild(_loader); } public function get url():String { return _url; } public function set url(value:String):void { _url = value; } } }
ProdustDisplay class. Note how the product class is instantiated
package { import flash.display.Sprite; import flash.events.Event; public class ProductDisplay extends Sprite { // hold the metadata private var _metaData:Object; // an object that holds the image private var _imageDisplay:ProductImage; public function ProductDisplay() { if (stage) init(); else addEventListener(Event.ADDED_TO_STAGE, init); } private function init(e:Event = null):void { removeEventListener(Event.ADDED_TO_STAGE, init); // only if metadat is set - build interface if (metaData) { build(); } } // build interface private function build():void { // place prduct image _imageDisplay = new ProductImage(); _imageDisplay.url = metaData.image; addChild(_imageDisplay); // do the rest - like description, etc. } // function that accepts product metadata public function set metaData(metaObject:Object):void { _metaData = metaObject; } // returns metadata public function get metaData():Object { return _metaData; } } }
Now in your document class, you can set an unlimited number of instances of ProductDisplay (as slides) and manipulate them. Again, this is just a sketch. Actual implementation of features and code will be somewhat different:
var productDisplay:ProductDisplay = new ProductDisplay(); productDisplay.metaData = rackUSA[2];
Note: Your code has several inconsistencies - we need to go through them at another time. For now just digest these ideas. I understand that this will involve a refactoring on your part, but once you are done with it - things will fall in place fast.
Maybe you are looking for
-
Every time an ad 'click here for more games Crafts' appears on Skype, webafun site appears. Why does this happen? my computer doesn't have any virus or any kind of malware.
-
HP Deskjet 3050:4 x 6 photos
Why can't I get the printer to print a photo full size 4 x 6? What print is good, but doesn't fit all common frameworks...
-
Hello Hope you can help me One of my clients Windows XP Professional desktop is freeze occasionally and also get the blue screen system failures PC Spec is Dell Optiplex 380Core 2 Duo E75002 GB of RAM, 160 GB HDDWindows XP Professional SP3 I have the
-
I checked cables and connections, and everything seems to be hung properly. I don't know what could be wrong with it. If anyone can help me with this, you are greatly appreciated.
-
Horizon discovers 5.3 VDGA
Vdga supports the fullclone linkclone and automation?