Looping integer

In vb.net there is this codes or something like this which I forgotten already:
Dim a as integer
a = 0
loop
a+1
end loop
clear a
Is it possible to do like this code in ABAP way? If there is, please show me the codes.
Edited by: JuzMe on Jan 24, 2008 9:25 AM

Hi JuzMe
The same code is not worked in ABAP.
There is another way by using
do.... endo,    loop at ITAB.....endloop.
data: count type i.
count = 20.
do
count = count + 1.
if <condition>
  exit.
endif.
enddo.
In your requirement it goes infinite loop.
We have to incorporate condition within the loop to prevent infinite looping by using EXIT statement.
Reward me if useful.

Similar Messages

  • About LOOP...END LOOP

    How to correctly specify the integer values in the following Loop command?:LOOP (integer, [break])COMMANDS ;ENDLOOP For I don't know why they use "30" in LOOP(30)."FIX("New York",Camera,Actual,Mar) LOOP(30) Commission = Profit * .15; Profit = Margin - "Total Expenses" - Commission; ENDLOOP;ENDFIX"

    Loop and endloop in smartform - if you want to print multiple data for each header ,then we need to use..
    one example : i have sales order - order may contains more than one item..if you want to print multiple items then we need to go for loop endloop.
    Program lines - without effecting program - we can change the code within smartform( I mean we can pass the values and get the values based on condition )
    i am getting material number from program and i am printing here,later on customer is looking for material description,then you can write simple code within samrtform by using program lines.

  • Numeric or value error Line 410???  appending to lob

    line 410 is marked with line of '%%%%%%%%%%%%%%%%%%%%%'
    This script is designed to profile data in a set of table by generating sql and running it with an execute immediate. It works by generating a set of code for each datatype and then executing the code twice for each table. Once for the summary profile and once for the detail profile. I've been starting at it awhile and can't figure out what the error means??? Thanks in advance!
    set serveroutput on size 1000000
    set feedback off
    SET ECHO OFF
    declare
    c clob;
    t varchar2(2000);
    e varchar2(2000);
    cursor c1 is select distinct owner,table_name from all_tab_columns
    where table_name in ('PS_F_AP_AGING'
    ,'PS_F_AP_TRAN'
    ,'PS_F_VCHR_MTCH_EXP'
    ,'PS_F_APAR_NETTING'
    ,'PS_F_AR_AGING'
    ,'PS_F_AR_ACCOUNT_LN'
    ,'PS_F_AR_DSO'
    ,'PS_F_AR_TRAN'
    ,'PS_F_ASGN'
    ,'PS_F_CA_AMD'
    ,'PS_F_CA_DTL_DIST'
    ,'PS_F_CA_DTL_TRANS'
    ,'PS_F_CA_REV_RECOGN'
    ,'PS_F_EXP_DTL_DIST'
    ,'PS_F_GM_AWARD'
    ,'PS_F_GM_PRJ_TRAN'
    ,'PS_F_GM_PRP_AWD'
    ,'PS_F_PRJ_AC_CUR'
    ,'PS_F_PRJ_AC_PRDC'
    ,'PS_F_PRJ_CHNG'
    ,'PS_F_PRJ_CUR'
    ,'PS_F_PRJ_PRDC'
    ,'PS_F_PRJ_TRAN'
    ,'PS_F_PRP_VER_TRANS'
    ,'PS_F_RSRC_RT'
    ,'PS_F_INV_CYCLE_CNT'
    ,'PS_F_INV_LDGR'
    ,'PS_F_INV_TRANS'
    ,'PS_F_PHYSICAL_INV'
    ,'PS_F_BEGIN_BAL'
    ,'PS_F_JOURNAL'
    ,'PS_F_KK_ACTIVITY'
    ,'PS_F_KK_BALANCES'
    ,'PS_F_KK_BUD_ASSOC'
    ,'PS_F_KK_ENCUMBRAN'
    ,'PS_F_KK_EXCEPTION'
    ,'PS_F_KK_JOURNAL'
    ,'PS_F_KK_LEDGER'
    ,'PS_F_KK_OVERRIDES'
    ,'PS_F_KK_TRANS_LOG'
    ,'PS_F_LEDGER'
    ,'PS_F_MTCH_ANLYS'
    ,'PS_F_PO_DIST'
    ,'PS_F_PO_LINE'
    ,'PS_F_PO_SHIP_RCPT'
    ,'PS_F_PROC_CTLT'
    ,'PS_F_REQN'
    ,'PS_F_REQN_ANLYSIS'
    ,'PS_F_RTV'
    ,'PS_F_RTV_DIST'
    ,'PS_F_SCP_CAPACITY'
    ,'PS_F_SCP_INVENTORY'
    ,'PS_F_SCP_PRODN'
    ,'PS_F_SCP_PURCHASNG'
    ,'PS_F_SCP_SLS_FCST'
    ,'PS_F_SCP_TRANSFERS'
    ,'PS_F_SCPSLS_ACTUAL'
    ,'PS_F_VCHR'
    ,'PS_F_VCHR_DIST_LN'
    ,'PS_F_VCHR_LN'
    /*,'PS_D_ACCOUNT'
    ,'PS_D_ACTGRY_AR_VW'
    ,'PS_D_AGING_CTGRY'
    ,'PS_D_ALTACCT'
    ,'PS_D_ANLYS_TYPE'
    ,'PS_D_AP_DOC_TYPE'
    ,'PS_D_AP_PTR_STAT'
    ,'PS_D_AP_PTR_TYPE'
    ,'PS_D_AP_PYMNT_TRMS'
    ,'PS_D_AP_VTR_STAT'
    ,'PS_D_AP_VTR_TYPE'
    ,'PS_D_APPOST_STATUS'
    ,'PS_D_AR_DOC_TYPE'
    ,'PS_D_AR_ITR_STAT'
    ,'PS_D_AR_ITR_TYPE'
    ,'PS_D_AR_PTR_STAT'
    ,'PS_D_AR_PTR_TYPE'
    ,'PS_D_ASGN'
    ,'PS_D_ASGN_STAT'
    ,'PS_D_BANK_ACCT'
    ,'PS_D_BOOK_CODE'
    ,'PS_D_BU_LED_GRP'
    ,'PS_D_BUCKET'
    ,'PS_D_BUDGET_REF'
    ,'PS_D_BUSINESS_UNIT'
    ,'PS_D_BUYER'
    ,'PS_D_CA'
    ,'PS_D_CA_AMD_RSN'
    ,'PS_D_CA_AMD_TYPE'
    ,'PS_D_CA_DTL'
    ,'PS_D_CA_JNK'
    ,'PS_D_CARRIER'
    ,'PS_D_CHANNEL'
    ,'PS_D_CHARTFIELD1'
    ,'PS_D_CHARTFIELD2'
    ,'PS_D_CHARTFIELD3'
    ,'PS_D_CLASS_FIELD'
    ,'PS_D_CNCL_STATUS'
    ,'PS_D_COLLECT_STAT'
    ,'PS_D_COMP_STATUS'
    ,'PS_D_CUST_ORG'
    ,'PS_D_CUSTOMER'
    ,'PS_D_DAY'
    ,'PS_D_DEDUCT_STAT'
    ,'PS_D_DEPT'
    ,'PS_D_DET_BUDGET'
    ,'PS_D_DET_PERIOD'
    ,'PS_D_DISPUTE_STAT'
    ,'PS_D_DIST_ACCT'
    ,'PS_D_DLVRY_STATUS'
    ,'PS_D_DT_PATTERN'
    ,'PS_D_ENTRY_RSTYP'
    ,'PS_D_EX_LOCATION'
    ,'PS_D_EXP_LN'
    ,'PS_D_EXP_RPT'
    ,'PS_D_FUND'
    ,'PS_D_GL_ADJ_TYPE'
    ,'PS_D_GM_AWARD'
    ,'PS_D_GM_INST'
    ,'PS_D_GM_PI'
    ,'PS_D_GM_PROP_PROJ'
    ,'PS_D_GM_PRP'
    ,'PS_D_GM_SPONSOR'
    ,'PS_D_INV_ITEM'
    ,'PS_D_INV_LOCATION'
    ,'PS_D_INVST_REASON'
    ,'PS_D_JOBCODE'
    ,'PS_D_JRNL_SOURCE'
    ,'PS_D_KK_BUDG_JNK'
    ,'PS_D_KK_BUDG_TYPE'
    ,'PS_D_KK_SOURCE_TRAN'
    ,'PS_D_LEDGER'
    ,'PS_D_LOT'
    ,'PS_D_MATCH_RULE'
    ,'PS_D_MRCHNT'
    ,'PS_D_MTCH_STATUS'
    ,'PS_D_OPER_UNIT'
    ,'PS_D_ORD_CAPTURE'
    ,'PS_D_ORIGIN'
    ,'PS_D_PATTERN_DAY'
    ,'PS_D_PERSON'
    ,'PS_D_PERSON_APOPID'
    ,'PS_D_PERSON_ARSPL'
    ,'PS_D_PERSON_COLTR'
    ,'PS_D_PERSON_CRNYST'
    ,'PS_D_PO_STATUS'
    ,'PS_D_PRJ'
    ,'PS_D_PRJ_AC'
    ,'PS_D_PRJ_AC_STAT'
    ,'PS_D_PRJ_CHNG'
    ,'PS_D_PRJ_HLTH'
    ,'PS_D_PRJ_ROLE'
    ,'PS_D_PRJ_RSRC'
    ,'PS_D_PRJ_RSRC_TYPE'
    ,'PS_D_PRJ_STAT'
    ,'PS_D_PRJ_TRAN_STAT'
    ,'PS_D_PRODUCT'
    ,'PS_D_PROGRAM_FDM'
    ,'PS_D_PRP'
    ,'PS_D_PRP_DTL'
    ,'PS_D_PY_TRMS_AR_VW'
    ,'PS_D_PYMNT_MTHD'
    ,'PS_D_RECLN_STATUS'
    ,'PS_D_RECV_STATUS'
    ,'PS_D_REQ_STATUS'
    ,'PS_D_REQLN_STATUS'
    ,'PS_D_RTRN_REASON'
    ,'PS_D_RTV_STATUS'
    ,'PS_D_RTVLN_STATUS'
    ,'PS_D_SALES_ORG'
    ,'PS_D_SCENARIO'
    ,'PS_D_SHIPTO'
    ,'PS_D_SO'
    ,'PS_D_SOURCE_TBL'
    ,'PS_D_STAT_CODE'
    ,'PS_D_SUPPLIER'
    ,'PS_D_TASK_TYPE'
    ,'PS_D_TIME'
    ,'PS_D_UOM'
    ,'PS_D_USER'
    ,'PS_D_WORK_CENTER'
    ,'PS_DEMAND_INF_INV'
    ,'PS_DEMAND_INV'
    ,'PS_DEPL_PLAN'
    ,'PS_DEPOSIT_CONTROL'
    ,'PS_DISTRIB_LIN'*/);
    begin
    for i in c1 loop
    dbms_lob.createtemporary(c, true);
    t := 'INSERT INTO DATA_PROFILE_COL_SUM ';
    dbms_lob.writeappend(c,length(t), t);
    --DBMS_OUTPUT.PUT_LINE(T);
    ----date
    FOR MYSQLTEXT IN (SELECT
    'select '
    || '''' || C.table_name || '''' || ' as tname, '
    || '''' || C.column_name || '''' || ' as cname, '
    || '''' || C.data_type || '''' || ' as data_type, '
    || '''' || nvl(c.data_length, 0) || '''' || ' as data_length, '
    || '''' || nvl(c.data_precision, 0) || '''' || ' as data_precision, '
    || '''' || nvl(c.data_scale, 0) || '''' || ' as data_scale, '
    || '''' || c.nullable || '''' || ' as nullable, '
    || '''' || nvl(c.num_distinct,0) || '''' || ' as num_distinct, '
    || '''' || nvl(c.density,0.0) || '''' || ' as density, '
    || '''' || nvl(c.num_nulls,0) || '''' || ' as num_nulls, '
    || '''' || nvl(c.char_col_decl_length,0) || '''' || ' as col_length, '
    || '''' || nvl(c.avg_col_len,0) || '''' || ' as avg_col_length, '
    || '''' || nvl(c.char_length,0) || '''' || ' as char_length, '
    || '''' || nvl(tblc.comments, 'NONE') || '''' || ' as table_comments, '
    || '''' || nvl(colc.comments, 'NONE') || '''' || ' as column_comments, '
    || ' count(*) as rcount, min('
    || c.column_name || ') as min_date, max('
    || c.column_name || ') as max_date, '
    || ' null as min_integer, null as max_integer, '
    || ' null as min_number, null as max_number, '
    || ' null as min_varchar2, null as max_varchar2, min(length('
    || c.column_name || ')) as min_len, max(length('
    || c.column_name || ')) as max_len, sysdate'
    || ' from '
    || C.owner || '.' || C.table_name
    || ' ' || CHR(13) || chr(10) || ' UNION ALL ' AS MYSQL
    from sys.all_tab_columns c
    inner join sys.all_tables t
    on c.table_name = t.table_name
    and c.owner = t.owner
    left outer join sys.all_tab_comments tblc
    on t.owner = tblc.owner
    and t.table_name = tblc.table_name
    left outer join sys.all_col_comments colc
    on c.owner = colc.owner
    and c.table_name = colc.table_name
    and c.column_name = colc.column_name
    where c.owner = I.OWNER
    and c.data_type = 'DATE'
    and c.table_name = I.TABLE_NAME
    LOOP
    -- DBMS_OUTPUT.PUT_LINE(MYSQLTEXT.MYSQL);
    dbms_lob.writeappend(c, length(MYSQLTEXT.MYSQL),MYSQLTEXT.MYSQL);
    END LOOP;
    ----number
    FOR MYSQLTEXT IN (select
    'select '
    || '''' || c.table_name || '''' || ' as tname, '
    || '''' || c.column_name || '''' || ' as cname, '
    || '''' || c.data_type || '''' || ' as data_type, '
    || '''' || nvl(c.data_length, 0) || '''' || ' as data_length, '
    || '''' || nvl(c.data_precision, 0) || '''' || ' as data_precision, '
    || '''' || nvl(c.data_scale, 0) || '''' || ' as data_scale, '
    || '''' || c.nullable || '''' || ' as nullable, '
    || '''' || nvl(c.num_distinct,0) || '''' || ' as num_distinct, '
    || '''' || nvl(c.density,0.0) || '''' || ' as density, '
    || '''' || nvl(c.num_nulls,0) || '''' || ' as num_nulls, '
    || '''' || nvl(c.char_col_decl_length,0) || '''' || ' as col_length, '
    || '''' || nvl(c.avg_col_len,0) || '''' || ' as avg_col_length, '
    || '''' || nvl(c.char_length,0) || '''' || ' as char_length, '
    || '''' || nvl(tblc.comments, 'NONE') || '''' || ' as table_comments, '
    || '''' || nvl(colc.comments, 'NONE') || '''' || ' as column_comments, '
    || ' count(*) as rcount, null as min_date, null as max_date, '
    || ' null as min_integer, null as max_integer, min('
    || c.column_name || ') as min_number, max('
    || c.column_name || ') as max_number, null as min_varchar2, null as max_varchar2, min(length('
    || c.column_name || ')) as min_len, max(length('
    || c.column_name || ')) as max_len, sysdate '
    || ' from '
    || t.owner || '.' || c.table_name
    || ' ' || CHR(13) || chr(10) || ' UNION ALL ' AS MYSQL
    from sys.all_tab_columns c
    inner join sys.all_tables t
    on c.table_name = t.table_name
    and c.owner = t.owner
    left outer join sys.all_tab_comments tblc
    on t.owner = tblc.owner
    and t.table_name = tblc.table_name
    left outer join sys.all_col_comments colc
    on c.owner = colc.owner
    and c.table_name = colc.table_name
    and c.column_name = colc.column_name
    where c.owner = I.OWNER
    and c.data_type = 'NUMBER'
    and c.table_name = I.TABLE_NAME
    LOOP
    dbms_lob.writeappend(c, length(MYSQLTEXT.MYSQL),MYSQLTEXT.MYSQL);
    END LOOP;
    --integer
    FOR MYSQLTEXT IN (select
    'select '
    || '''' || c.table_name || '''' || ' as tname, '
    || '''' || c.column_name || '''' || ' as cname, '
    || '''' || c.data_type || '''' || ' as data_type, '
    || '''' || nvl(c.data_length, 0) || '''' || ' as data_length, '
    || '''' || nvl(c.data_precision, 0) || '''' || ' as data_precision, '
    || '''' || nvl(c.data_scale, 0) || '''' || ' as data_scale, '
    || '''' || c.nullable || '''' || ' as nullable, '
    || '''' || nvl(c.num_distinct,0) || '''' || ' as num_distinct, '
    || '''' || nvl(c.density,0.0) || '''' || ' as density, '
    || '''' || nvl(c.num_nulls,0) || '''' || ' as num_nulls, '
    || '''' || nvl(c.char_col_decl_length,0) || '''' || ' as col_length, '
    || '''' || nvl(c.avg_col_len,0) || '''' || ' as avg_col_length, '
    || '''' || nvl(c.char_length,0) || '''' || ' as char_length, '
    || '''' || nvl(tblc.comments, 'NONE') || '''' || ' as table_comments, '
    || '''' || nvl(colc.comments, 'NONE') || '''' || ' as column_comments, '
    || ' count(*) as rcount, null as min_date, null as max_date, '
    || ' null as min_integer, null as max_integer, min('
    || c.column_name || ') as min_number, max('
    || c.column_name || ') as max_number, null as min_varchar2, null as max_varchar2, min(length('
    || c.column_name || ')) as min_len, max(length('
    || c.column_name || ')) as max_len, sysdate '
    || ' from '
    || t.owner || '.' || c.table_name
    || ' ' || CHR(13) || chr(10) || ' UNION ALL ' AS MYSQL
    from sys.all_tab_columns c
    inner join sys.all_tables t
    on c.table_name = t.table_name
    and c.owner = t.owner
    left outer join sys.all_tab_comments tblc
    on t.owner = tblc.owner
    and t.table_name = tblc.table_name
    left outer join sys.all_col_comments colc
    on c.owner = colc.owner
    and c.table_name = colc.table_name
    and c.column_name = colc.column_name
    where c.owner = I.OWNER
    and c.data_type = 'INTEGER'
    and c.table_name = I.TABLE_NAME
    LOOP
    dbms_lob.writeappend(c, length(MYSQLTEXT.MYSQL),MYSQLTEXT.MYSQL);
    END LOOP;
    --char and varchar
    FOR MYSQLTEXT IN (select
    'select '
    || '''' || c.table_name || '''' || ' as tname, '
    || '''' || c.column_name || '''' || ' as cname, '
    || '''' || c.data_type || '''' || ' as data_type, '
    || '''' || nvl(c.data_length, 0) || '''' || ' as data_length, '
    || '''' || nvl(c.data_precision, 0) || '''' || ' as data_precision, '
    || '''' || nvl(c.data_scale, 0) || '''' || ' as data_scale, '
    || '''' || c.nullable || '''' || ' as nullable, '
    || '''' || nvl(c.num_distinct,0) || '''' || ' as num_distinct, '
    || '''' || nvl(c.density,0.0) || '''' || ' as density, '
    || '''' || nvl(c.num_nulls,0) || '''' || ' as num_nulls, '
    || '''' || nvl(c.char_col_decl_length,0) || '''' || ' as col_length, '
    || '''' || nvl(c.avg_col_len,0) || '''' || ' as avg_col_length, '
    || '''' || nvl(c.char_length,0) || '''' || ' as char_length, '
    || '''' || nvl(tblc.comments, 'NONE') || '''' || ' as table_comments, '
    || '''' || nvl(colc.comments, 'NONE') || '''' || ' as column_comments, '
    || ' count(*) as rcount, null as min_date, null as max_date, '
    || ' null as min_integer, null as max_integer, '
    || ' null as min_number, null as max_number, min('
    || c.column_name || ') as min_varchar2, max('
    || c.column_name || ') as max_varchar2, min(length('
    || c.column_name || ')) as min_len, max(length('
    || c.column_name || ')) as max_len, sysdate'
    || ' from '
    || t.owner || '.' || c.table_name
    || ' ' || CHR(13) || chr(10) || ' UNION ALL ' AS MYSQL
    from sys.all_tab_columns c
    inner join sys.all_tables t
    on c.table_name = t.table_name
    and c.owner = t.owner
    left outer join sys.all_tab_comments tblc
    on t.owner = tblc.owner
    and t.table_name = tblc.table_name
    left outer join sys.all_col_comments colc
    on c.owner = colc.owner
    and c.table_name = colc.table_name
    and c.column_name = colc.column_name
    where c.owner = I.OWNER
    and c.data_type in ('VARCHAR2', 'CHAR')
    and c.table_name = I.TABLE_NAME
    LOOP
    dbms_lob.writeappend(c, length(MYSQLTEXT.MYSQL),MYSQLTEXT.MYSQL);
    END LOOP;
    e:='select null , null , null, null,null,null, null, null, null,null, null, null, null, null, null , null, null, null, null, null, null, null, null , null , null , null , null from dual where rownum < 0 ';
    dbms_lob.writeappend(c, length(e),e);
    execute immediate to_char(c);
    dbms_lob.createtemporary(c, true);
    t := 'insert INTO DATA_PROFILE_COL_DTL ';
    dbms_lob.writeappend(c,length(t), t);
    ----date
    FOR MYSQLTEXT IN (select
    ' select a.tname as table_name, a.cname as column_name, rownum as freq_rank, '
    || 'a.column_value as date_column_value, '
    || 'null as integer_column_value, null as number_column_value, null as varchar2_column_value, '
    || ' a.occurs, t.total_rows, round((((a.occurs * 1.0) / (t.total_rows * 1.0)) * 100), 5) as occurs_percent, '
    || ' a.capture_date'
    || ' from ( select '
    || '''' || c.table_name || '''' || ' as tname, '
    || '''' || c.column_name || '''' || ' as cname, '
    || c.column_name || ' as column_value, '
    || ' count(*) as occurs, sysdate as capture_date'
    || ' from '
    || t.owner || '.' || c.table_name
    || ' group by ' || c.column_name
    || ' order by count(*) desc )a inner join '
    || ' ( select ''' || c.table_name || ''' as tname, count(*) as total_rows from ' || t.owner || '.' || c.table_name || ') t '
    || ' on a.tname = t.tname where rownum <= 100'
    || CHR(13) || chr(10) || ' UNION ALL ' AS MYSQL
    from sys.all_tab_columns c
    inner join sys.all_tables t
    on c.table_name = t.table_name
    and c.owner = t.owner
    where c.owner = i.owner
    and c.data_type IN ('DATE')
    and c.table_name = i.table_name
    LOOP
    dbms_lob.writeappend(c, length(MYSQLTEXT.MYSQL),MYSQLTEXT.MYSQL);
    END LOOP;
    ----number
    FOR MYSQLTEXT IN (select
    ' select a.tname as table_name, a.cname as column_name, rownum as freq_rank, '
    || 'null as date_column_value, '
    || 'a.column_value as integer_column_value, null as number_column_value, null as varchar2_column_value, '
    || ' a.occurs, t.total_rows, round((((a.occurs * 1.0) / (t.total_rows * 1.0)) * 100), 5) as occurs_percent, '
    || ' a.capture_date'
    || ' from ( select '
    || '''' || c.table_name || '''' || ' as tname, '
    || '''' || c.column_name || '''' || ' as cname, '
    || c.column_name || ' as column_value, '
    || ' count(*) as occurs, sysdate as capture_date'
    || ' from '
    || t.owner || '.' || c.table_name
    || ' group by ' || c.column_name
    || ' order by count(*) desc )a inner join '
    || ' ( select ''' || c.table_name || ''' as tname, count(*) as total_rows from ' || c.table_name || ') t '
    || ' on a.tname = t.tname where rownum <= 100'
    || CHR(13) || chr(10) || ' UNION ALL ' AS MYSQL
    from sys.all_tab_columns c
    inner join sys.all_tables t
    on c.table_name = t.table_name
    and c.owner = t.owner
    where c.owner = I.OWNER
    and c.data_type = 'INTEGER'
    and c.table_name = I.TABLE_NAME
    LOOP
    dbms_lob.writeappend(c, length(MYSQLTEXT.MYSQL),MYSQLTEXT.MYSQL);
    END LOOP;
    --integer
    FOR MYSQLTEXT IN (select
    ' select a.tname as table_name, a.cname as column_name, rownum as freq_rank, '
    || 'null as date_column_value, '
    || 'null as integer_column_value, a.column_value as number_column_value, null as varchar2_column_value, '
    || ' a.occurs, t.total_rows, round((((a.occurs * 1.0) / (t.total_rows * 1.0)) * 100), 5) as occurs_percent, '
    || ' a.capture_date'
    || ' from ( select '
    || '''' || c.table_name || '''' || ' as tname, '
    || '''' || c.column_name || '''' || ' as cname, '
    || c.column_name || ' as column_value, '
    || ' count(*) as occurs, sysdate as capture_date'
    || ' from '
    || t.owner || '.' || c.table_name
    || ' group by ' || c.column_name
    || ' order by count(*) desc )a inner join '
    || ' ( select ''' || c.table_name || ''' as tname, count(*) as total_rows from ' || t.owner || '.' || c.table_name || ') t '
    || ' on a.tname = t.tname where rownum <= 100'
    || CHR(13) || chr(10) || ' UNION ALL ' AS MYSQL
    from sys.all_tab_columns c
    inner join sys.all_tables t
    on c.table_name = t.table_name
    and c.owner = t.owner
    where c.owner = I.OWNER
    and c.data_type in ('NUMBER', 'DECIMAL')
    and c.table_name = I.TABLE_NAME
    LOOP
    dbms_lob.writeappend(c, length(MYSQLTEXT.MYSQL),MYSQLTEXT.MYSQL);
    END LOOP;
    --char and varchar
    FOR MYSQLTEXT IN (select
    ' select a.tname as table_name, a.cname as column_name, rownum as freq_rank, '
    || 'null as date_column_value, '
    || 'null as integer_column_value, null as number_column_value, a.column_value as varchar2_column_value, '
    || ' a.occurs, t.total_rows, round((((a.occurs * 1.0) / (t.total_rows * 1.0)) * 100), 5) as occurs_percent, '
    || ' a.capture_date'
    || ' from ( select '
    || '''' || c.table_name || '''' || ' as tname, '
    || '''' || c.column_name || '''' || ' as cname, '
    || c.column_name || ' as column_value, '
    || ' count(*) as occurs, sysdate as capture_date'
    || ' from '
    || t.owner || '.' || c.table_name
    || ' group by ' || c.column_name
    || ' order by count(*) desc )a inner join '
    || ' ( select ''' || c.table_name || ''' as tname, count(*) as total_rows from ' || t.owner || '.' || c.table_name || ') t '
    || ' on a.tname = t.tname where rownum <= 100'
    || CHR(13) || chr(10) || ' UNION ALL ' AS MYSQL
    from sys.all_tab_columns c
    inner join sys.all_tables t
    on c.table_name = t.table_name
    and c.owner = t.owner
    where c.owner = I.OWNER
    and c.data_type in ('VARCHAR2', 'CHAR')
    and c.table_name = I.TABLE_NAME
    LOOP
    dbms_lob.writeappend(c, length(MYSQLTEXT.MYSQL),MYSQLTEXT.MYSQL);
    END LOOP;
    e:='select null, null, null, null, null, null, null, null, null, null, null from dual where rownum < 0 ';
    dbms_lob.writeappend(c, length(e),e);
    execute immediate to_char(c);
    end loop;
    end;

    Most likely issue is:
    execute immediate to_char(c); TO_CHAR will raise numeric or value error if c exeeds 4000 bytes. What Oracle version you are on? In newer versions execute immediate supports CLOB, so you can chnege the above to:
    execute immediate c;Keep in mind, execute immediate has 32K limit on SQL string.
    SY.

  • Validating Char. & Strings

    Hello,
    I am a novice programmer and my program does not check for strings and numeric characters. Below is my program, please give me some feedback, as soon as possible. Thanks a lot
    Martin
    import javax.swing.JOptionPane;
    import java.text.DecimalFormat;
    public class GradeWatch6{//start of class definition GradeWatch
         public static void main ( String args[] ) {//start of main method
              //string declarations
              String firstname="";
              String secondname;
              String studentid;
              String midtermgrade;
              String finalgrade;
              String listings="";
              String option;//variable used to receive user's option <-1>//<0>
              //character declarations
              char actualgrade;//letter grade assigned to total points earned
              char lettergrade=0;//assignment of a letter grade
              //integer declarations
              int loop=0;//(this will be converted fr. option//will compare result)
              int studentid_int;
              int midterm_grade=0;
              int final_grade=0;
              double midterm_gradevalue=0;//point calculations
              double final_gradevalue=0;//point calculations
              double total_gradevalue=0;//total points possible out of 100
              do
              //input dialogs (5)
              boolean firstnamecheck=true;
              while (firstnamecheck=false){
              firstname = JOptionPane.showInputDialog("Enter The Student's First Name: ");
              if (!Character.isLetter(firstname.charAt(0)))
                   firstnamecheck=false;
              for (int j=1;j<firstname.length();j++)
                   if (!Character.isDigit(firstname.charAt(j)))
                             firstnamecheck=false;
                             System.out.println(""+firstnamecheck);//printing on black screen
                             secondname= JOptionPane.showInputDialog ( "Invalid Entry!" );
              secondname = JOptionPane.showInputDialog("Enter The Student's Last Name: ");
              studentid = JOptionPane.showInputDialog("Student Id is the Student's Social Security Number.\nEnter The Student's ID #: ");
              studentid_int= Integer.parseInt(studentid);
              /*Validates student id so that it can only receive a 9 digit number,
              no negative values, and only alows integer input/
              while ( (studentid.length()!=9) ||(studentid_int<0) )
                        studentid= JOptionPane.showInputDialog ( "Invalid Entry! \n Student Id is the Student's Social Security Number.\nPlease Re-Enter Student Id: ");
                        studentid_int= Integer.parseInt(studentid);
              midtermgrade = JOptionPane.showInputDialog("This is worth 40% of Student's Grade.\nEnter Mid-term Grade: ");
              midterm_grade = Integer.parseInt( midtermgrade);
              while ( (midterm_grade < 0) || (midterm_grade > 100) )
                        midtermgrade=JOptionPane.showInputDialog ("Invalid Entry!\nA grade entered must be between (0-100).\nPleae Re-Enter Mid-term Grade: ");
                        midterm_grade = Integer.parseInt( midtermgrade);
              finalgrade = JOptionPane.showInputDialog("This is worth 60% of Student's Grade.\nEnter Final Grade:");
              final_grade= Integer.parseInt( finalgrade);
              while ( (final_grade<0) || (final_grade > 100) )
                        finalgrade= JOptionPane.showInputDialog ("Invalid Entry!\nA grade entered must be between (0-100).\nPleae Re-Enter the Final's Grade: ");
                        final_grade= Integer.parseInt( finalgrade);
              DecimalFormat twoDigits = new DecimalFormat( "0.00");
              //calculations for grades
                   //midterm is worth 40% of grade
              midterm_gradevalue = midterm_grade * .4;
                   //final is worth 60% of grade
              final_gradevalue = final_grade * .6;
                   //calculates the final grade for the student in class
              total_gradevalue = midterm_gradevalue + final_gradevalue;
              //if else statement for grade allotment
              if (total_gradevalue>=90)
                   lettergrade='A';
              else if (total_gradevalue>=80)
                   lettergrade='B';
              else if (total_gradevalue>=70)
                   lettergrade='C';     
              else if (total_gradevalue>=60)
                   lettergrade='D';     
              else if (total_gradevalue>=50)
                   lettergrade='F';          
              //Shows Output of Information Entered (5) of one student               
              JOptionPane.showMessageDialog
                   (null, "Student: " + secondname + " , " + firstname +
                        "\nMid-Term Points Earned: " + midterm_gradevalue +
                        "\nFinal Points Earned: " + final_gradevalue +
                        "\nTotal Points Earned: " + total_gradevalue +
                        "\nGrade Assigned: "+ lettergrade,
                        "\n STUDENT ID #: " + studentid,
                        JOptionPane.PLAIN_MESSAGE);
              /*Askes user whether or not to input an additional student*/
              option = JOptionPane.showInputDialog("Enter < 0 > to input a student. \nEnter < -1 > to quit. ");
              //converts string input into integer loop     
              loop = Integer.parseInt( option );
         listings +="Student ID #: " + studentid +
                   "\n [ " + secondname + ", " + firstname + " ] " +
                   "\n Midterm Points Earned: " + midterm_gradevalue +
                   "\n Final Points Earned: " + final_gradevalue +
                   "\n Total Points Earned: " + total_gradevalue +
                   "\n**********Grade Assigned: "+ lettergrade + "\n";
              } while ( loop !=-1);     
              JOptionPane.showMessageDialog(
                   null, listings,
                   "Class Results: ",
                   JOptionPane.PLAIN_MESSAGE);
              System.exit ( 0 );
         }//end of programming method
    }//end of class definition

    You didn't indent your code, so that makes it hard to read, and there's a lot of it that has nothing to do with what your question might be. But you want feedback? Well you are "validating" the student's first name in a strange way. A letter followed by any characters that aren't digits -- for example, "a++?" would pass. And that validation will fail if an empty string is provided, because "charAt(0)" assumes there is at least one character. I would just check it isn't blank. And I would provide a meaningful error message. "Invalid Entry" is unhelpful as it doesn't tell the user what is wrong with the input.

  • Multiplication problem..is this ryt? this is 4m 1-10

    import java.io.*;
    public class multtbl
    public static void main(String args[])
    int loop = 5;
    int j = 0;
    int i = 0;
    String t= "";
    System.out.print("type 1 for loop type 2 for while loop type 3 for do loops ");
    BufferedReader stdin1 =new BufferedReader(new
    InputStreamReader(System.in));
    try {
    t = stdin1.readLine();
    }catch(java.io.IOException exp){ exp.printStackTrace();}
    loop = Integer.parseInt(t);
    System.out.println("");
    switch(loop){
    case 1:
    for (i = 1; i <= 10; i++){
    System.out.println();
    for (j = 1; j <= 10; j++){
    System.out.printf("%4d", i * j);
    case 2:
    i = 1;
    j = 1;
    while(foo); {  (i <= 10);{
    bar();
    System.out.print(i * j); i++;
    while(foo); { (j <=10);{
    bar();
    System.out.print(i * j);
    j++;
    case 3:
    i = 1;
    j = 1;
    do {System.out.printf("%4d", i * j);
            i++;}
    while(foo); { (i <= 10);
    bar();
    System.out.println();
    do {System.out.printf("%4d", i * j);
            j++;}
    while(foo); { (j <=10);
    bar();
    }}}

    warnerja wrote:
    One of life's tough lessons is that sometimes we have to figure out that we're simply on the wrong path, and choose another.Is that our lesson for the day? It seems rather fitting, given the winning posts we've seen so far...

  • Implementing Arrays

    Hi,
    I am an novice Java programmer and i am having some trouble with arrays, I have written a program that calculates grades, but it does not use arrays. I would like to use arays in my program and at the same time have it support up to 50 people. Please help me in this matter, thanks,
    Martin
    import javax.swing.JOptionPane;
    import java.text.DecimalFormat;
    public class GradeWatch9{//start of class definition GradeWatch
         public static void main ( String args[] ) {//start of main method
              //string declarations
              String firstname;
              String secondname;
              String studentid;
              String midtermgrade;
              String finalgrade;
              String listings="";
              String option;//variable used to receive user's option <-1>//<0>
              //character declarations
              char actualgrade;//letter grade assigned to total points earned
              char lettergrade=0;//assignment of a letter grade
              //integer declarations
              int loop=0;//(this will be converted fr. option//will compare result)
              int studentid_int;
              int midterm_grade=0;
              int final_grade=0;
              double midterm_gradevalue=0;//point calculations
              double final_gradevalue=0;//point calculations
              double total_gradevalue=0;//total points possible out of 100
              do
              //input dialogs (5) with validations
              boolean firstnamecheck=false;
              firstname = JOptionPane.showInputDialog("Enter The Student's First Name: ");
              for ( int j=0; j<firstname.length(); j++ )
                   if(!Character.isLetter(firstname.charAt(j)))
                        firstnamecheck=false;
                        firstname=JOptionPane.showInputDialog("Invalid Entry: \n You have entered an integer. \nPlease Re-enter Sudent's first name: ");
              boolean secondnamecheck=false;
              secondname = JOptionPane.showInputDialog("Enter The Student's Last Name: ");
                   for ( int j=0; j<secondname.length(); j++ )
                   if(!Character.isLetter(secondname.charAt(j)))
                        secondnamecheck=false;
                        secondname=JOptionPane.showInputDialog ("Invalid Entry: \n You have entered an integer. \nPlease Re-enter Sudent's last name: ");
              boolean studentidcheck=false;
              do
                        studentid = JOptionPane.showInputDialog("Student Id is the Student's Social Security Number.\nEnter The Student's ID #: ");
              if (studentid.length()!=9)
                        JOptionPane.showMessageDialog(
                             null,
                             "INVALID ENTRY: PLEASE ENTER 9 DIGITS WITHOUT DASHES.",
                             "ERROR", JOptionPane.ERROR_MESSAGE);
              else {
                   for ( int j=0; j < studentid.length(); j++ ){
                                  if(!Character.isDigit(studentid.charAt(j)))
                                            JOptionPane.showMessageDialog(
                                  null,
                                  "INVALID ENTRY: YOU HAVE ENTERED LETTERS.",
                                  "ERROR", JOptionPane.ERROR_MESSAGE);
                                  else {
                                       studentid_int= Integer.parseInt(studentid);
                                       if      (studentid_int<0)
                                            JOptionPane.showMessageDialog(
                                  null,
                                  "INVALID ENTRY: YOU HAVE ENTERED A NEGATIVE NUMBER.",
                                  "ERROR",
                                  JOptionPane.ERROR_MESSAGE);
                                       else studentidcheck=true;
                   } while (studentidcheck==false);
              midtermgrade = JOptionPane.showInputDialog("This is worth 40% of Student's Grade.\nEnter Mid-term Grade: ");
              midterm_grade = Integer.parseInt( midtermgrade);
              while ( (midterm_grade < 0) || (midterm_grade > 100) )
                        midtermgrade=JOptionPane.showInputDialog ("Invalid Entry!\nA grade entered must be between (0-100).\nPleae Re-Enter Mid-term Grade: ");
                        midterm_grade = Integer.parseInt( midtermgrade);
              finalgrade = JOptionPane.showInputDialog("This is worth 60% of Student's Grade.\nEnter Final Grade:");
              final_grade= Integer.parseInt( finalgrade);
              while ( (final_grade<0) || (final_grade > 100) )
                        finalgrade= JOptionPane.showInputDialog ("Invalid Entry!\nA grade entered must be between (0-100).\nPleae Re-Enter the Final's Grade: ");
                        final_grade= Integer.parseInt( finalgrade);
              DecimalFormat twoDigits = new DecimalFormat( "0.00");
              //calculations for grades
                   //midterm is worth 40% of grade
              midterm_gradevalue = midterm_grade * .4;
                   //final is worth 60% of grade
              final_gradevalue = final_grade * .6;
                   //calculates the final grade for the student in class
              total_gradevalue = midterm_gradevalue + final_gradevalue;
              //if else statement for grade allotment
              if (total_gradevalue>=90)
                   lettergrade='A';
              else if (total_gradevalue>=80)
                   lettergrade='B';
              else if (total_gradevalue>=70)
                   lettergrade='C';     
              else if (total_gradevalue>=60)
                   lettergrade='D';     
              else if (total_gradevalue>=50)
                   lettergrade='F';          
              //Shows Output of Information Entered (5) of one student               
              JOptionPane.showMessageDialog
                   (null, "Student: " + secondname + " , " + firstname +
                        "\nMid-Term Points Earned: " + midterm_gradevalue +
                        "\nFinal Points Earned: " + final_gradevalue +
                        "\nTotal Points Earned: " + total_gradevalue +
                        "\nGrade Assigned: "+ lettergrade,
                        "\n STUDENT ID #: " + studentid,
                        JOptionPane.PLAIN_MESSAGE);
              /*Askes user whether or not to input an additional student*/
              option = JOptionPane.showInputDialog("Enter < 0 > to input a student. \nEnter < -1 > to quit. ");
              //converts string input into integer loop     
              loop = Integer.parseInt( option );
         listings +="Student ID #: " + studentid +
                   "\n [ " + secondname + ", " + firstname + " ] " +
                   "\n Midterm Points Earned: " + midterm_gradevalue +
                   "\n Final Points Earned: " + final_gradevalue +
                   "\n Total Points Earned: " + total_gradevalue +
                   "\n**********Grade Assigned: "+ lettergrade + "\n";
              } while ( loop !=-1);     
              JOptionPane.showMessageDialog(
                   null, listings,
                   "Class Results: ",
                   JOptionPane.PLAIN_MESSAGE);
              System.exit ( 0 );
         }//end of programming method
    }//end of class definition

    using arrays is pretty simple. You may want to clean up your code a bit, and place declerations outside of the main method, and create some smaller methods that dow rok, rather then having main carry the whole load. try something like this:
    public class GradeWatch9
    Student [] studentFile=new Student[50]; /*makes an array with 50 cells
    *here I used another class, Student, which you will have to write. the Student class could be as small as two data fields, String name and int grade.
      public static void main ( String args[] )
         for(int i=0;i<studentFile.length;i++)
             String name=getNextName();  //method you write to get the name
             studentFile=new Student(name);
    int grade=getGrade(); /*method to get and calculate grades*/
    studentFile[i].setGrade(grade);
    getNextName()
    //gets the students name
    getGrade()
    //gets and calculates grade
    public class Student
    int grade
    String name
    Student(String n)
    name=n;
    public void setGrade(int g)
    grade=g;
    see if that helps a bit :)

  • Implementing Arrays - Problem!

    Hi,
    I am an novice Java programmer and i am having some trouble with arrays, I have written a program that calculates grades, but it does not use arrays. I would like to use arays in my program and at the same time have it support up to 50 people. Please help me in this matter, thanks,
    Martin
    import javax.swing.JOptionPane;
    import java.text.DecimalFormat;
    public class GradeWatch9{//start of class definition GradeWatch
    public static void main ( String args[] ) {//start of main method
    //string declarations
    String firstname;
    String secondname;
    String studentid;
    String midtermgrade;
    String finalgrade;
    String listings="";
    String option;//variable used to receive user's option <-1>//<0>
    //character declarations
    char actualgrade;//letter grade assigned to total points earned
    char lettergrade=0;//assignment of a letter grade
    //integer declarations
    int loop=0;//(this will be converted fr. option//will compare result)
    int studentid_int;
    int midterm_grade=0;
    int final_grade=0;
    double midterm_gradevalue=0;//point calculations
    double final_gradevalue=0;//point calculations
    double total_gradevalue=0;//total points possible out of 100
    do
    //input dialogs (5) with validations
    boolean firstnamecheck=false;
    firstname = JOptionPane.showInputDialog("Enter The Student's First Name: ");
    for ( int j=0; j<firstname.length(); j++ )
    if(!Character.isLetter(firstname.charAt(j)))
    firstnamecheck=false;
    firstname=JOptionPane.showInputDialog("Invalid Entry: \n You have entered an integer. \nPlease Re-enter Sudent's first name: ");
    boolean secondnamecheck=false;
    secondname = JOptionPane.showInputDialog("Enter The Student's Last Name: ");
    for ( int j=0; j<secondname.length(); j++ )
    if(!Character.isLetter(secondname.charAt(j)))
    secondnamecheck=false;
    secondname=JOptionPane.showInputDialog ("Invalid Entry: \n You have entered an integer. \nPlease Re-enter Sudent's last name: ");
    boolean studentidcheck=false;
    do
    studentid = JOptionPane.showInputDialog("Student Id is the Student's Social Security Number.\nEnter The Student's ID #: ");
    if (studentid.length()!=9)
    JOptionPane.showMessageDialog(
    null,
    "INVALID ENTRY: PLEASE ENTER 9 DIGITS WITHOUT DASHES.",
    "ERROR", JOptionPane.ERROR_MESSAGE);
    else {
    for ( int j=0; j < studentid.length(); j++ ){
    if(!Character.isDigit(studentid.charAt(j)))
    JOptionPane.showMessageDialog(
    null,
    "INVALID ENTRY: YOU HAVE ENTERED LETTERS.",
    "ERROR", JOptionPane.ERROR_MESSAGE);
    else {
    studentid_int= Integer.parseInt(studentid);
    if (studentid_int<0)
    JOptionPane.showMessageDialog(
    null,
    "INVALID ENTRY: YOU HAVE ENTERED A NEGATIVE NUMBER.",
    "ERROR",
    JOptionPane.ERROR_MESSAGE);
    else studentidcheck=true;
    } while (studentidcheck==false);
    midtermgrade = JOptionPane.showInputDialog("This is worth 40% of Student's Grade.\nEnter Mid-term Grade: ");
    midterm_grade = Integer.parseInt( midtermgrade);
    while ( (midterm_grade < 0) || (midterm_grade > 100) )
    midtermgrade=JOptionPane.showInputDialog ("Invalid Entry!\nA grade entered must be between (0-100).\nPleae Re-Enter Mid-term Grade: ");
    midterm_grade = Integer.parseInt( midtermgrade);
    finalgrade = JOptionPane.showInputDialog("This is worth 60% of Student's Grade.\nEnter Final Grade:");
    final_grade= Integer.parseInt( finalgrade);
    while ( (final_grade<0) || (final_grade > 100) )
    finalgrade= JOptionPane.showInputDialog ("Invalid Entry!\nA grade entered must be between (0-100).\nPleae Re-Enter the Final's Grade: ");
    final_grade= Integer.parseInt( finalgrade);
    DecimalFormat twoDigits = new DecimalFormat( "0.00");
    //calculations for grades
    //midterm is worth 40% of grade
    midterm_gradevalue = midterm_grade * .4;
    //final is worth 60% of grade
    final_gradevalue = final_grade * .6;
    //calculates the final grade for the student in class
    total_gradevalue = midterm_gradevalue + final_gradevalue;
    //if else statement for grade allotment
    if (total_gradevalue>=90)
    lettergrade='A';
    else if (total_gradevalue>=80)
    lettergrade='B';
    else if (total_gradevalue>=70)
    lettergrade='C';
    else if (total_gradevalue>=60)
    lettergrade='D';
    else if (total_gradevalue>=50)
    lettergrade='F';
    //Shows Output of Information Entered (5) of one student
    JOptionPane.showMessageDialog
    (null, "Student: " + secondname + " , " + firstname +
    "\nMid-Term Points Earned: " + midterm_gradevalue +
    "\nFinal Points Earned: " + final_gradevalue +
    "\nTotal Points Earned: " + total_gradevalue +
    "\nGrade Assigned: "+ lettergrade,
    "\n STUDENT ID #: " + studentid,
    JOptionPane.PLAIN_MESSAGE);
    /*Askes user whether or not to input an additional student*/
    option = JOptionPane.showInputDialog("Enter < 0 > to input a student. \nEnter < -1 > to quit. ");
    //converts string input into integer loop
    loop = Integer.parseInt( option );
    listings +="Student ID #: " + studentid +
    "\n [ " + secondname + ", " + firstname + " ] " +
    "\n Midterm Points Earned: " + midterm_gradevalue +
    "\n Final Points Earned: " + final_gradevalue +
    "\n Total Points Earned: " + total_gradevalue +
    "\n**********Grade Assigned: "+ lettergrade + "\n";
    } while ( loop !=-1);
    JOptionPane.showMessageDialog(
    null, listings,
    "Class Results: ",
    JOptionPane.PLAIN_MESSAGE);
    System.exit ( 0 );
    }//end of programming method
    }//end of class definition

    You should use a List instead, it will be more maintainable if you want this program to work for more students, without having to edit the souce:
    List students = new ArrayList(); // Create a List
    // To add students
    students.add(student);
    // To iterate through them
    Iterator it = students.iterator();
    while(it.hasNext)
    Student s = (Student)it.next();
    // For direct access
    Student s = (Student)students.get(index);
    class Student extends Object
    private String firstName;
    private String secondName;
    private String id;
    private String midtermGrade;
    private String finalGrade;
    public Student()
    // Add a setter/getter for each variable
    also override toString()
    now with this bean, you could open an option pane passing a JList that was create with the passed in List

  • Output integer loop

    I'd like to create a sub VI that uses a for loop to spit out an integer. I want to set up a handful of boolean controls, each corresponding to an integer (say 1, 2, 3). When none are true, the output of the sub VI is 0, and when one of the controls is switched to true, the output will be 1, 2, or 3. Any suggestions?

    One possibility is to use radio buttons.
    Another ...
    Attachments:
    Example_VI_BD.png ‏12 KB

  • Suggestion: Macros or a way to unroll loops? Integer array input? Shader Model 3 and 4?

    I think it would be nice if pixel bender supported a way to unroll loops. In it's current state certain shaders are really awkward to write or just get ugly when they're converted for flash player. I know it wouldn't be that hard for the developers to just unroll constant sized loops. Things such as:
    for (int i = 0; i < 10; ++i)
      if (foo) { ... }
    can be unrolled easily. Either that or add in some code generation feature that allows this with a preprocessor system. Or better yet add in support for loops since it only requires shader model 3 or equivelant from GLSL.
    This brings me onto another point. Is there going to be support for Shader Model 4? I'm talking about bitwise operations and integer types. Even if you don't allow native support for byte array adding texture sampling for bytes, shorts, and integers would be nice. Also allowing this to work in flash would be nice with the ability to tell the user they don't have shader model 4 or be able to detect compatability and use a different shader.
    Integer arrays would be nice to allow to as input then to the shader. I noticed the reference manual already mentioned:
    "NOTE: Pixel Bender 1.0 supports only arrays of floats, and the array size is a compile-time constant. Future versions of Pixel Bender will allow arrays to be declared with a size based on kernel parameters, which will enable parameter-dependent look-up table sizes."
    Again support for these features in flash player would be really nice.
    Targetting the lowest GPUs is really limiting the true power of pixel bender. I wrote this for fun: http://assaultwars.com/pictures/raycasting6.png which is just a simple real-time voxel raycaster. However, it could be so much more powerful if pixel bender supported more of the GPUs features. Even simple things like custom functions would be really handy in flash player. I'm thinking of this more oriented toward flash games too where more powerful features are unlocked based on the user's GPU.
    If this is already planned for a future pixel bender release then nevermind. I didn't see a developers blog or any news about future versions.
    Interesting:
    http://forums.adobe.com/thread/36659?tstart=60
    Apparently Kevin said "Look for them in a future version of the language as cards that support  these features become common." in regards to bitwise operators aka Shader Model 4.

    Here's an example, not using NetBeans:
    import javax.swing.*;
    public class TextDemo extends JPanel
        public TextDemo()
            int[] newbinarray = {0, 1, 1};
            StringBuffer sb = new StringBuffer();
            for (int value : newbinarray)
                sb.append(value);
            String st = new String(sb);
            this.add(new JTextField(st));
        private static void createAndShowGUI()
            JFrame frame = new JFrame("TextDemo");
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.add(new TextDemo());
            frame.pack();
            frame.setVisible(true);
        public static void main(String[] args)
            javax.swing.SwingUtilities.invokeLater(new Runnable()
                public void run()
                    createAndShowGUI();
    }

  • Using Loops with INDEX BY BINARY INTEGER

    Hi,
    I have a little question with the next procedure:
                                   SET SERVEROUTPUT ON
                                DECLARE
                                   TYPE dept_table_type IS TABLE OF hr.departments%ROWTYPE
                                      INDEX BY BINARY_INTEGER;
                                   my_dept_table   dept_table_type;
                                   v_count        NUMBER (3)     := 160;
                                BEGIN
                                   FOR i IN 100 .. v_count
                                   LOOP
                                      SELECT *
                                        INTO my_dept_table (i)
                                        FROM hr.departments
                                       WHERE department_id = i;
                                   END LOOP;
                                   FOR i IN my_dept_table.FIRST .. my_dept_table.LAST
                                   LOOP
                                      DBMS_OUTPUT.put_line (my_dept_table (i).department_name);
                                   END LOOP;
                                END;                               When I run this procedure I get the following error:
    ORA-01403: Not found any data
    ORA-06512: line 11But I Know why is it, the department_id numbers are (100,110,120,130,140,150,160) and the first loop it's ok but
    in the second loop the 101 department_id doesn't exist an then it fails.
    what can I do to resolve this error?
    thanks in advance!!

    Hi Sarah,
    I cannot increment i variable, gives me the next error:
    expression 'I' cannot be used as an assignment target...
       SET SERVEROUTPUT ON
                                DECLARE
                                   TYPE dept_table_type IS TABLE OF hr.departments%ROWTYPE
                                      INDEX BY BINARY_INTEGER;
                                   my_dept_table   dept_table_type;
                                   v_count        NUMBER (3)     := 200;
                                BEGIN
                                   FOR i IN 100 .. v_count
                                   LOOP
                                      SELECT *
                                        INTO my_dept_table (i)
                                        FROM hr.departments
                                       WHERE department_id = i;
                                       DBMS_OUTPUT.put_line (i);
                                    i:= i+10;  
                                   END LOOP;
                                   FOR i IN my_dept_table.FIRST .. my_dept_table.LAST
                                   LOOP
                                      DBMS_OUTPUT.put_line (my_dept_table (i).department_name);
                                   END LOOP;
                                END;                              

  • Incrementing Ascii and integer loop

    Hi there,
    Just wondering if anybody can help me with this little problem that I have... I'm trying to write a loop that increments ascii and integers. It should look something like this:
    0 1 2 3 4 5 6 7 8 9 A B C D ..... X Y Z 00 01 02..... 0A 0B 0C .... 0Z 10 11 .... ABCD1 and so on...
    I got the loop bits but I don't know what I can do to combine the 2...
             for (char x= 'A'; x <= 'Z'; x++)
                   System.out.println("Count is:" + x);
             for(int i=1; i<11; i++){
                   System.out.println("Count is: " + i);Can anybody give me some tips please? Thanks in advance!

    you can do this you know
    for(int i=0,char a='a';i<11,a<='z';i++,z++)and then print whatever you want to

  • Display contents of a loop  with time gaps in between

    Hi,
    I have a peculiar problem.
    Consider a "for" loop
    for ( i in 1..10)
    In the above loop i want to display each value of "i" after a certain time span ( say, 1 sec).
    In java, i could have used a "delay" function,but i do not know as how to achieve the same in javafx.
    Please help me.
    Thanks in advance.

    Something like that probably:
    def seq:Integer[] = [1..10];
    var bound:Integer = 0;
    def anim:PauseTransition = PauseTransition {
      duration: 1s
      repeatCount: sizeof seq
      action: function():Void {
        var m:String = "";
        for (i in [0..bound]) {
          m = "{m} {seq}";
    msg = m.trim();
    bound++;
    anim.play();                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Display contents of a loop  in SCENE

    Hi all,
    Can i display the contents of a for loop one after another in a "Scene".
    The code below displays the contents of "for" loop in OUTPUT window as well as in the "SCENE". But the problem is that the contents of "for" loop are displayed in the scene graph only after the for loop exits.
    how can i rectify this code to generate the output similar to the OUTPUT window in SCENE graph.?
    import javafx.scene.Scene;
    import javafx.stage.Stage;
    import javafx.scene.text.Text;
    import ranno.*;
    import javafx.scene.control.Button;
    import javafx.scene.Group;
    import generateResult.*;
    var number: Integer[];
    var msg : String ;
    var a : String[];
    var locX: Integer;
    var locY: Integer;
    def canvas = Group { };
    var display : Button =Button {
    translateX: 100
    translateY: 100
    width : 100
    height : 30
    text : "Click"
    var text : Text
    action:function(){
    delete canvas.content;
    for(i in [0..1])
    java.lang.Thread.sleep(1000);
    number=i;
    println(number[i]);
    a=Integer.toString(number[i]);
    locX=20;
    locY=20;
    msg = "{a}";
    text = Text{
    x: locX
    y: locY+20*i
    content : msg
    insert text into canvas.content;
    Stage
    title: "Numbers"
    var array : String[];
    var i : Integer;
    scene : Scene
    width: 400
    height: 200
    content :
    [display,canvas]
    If you haven't understood my question,please execute this code and compare the output in the OUTPUT window with the SCENE output.
    I want the output in SCENE to be similar to the output in OUTPUT window.
    Please help me in modifying my code .

    Since you haven't used the CODE button, the source code is messed up (star means bold here).
    But the short answer is: don't use a loop with sleep()!
    JavaFX provides Timelines and Transitions to animate things and add stuff progressively to the scenegraph.

  • Loop at  field-symbol  (any table) into string ?

    Hi Everyone,
    I need little help, I have a requirement to extract table content with columns names as the header.
    After doing some search I figured out the best way to this since table name will be only avaialbe at runtime through
    a selection field . my problem is to loop through field-symbol and convert a structure to string value so that I can
    write to the file.
    REPORT  zlab_tbl_export.
    DATA table_name(30) VALUE 'ZSMARTTS_HTML'.
    DATA v_file(100) VALUE 'c:\sap_export.txt'.
    DATA line(1000).
    DATA: o_data TYPE REF TO data.
    CREATE DATA o_data TYPE TABLE OF (table_name).
    FIELD-SYMBOLS: <table> TYPE ANY TABLE.
    ASSIGN o_data->* TO <table>.
    SELECT * UP TO 100 ROWS FROM (table_name) INTO TABLE <table>.
    OPEN DATASET v_file FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
    >>>>>>> LOOP at <table> into line.   >>>>>>>>>>>>  " Here the code breaks and fail
      TRANSFER line to v_file. 
      WRITE :/ line.          
    ENDLOOP.
    CLOSE DATASET v_file.
    Exception Message
    |Error analysis                                                                                |
    |    You attempted to move one data object to another.                                             |
    |    This is not possible here because the conversion of a data object                             |
    |    of type "v" to type "C" is not supported.                                                     |
    |                                                                                |
    |      List of internal ABAP types:                                                                |
    |                                                                                |
    |      C    Text (Character)                                                                       |
    |      N    Numerical text                                                                         |
    |      D    Date (YYYYMMDD)                                                                        |
    |      T    Time (HHMMSS)                                                                          |
    |      X    Hexadecimal                                                                            |
    |      I    Integer                                                                                |
    |      P    Packed number                                                                          |
    |      F    Floating point number                                                                  |
    |                                                                                |
    |      h    Internal table                                                                         |
    |      r    Object reference                                                                       |
    |      l    Data reference                                                                         |
    |      g    String of type C                                                                       |
    |      y    String of type X                                                                       |
    |      s    2-byte integer with plus/minus sign                                                    |
    |      b    1-byte integer without plus/minus sign                                                 |
    |      u    Structure (flat structure)                                                             |
    |      v    Structure (deep structure)                                                             |

    Hi Everyone, I need little help, I have a requirement to extract table content with columns names as the header. After doing some search I figured out the best way to this since table name will be only avaialbe at runtime through a selection field . my problem is to loop through field-symbol and convert a structure to string value so that I can write to the file.
    thie is the code
    REPORT  zlab_tbl_export.
    DATA table_name(30) VALUE 'ZSMARTTS_HTML'.
    DATA v_file(100) VALUE 'c:\sap_export.txt'.
    DATA line(1000).
    DATA: o_data TYPE REF TO data.
    CREATE DATA o_data TYPE TABLE OF (table_name).
    FIELD-SYMBOLS: <table> TYPE ANY TABLE.
    ASSIGN o_data->* TO <table>.
    SELECT * UP TO 100 ROWS FROM (table_name) INTO TABLE <table>.
    OPEN DATASET v_file FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
    LOOP at <table> into line.   " Fail here
      TRANSFER line to v_file. 
      WRITE :/ line.           
    ENDLOOP.
    CLOSE DATASET v_file.
    and this is the exception:
    Error analysis                                                                               
    You attempted to move one data object to another.                                            
        This is not possible here because the conversion of a data object                            
        of type v to type C is not supported.                                                    
    Edited by: Misbah on Jan 7, 2010 11:50 PM

  • Need help with retrieving data in vector using for-loop

    ok for my code, i type in String name, password, phone number and int currentsalary and desiredsalary into the textfields and click Add, and it goes into the vector and name appears on the JList ApplicantList.
    what do i add to my listselectionlistener so that by clicking on the name, i can display the details of the person whose name is in the list, back on the texfields?
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.event.*;
    import java.text.*;
    import java.util.*;
    import java.util.Vector;
    import javax.swing.JScrollPane.*;
    import javax.swing.event.ListSelectionListener;
    public class Employment extends JFrame
            //declare class variables
            private JPanel jpApplicant, jpEverything,jpWEST, jpCENTRE, jpEAST, jpAddEditDelete,
                                       jpCentreTOP, jpCentreBOT, jpEastTOP, jpEastCENTRE, jpEastBOT,
                                       jpBlank1, panel1, panel2, panel3, panel4;
            private JLabel jlblApplicantForm, jlblAppList, jlblName, jlblPhone,
                                       jlblCurrentSalary, jlblPassword, jlblDesiredSalary,
                                       jlblNotes, jlblApplicantSkills, jlblIndustrySkills,
                                       jlblBlank1, jlblBlank2;
            private JButton jbtnAdd1, jbtnEdit, jbtnDelete, jbtnSave, jbtnCancel,
                                            jbtnAdd2, jbtnRemove;
            private JTextField jtfName, jtfPhone, jtfCurrentSalary, jtfPassword,
                                               jtfDesiredSalary;
               String name,password,phone,currentsalary,desiredsalary,textareastuff;
               String selectedname;
            private         JTabbedPane tabbedPane;
            private DefaultListModel listModel,listModel2;
           private ListSelectionModel listSelectionModel;
            JList ApplicantList, ApplicantSkillsList, IndustrySkillsList;
            protected JTextArea NotesList;    
            Label ApplicantListLabel, NotesListLabel, ApplicantSkillsLabel,
                                    IndustrySkillsLabel;                
                    Vector details = new Vector();
                public static void main(String []args)
                    Employment f = new Employment();
                    f.setVisible(true);
                    f.setDefaultCloseOperation(EXIT_ON_CLOSE);
                    f.setResizable(false);
                }//end of main
                    public Employment()
                            setSize(800,475);
                            setTitle("E-commerce Placement Agency");
                            JPanel topPanel = new JPanel();
                            topPanel.setLayout( new BorderLayout() );
                            getContentPane().add( topPanel );
                            createPage1();
                            createPage2();
                            createPage3();
                            createPage4();
                            tabbedPane = new JTabbedPane();
                            tabbedPane.addTab( "Applicant", panel1 );
                            tabbedPane.addTab( "Job Order", panel2 );
                            tabbedPane.addTab( "Skill", panel3 );
                            tabbedPane.addTab( "Company", panel4 );
                            topPanel.add( tabbedPane, BorderLayout.CENTER );
            public void createPage1()//PAGE 1
                                    panel1 = new JPanel();
                                    panel1.setLayout( new BorderLayout());
                                    jpApplicant= new JPanel();
                            jpApplicant.setLayout(new BorderLayout());
                            Font bigFont = new Font("TimesRoman", Font.BOLD,24);
                            jlblApplicantForm = new JLabel("\t\t\t\tAPPLICANT FORM  ");
                            jlblApplicantForm.setFont(bigFont);
                            jpApplicant.add(jlblApplicantForm,BorderLayout.EAST);
                            panel1.add(jpApplicant,BorderLayout.NORTH);
           /*****************************************WEST*********************************/             
                            jpWEST = new JPanel();                 
                            jpWEST.setLayout( new BorderLayout());
                            //Applicant List
                                  listModel2=new DefaultListModel();
                                  ApplicantList = new JList(listModel2);
                                listSelectionModel = ApplicantList.getSelectionModel();
                                listSelectionModel.addListSelectionListener(new SharedListSelectionHandler());
                                JScrollPane scrollPane3 = new JScrollPane(ApplicantList);
                            ApplicantListLabel = new Label( "Applicant List:");
                            jpWEST.add(ApplicantListLabel,"North"); 
                            jpWEST.add(scrollPane3,"Center");
                            panel1.add(jpWEST,BorderLayout.WEST);
                            /*********CENTRE*********/
                            jpCENTRE = new JPanel();
                            jpCENTRE.setLayout(new GridLayout(2,1));
                            jpCentreTOP = new JPanel();
                            panel1.add(jpCENTRE,BorderLayout.CENTER);
                            jpCENTRE.add(jpCentreTOP);
                            jpCentreTOP.setLayout(new GridLayout(6,2));
                            jlblName = new JLabel( "Name:");
                            jlblBlank1 = new JLabel ("");
                            jtfName = new JTextField(18);
                            jlblBlank2 = new JLabel("");
                            jlblPhone = new JLabel("Phone:");
                            jlblCurrentSalary = new JLabel("Current Salary:");
                            jtfPhone = new JTextField(13);
                            jtfCurrentSalary = new JTextField(7);
                            jlblPassword = new JLabel("Password:");
                            jlblDesiredSalary = new JLabel("Desired Salary:");
                            jtfPassword = new JTextField(13);
                            jtfDesiredSalary = new JTextField(6);
                            jpCentreTOP.add(jlblName);
                            jpCentreTOP.add(jlblBlank1);
                            jpCentreTOP.add(jtfName);
                            jpCentreTOP.add(jlblBlank2);
                            jpCentreTOP.add(jlblPhone);
                            jpCentreTOP.add(jlblCurrentSalary);
                            jpCentreTOP.add(jtfPhone);
                            jpCentreTOP.add(jtfCurrentSalary);
                            jpCentreTOP.add(jlblPassword);
                            jpCentreTOP.add(jlblDesiredSalary);
                            jpCentreTOP.add(jtfPassword);
                            jpCentreTOP.add(jtfDesiredSalary);
                            //Noteslist
                            jpCentreBOT = new JPanel();
                            jpCentreBOT.setLayout( new BorderLayout());
                            jpCENTRE.add(jpCentreBOT);
                            jpBlank1 = new JPanel();
                               JTextArea Noteslist=new JTextArea();
                            JScrollPane scroll3=new JScrollPane(Noteslist);
                                scroll3.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);                                             
                                scroll3.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
                              //scroll3.setSize(new Dimension(1,1));
                            NotesListLabel = new Label( "Notes:");
                            jpCentreBOT.add(NotesListLabel,"North"); 
                            jpCentreBOT.add(scroll3,"Center");
                            jpCentreBOT.add(jpBlank1,"South");
                            panel1.add(jpCENTRE,BorderLayout.CENTER);
                            /**********EAST**********/
                            //Applicant Skills Panel
                            //EAST ==> TOP
                            jpEAST = new JPanel();
                            jpEAST.setLayout( new BorderLayout());
                            jpEastTOP = new JPanel();
                            jpEastTOP.setLayout( new BorderLayout());
                            listModel = new DefaultListModel();
                            ApplicantSkillsList = new JList(listModel);
                            ApplicantSkillsLabel = new Label( "Applicant Skills");
                           // JScrollPane scrollPane1 = new JScrollPane(ApplicantSkillsList,
                           //                                                   JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
                            JScrollPane scrollPane1 = new JScrollPane(ApplicantSkillsList);
                               scrollPane1.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);                                             
                              scrollPane1.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);                                             
                            ApplicantSkillsList.setVisibleRowCount(6);
                            jpEastTOP.add(ApplicantSkillsLabel,"North"); 
    //                        ApplicantSkillsList.addItemListener(new selectNameListener());
                            jpEastTOP.add(scrollPane1,"Center");
                            jpEAST.add(jpEastTOP,BorderLayout.NORTH);
                            panel1.add(jpEAST,BorderLayout.EAST);
                            //Add & Remove Buttons
                            //EAST ==> CENTRE
                            jpEastCENTRE = new JPanel();
                            jpEAST.add(jpEastCENTRE,BorderLayout.CENTER);
                            jbtnAdd2 = new JButton("Add");
                            jbtnRemove = new JButton("Remove");
                            //add buttons to panel
                            jpEastCENTRE.add(jbtnAdd2);
                            jpEastCENTRE.add(jbtnRemove);
                            //add listener to button
                           jbtnAdd2.addActionListener(new Add2Listener());
                           jbtnRemove.addActionListener(new RemoveListener());
                            //Industry Skills Panel
                            //EAST ==> BOTTOM
                            jpEastBOT = new JPanel();
                            jpEastBOT.setLayout( new BorderLayout());
                           String[] data = {"Access97", "Basic Programming",
                           "C++ Programming", "COBOL Programming",
                           "DB Design", "Fortran programming"};
                           IndustrySkillsList = new JList(data);
                           JScrollPane scrollPane = new JScrollPane(IndustrySkillsList);
                           scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);                                             
                           scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
                           IndustrySkillsLabel = new Label( "Industry Skills:");
                           jpEastBOT.add(IndustrySkillsLabel,"North"); 
                           jpEastBOT.add(scrollPane,"Center");
                           jpEAST.add(jpEastBOT,BorderLayout.SOUTH);
                            //BOTTOM
                            jpAddEditDelete= new JPanel();
                            jbtnAdd1=       new JButton("Add");
                            jbtnEdit=       new JButton("Edit");
                            jbtnDelete=     new JButton("Delete");
                            jbtnSave=       new JButton("Save");
                            jbtnCancel=     new JButton("Cancel");
                            jpAddEditDelete.add(jbtnAdd1);
                            jpAddEditDelete.add(jbtnEdit);
                            jpAddEditDelete.add(jbtnDelete);
                            jpAddEditDelete.add(jbtnSave);
                            jpAddEditDelete.add(jbtnCancel);
                           //jbtnEdit.addActionListener(new EditListener());
                            jbtnAdd1.addActionListener(new Add1Listener());
                            jbtnCancel.addActionListener(new CancelListener());
                            panel1.add(jpAddEditDelete,BorderLayout.SOUTH);
            public void createPage2()//PAGE 2
                    panel2 = new JPanel();
                    panel2.setLayout( new GridLayout(1,1) );
                    panel2.add( new JLabel( "Sorry,under construction" ) );
            public void createPage3()//PAGE 3
                    panel3 = new JPanel();
                    panel3.setLayout( new GridLayout( 1, 1 ) );
                    panel3.add( new JLabel( "Sorry,under construction" ) );
            public void createPage4()//PAGE 4
                    panel4 = new JPanel();
                    panel4.setLayout( new GridLayout( 1, 1 ) );
                    panel4.add( new JLabel( "Sorry,under construction" ) );
            public class Add1Listener implements ActionListener
            public void actionPerformed(ActionEvent e)
                    //String name,password,phone,currentsalary,desiredsalary,textareastuff;
                    name = jtfName.getText();
                    password = jtfPassword.getText();
                    phone = jtfPhone.getText();
                    currentsalary = jtfCurrentSalary.getText();
                    int i= Integer.parseInt(currentsalary);
                    desiredsalary = jtfDesiredSalary.getText();
                    int j= Integer.parseInt(desiredsalary);
                       StoringData person = new StoringData(name,password,phone,i,j);
                    //textareastuff = NotesList.getText();
                    details.add(person);
                  listModel2.addElement(name);
                    jtfName.setText("");
                    jtfPassword.setText("");
                    jtfPhone.setText("");
                    jtfCurrentSalary.setText("");
                    jtfDesiredSalary.setText("");
                  //  NotesList.setText("");
                    // NotesList.append("");          
                   // details.addElement(name);
            public class Add2Listener implements ActionListener
                    public void actionPerformed(ActionEvent e)
                           String temp1;
                           temp1 = (String)IndustrySkillsList.getSelectedValue();
                           listModel.addElement(temp1);
            public class RemoveListener implements ActionListener
                    public void actionPerformed(ActionEvent e)
                            int index = ApplicantSkillsList.getSelectedIndex();
                      listModel.remove(index);
            public class EditListener implements ActionListener
                    public void actionPerformed(ActionEvent e)
            public class DeleteListener implements ActionListener
                    public void actionPerformed(ActionEvent e)
            public class SaveListener implements ActionListener
                    public void actionPerformed(ActionEvent e)
            public class CancelListener implements ActionListener
                    public void actionPerformed(ActionEvent e)
                    jtfName.setText("");
                    jtfPassword.setText("");
                    jtfPhone.setText("");
                    jtfCurrentSalary.setText("");
                    jtfDesiredSalary.setText("");                         
            public class SharedListSelectionHandler implements ListSelectionListener
            public void valueChanged(ListSelectionEvent e)
               selectedname =ApplicantList.getSelectedValue().toString();
               // ListSelectionModel lsm = (ListSelectionModel)e.getSource();
                System.out.println(selectedname);
              // for(selectedname==n)
              //     System.out.println(ApplicantList.getSelectedValue().toString());
              //     jtfName.setText(n);
        //int firstIndex = e.getFirstIndex();
                //int lastIndex = e.getLastIndex();
                //boolean isAdjusting = e.getValueIsAdjusting();
                /*if (lsm.isSelectionEmpty())
                   System.out.println("hahahhaa");
                } else {
                    // Find out which indexes are selected.
                    /*int minIndex = lsm.getMinSelectionIndex();
                    int maxIndex = lsm.getMaxSelectionIndex();
                    /*for (int i = minIndex; i <= maxIndex; i++)
                       /* if (lsm.isSelectedIndex(i))
                           System.out.println("hohoho");
                System.out.println("haho");*/
    }

    ok i added that part inside my listselectionlistener
    it says incompatible types in line 421.
    and where do i insert :
    StoringData selectedPerson = detailMap.get(selectedName)
    and/or
    StoringData selectedPerson = ApplicantList.getSelectedValue()
    this is what the code looks like after i added the loop u gave me
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.event.*;
    import java.text.*;
    import java.util.*;
    import java.util.Vector;
    import javax.swing.JScrollPane.*;
    //import javax.swing.event.ListSelectionListener;
    public class Employment extends JFrame
            //declare class variables
            private JPanel jpApplicant, jpEverything,jpWEST, jpCENTRE, jpEAST, jpAddEditDelete,
                                       jpCentreTOP, jpCentreBOT, jpEastTOP, jpEastCENTRE, jpEastBOT,
                                       jpBlank1, panel1, panel2, panel3, panel4;
            private JLabel jlblApplicantForm, jlblAppList, jlblName, jlblPhone,
                                       jlblCurrentSalary, jlblPassword, jlblDesiredSalary,
                                       jlblNotes, jlblApplicantSkills, jlblIndustrySkills,
                                       jlblBlank1, jlblBlank2;
            private JButton jbtnAdd1, jbtnEdit, jbtnDelete, jbtnSave, jbtnCancel,
                                            jbtnAdd2, jbtnRemove;
            private JTextField jtfName, jtfPhone, jtfCurrentSalary, jtfPassword,
                                               jtfDesiredSalary;
               String name,password,phone,currentsalary,desiredsalary,textareastuff;
               String selectedname;
            private         JTabbedPane tabbedPane;
            private DefaultListModel listModel,listModel2;
           private ListSelectionModel listSelectionModel;
            JList ApplicantList, ApplicantSkillsList, IndustrySkillsList;
            protected JTextArea NotesList;    
            Label ApplicantListLabel, NotesListLabel, ApplicantSkillsLabel,
                                    IndustrySkillsLabel;                
                    Vector details = new Vector();
                public static void main(String []args)
                    Employment f = new Employment();
                    f.setVisible(true);
                    f.setDefaultCloseOperation(EXIT_ON_CLOSE);
                    f.setResizable(false);
                }//end of main
                    public Employment()
                            setSize(800,475);
                            setTitle("E-commerce Placement Agency");
                            JPanel topPanel = new JPanel();
                            topPanel.setLayout( new BorderLayout() );
                            getContentPane().add( topPanel );
                            createPage1();
                            createPage2();
                            createPage3();
                            createPage4();
                            tabbedPane = new JTabbedPane();
                            tabbedPane.addTab( "Applicant", panel1 );
                            tabbedPane.addTab( "Job Order", panel2 );
                            tabbedPane.addTab( "Skill", panel3 );
                            tabbedPane.addTab( "Company", panel4 );
                            topPanel.add( tabbedPane, BorderLayout.CENTER );
            public void createPage1()//PAGE 1
                                    panel1 = new JPanel();
                                    panel1.setLayout( new BorderLayout());
                                    jpApplicant= new JPanel();
                            jpApplicant.setLayout(new BorderLayout());
                            Font bigFont = new Font("TimesRoman", Font.BOLD,24);
                            jlblApplicantForm = new JLabel("\t\t\t\tAPPLICANT FORM  ");
                            jlblApplicantForm.setFont(bigFont);
                            jpApplicant.add(jlblApplicantForm,BorderLayout.EAST);
                            panel1.add(jpApplicant,BorderLayout.NORTH);
           /*****************************************WEST*********************************/             
                            jpWEST = new JPanel();                 
                            jpWEST.setLayout( new BorderLayout());
                            //Applicant List
                                  listModel2=new DefaultListModel();
                                  ApplicantList = new JList(listModel2);
                                listSelectionModel = ApplicantList.getSelectionModel();
                                listSelectionModel.addListSelectionListener(new SharedListSelectionHandler());
                                JScrollPane scrollPane3 = new JScrollPane(ApplicantList);
                            ApplicantListLabel = new Label( "Applicant List:");
                            jpWEST.add(ApplicantListLabel,"North"); 
                            jpWEST.add(scrollPane3,"Center");
                            panel1.add(jpWEST,BorderLayout.WEST);
                            /*********CENTRE*********/
                            jpCENTRE = new JPanel();
                            jpCENTRE.setLayout(new GridLayout(2,1));
                            jpCentreTOP = new JPanel();
                            panel1.add(jpCENTRE,BorderLayout.CENTER);
                            jpCENTRE.add(jpCentreTOP);
                            jpCentreTOP.setLayout(new GridLayout(6,2));
                            jlblName = new JLabel( "Name:");
                            jlblBlank1 = new JLabel ("");
                            jtfName = new JTextField(18);
                            jlblBlank2 = new JLabel("");
                            jlblPhone = new JLabel("Phone:");
                            jlblCurrentSalary = new JLabel("Current Salary:");
                            jtfPhone = new JTextField(13);
                            jtfCurrentSalary = new JTextField(7);
                            jlblPassword = new JLabel("Password:");
                            jlblDesiredSalary = new JLabel("Desired Salary:");
                            jtfPassword = new JTextField(13);
                            jtfDesiredSalary = new JTextField(6);
                            jpCentreTOP.add(jlblName);
                            jpCentreTOP.add(jlblBlank1);
                            jpCentreTOP.add(jtfName);
                            jpCentreTOP.add(jlblBlank2);
                            jpCentreTOP.add(jlblPhone);
                            jpCentreTOP.add(jlblCurrentSalary);
                            jpCentreTOP.add(jtfPhone);
                            jpCentreTOP.add(jtfCurrentSalary);
                            jpCentreTOP.add(jlblPassword);
                            jpCentreTOP.add(jlblDesiredSalary);
                            jpCentreTOP.add(jtfPassword);
                            jpCentreTOP.add(jtfDesiredSalary);
                            //Noteslist
                            jpCentreBOT = new JPanel();
                            jpCentreBOT.setLayout( new BorderLayout());
                            jpCENTRE.add(jpCentreBOT);
                            jpBlank1 = new JPanel();
                               JTextArea Noteslist=new JTextArea();
                            JScrollPane scroll3=new JScrollPane(Noteslist);
                                scroll3.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);                                             
                                scroll3.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
                              //scroll3.setSize(new Dimension(1,1));
                            NotesListLabel = new Label( "Notes:");
                            jpCentreBOT.add(NotesListLabel,"North"); 
                            jpCentreBOT.add(scroll3,"Center");
                            jpCentreBOT.add(jpBlank1,"South");
                            panel1.add(jpCENTRE,BorderLayout.CENTER);
                            /**********EAST**********/
                            //Applicant Skills Panel
                            //EAST ==> TOP
                            jpEAST = new JPanel();
                            jpEAST.setLayout( new BorderLayout());
                            jpEastTOP = new JPanel();
                            jpEastTOP.setLayout( new BorderLayout());
                            listModel = new DefaultListModel();
                            ApplicantSkillsList = new JList(listModel);
                            ApplicantSkillsLabel = new Label( "Applicant Skills");
                           // JScrollPane scrollPane1 = new JScrollPane(ApplicantSkillsList,
                           //                                                   JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
                            JScrollPane scrollPane1 = new JScrollPane(ApplicantSkillsList);
                               scrollPane1.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);                                             
                              scrollPane1.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);                                             
                            ApplicantSkillsList.setVisibleRowCount(6);
                            jpEastTOP.add(ApplicantSkillsLabel,"North"); 
    //                        ApplicantSkillsList.addItemListener(new selectNameListener());
                            jpEastTOP.add(scrollPane1,"Center");
                            jpEAST.add(jpEastTOP,BorderLayout.NORTH);
                            panel1.add(jpEAST,BorderLayout.EAST);
                            //Add & Remove Buttons
                            //EAST ==> CENTRE
                            jpEastCENTRE = new JPanel();
                            jpEAST.add(jpEastCENTRE,BorderLayout.CENTER);
                            jbtnAdd2 = new JButton("Add");
                            jbtnRemove = new JButton("Remove");
                            //add buttons to panel
                            jpEastCENTRE.add(jbtnAdd2);
                            jpEastCENTRE.add(jbtnRemove);
                            //add listener to button
                           jbtnAdd2.addActionListener(new Add2Listener());
                           jbtnRemove.addActionListener(new RemoveListener());
                            //Industry Skills Panel
                            //EAST ==> BOTTOM
                            jpEastBOT = new JPanel();
                            jpEastBOT.setLayout( new BorderLayout());
                           String[] data = {"Access97", "Basic Programming",
                           "C++ Programming", "COBOL Programming",
                           "DB Design", "Fortran programming"};
                           IndustrySkillsList = new JList(data);
                           JScrollPane scrollPane = new JScrollPane(IndustrySkillsList);
                           scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);                                             
                           scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
                           IndustrySkillsLabel = new Label( "Industry Skills:");
                           jpEastBOT.add(IndustrySkillsLabel,"North"); 
                           jpEastBOT.add(scrollPane,"Center");
                           jpEAST.add(jpEastBOT,BorderLayout.SOUTH);
                            //BOTTOM
                            jpAddEditDelete= new JPanel();
                            jbtnAdd1=       new JButton("Add");
                            jbtnEdit=       new JButton("Edit");
                            jbtnDelete=     new JButton("Delete");
                            jbtnSave=       new JButton("Save");
                            jbtnCancel=     new JButton("Cancel");
                            jpAddEditDelete.add(jbtnAdd1);
                            jpAddEditDelete.add(jbtnEdit);
                            jpAddEditDelete.add(jbtnDelete);
                            jpAddEditDelete.add(jbtnSave);
                            jpAddEditDelete.add(jbtnCancel);
                           //jbtnEdit.addActionListener(new EditListener());
                            jbtnAdd1.addActionListener(new Add1Listener());
                            jbtnCancel.addActionListener(new CancelListener());
                            panel1.add(jpAddEditDelete,BorderLayout.SOUTH);
            public void createPage2()//PAGE 2
                    panel2 = new JPanel();
                    panel2.setLayout( new GridLayout(1,1) );
                    panel2.add( new JLabel( "Sorry,under construction" ) );
            public void createPage3()//PAGE 3
                    panel3 = new JPanel();
                    panel3.setLayout( new GridLayout( 1, 1 ) );
                    panel3.add( new JLabel( "Sorry,under construction" ) );
            public void createPage4()//PAGE 4
                    panel4 = new JPanel();
                    panel4.setLayout( new GridLayout( 1, 1 ) );
                    panel4.add( new JLabel( "Sorry,under construction" ) );
            public class Add1Listener implements ActionListener
            public void actionPerformed(ActionEvent e)
                    //String name,password,phone,currentsalary,desiredsalary,textareastuff;
                    name = jtfName.getText();
                    password = jtfPassword.getText();
                    phone = jtfPhone.getText();
                    currentsalary = jtfCurrentSalary.getText();
                    int i= Integer.parseInt(currentsalary);
                    desiredsalary = jtfDesiredSalary.getText();
                    int j= Integer.parseInt(desiredsalary);
                       StoringData person = new StoringData(name,password,phone,i,j);
                    //textareastuff = NotesList.getText();
                    details.add(person);
                  listModel2.addElement(name);
                    jtfName.setText("");
                    jtfPassword.setText("");
                    jtfPhone.setText("");
                    jtfCurrentSalary.setText("");
                    jtfDesiredSalary.setText("");
                  //  NotesList.setText("");
                    // NotesList.append("");          
                   // details.addElement(name);
            public class Add2Listener implements ActionListener
                    public void actionPerformed(ActionEvent e)
                           String temp1;
                           temp1 = (String)IndustrySkillsList.getSelectedValue();
                           listModel.addElement(temp1);
            public class RemoveListener implements ActionListener
                    public void actionPerformed(ActionEvent e)
                            int index = ApplicantSkillsList.getSelectedIndex();
                      listModel.remove(index);
            public class EditListener implements ActionListener
                    public void actionPerformed(ActionEvent e)
            public class DeleteListener implements ActionListener
                    public void actionPerformed(ActionEvent e)
            public class SaveListener implements ActionListener
                    public void actionPerformed(ActionEvent e)
            public class CancelListener implements ActionListener
                    public void actionPerformed(ActionEvent e)
                    jtfName.setText("");
                    jtfPassword.setText("");
                    jtfPhone.setText("");
                    jtfCurrentSalary.setText("");
                    jtfDesiredSalary.setText("");                         
            public class SharedListSelectionHandler implements ListSelectionListener
            public void valueChanged(ListSelectionEvent e)
             selectedname =ApplicantList.getSelectedValue().toString();
             StoringData selectedPerson = null;
              for (StoringData person : details)
                if (person.getName1().equals(selectedname))
                       selectedPerson = person;
                       break;
         if (selectedPerson != null)
      // set the relevant fields
               // ListSelectionModel lsm = (ListSelectionModel)e.getSource();
              //  System.out.println(selectedname);
              // for(selectedname==n)
              //     System.out.println(ApplicantList.getSelectedValue().toString());
              //     jtfName.setText(n);
        //int firstIndex = e.getFirstIndex();
                //int lastIndex = e.getLastIndex();
                //boolean isAdjusting = e.getValueIsAdjusting();
                /*if (lsm.isSelectionEmpty())
                   System.out.println("hahahhaa");
                } else {
                    // Find out which indexes are selected.
                    /*int minIndex = lsm.getMinSelectionIndex();
                    int maxIndex = lsm.getMaxSelectionIndex();
                    /*for (int i = minIndex; i <= maxIndex; i++)
                       /* if (lsm.isSelectedIndex(i))
                           System.out.println("hohoho");
                System.out.println("haho");*/
    }

Maybe you are looking for

  • "You are not connected to the internet" message

    Until this morning, Safari worked pretty much ok. Now, when I launch it, I get the "you are not connected to the internet" page. Firefox and email work fine and network diagnostics verifies a proper connection. I can't even get to "software update."

  • Product description is missing in CRM after change of material hierarchy

    hello everybody We have R/3 4.6c and CRM 4.0 We change material hierarchy in R/3, a Bdoc is created and the product hierarchy is changed but the product description is empty after the change. any ideas what might be the problem? thanks in abvance

  • Very Basic Slideshow question

    I have a question about creating a slideshow -- in the Help File, it says to Save as a file, and then says that if I want the show to automatically replay, select Loop.  Where do I select loop???  When I hit Save as a File, it asks for name of file,

  • Httpd: error while loading shared libraries: libdl.so.2: cannot open shared

    Hi: I have this problem when i am trying to exec ./opmnctl sartall the web center x86 101320 in my UbuntuServer LTS May you help me? Thanks

  • Starting Servers with Ant

    Hi, I am using WLS 8.1 SP2 and the Ant that comes with it to start my managed server. However, as documented the server VM shuts when the Ant script finishes. I have tried adding fork="true" to my <wlserver> task but this still does not work. I have