How to get the columns from SYS.ALL_COLUMNS and use it in COALESCE() Function.

Hi,
I have table called Employe. And the Columns are Emp_ID,EMP_NAME,SRC_SYS_CD,DOB
I have Query like
Select
COALESCE(MAX(CASE WHEN src_sys_cd='1' THEN Emp_id END), MAX(CASE WHEN src_sys_cd='2' THEN Emp_Id END))Emp_Id,
COALESCE(MAX(CASE WHEN src_sys_cd='1' THEN Emp_name END), MAX(CASE WHEN src_sys_cd='2' THEN Emp_Name END))Emp_name,
COALESCE(MAX(CASE WHEN src_sys_cd='1' THEN dob END), MAX(CASE WHEN src_sys_cd='2' THEN dob END))dob ,
from Employe
group by dob.
I want to generalize the query like get the columns from SYS.ALL_COLUMNS table for that table name and want to pass it to COALEACE() function. I tried with Cursor. But i didnt get the appropriate results.
Is there any way to achieve this? Please help me out in this regard.
Thanks,

Is this the kinda thing you're after?
Add a filter to the queries to get just a single table/
WITH allCols AS (
SELECT s.name as sName, o.name AS oName, c.name AS cName, column_id,
CASE WHEN st.name in ('float','bigint','tinyint','int','smallint','bit','datetime','money','date','datetime2','uniqueidentifier','sysname','geography','geometry') THEN st.name
WHEN st.name in ('numeric','real') THEN st.name + '('+CAST(c.scale AS VARCHAR)+','+CAST(c.precision AS VARCHAR)+')'
WHEN st.name in ('varbinary','varchar','binary','char','nchar','nvarchar') THEN st.name + '(' + CAST(ABS(c.max_length) AS VARCHAR) + ')'
ELSE st.name + ' unknown '
END + ' '+
CASE WHEN c.is_identity = 1 THEN 'IDENTITY ' ELSE '' END +
CASE WHEN c.is_nullable = 0 THEN 'NOT ' ELSE '' END + 'NULL' AS bText,
f.name AS fileGroupName
FROM sys.columns c
INNER JOIN sys.objects o
ON c.object_id = o.object_id
AND o.type = 'U'
INNER JOIN sys.systypes st
ON c.user_type_id = st.xusertype
INNER JOIN sys.schemas s
ON o.schema_id = s.schema_id
INNER JOIN sys.indexes i
ON o.object_id = i.object_id
AND i.index_id = (SELECT MIN(index_id) FROM sys.indexes WHERE object_ID = o.object_id)
INNER JOIN sys.filegroups f
ON i.data_space_id = f.data_space_id
), rCTE AS (
SELECT sName, oName, cName, column_id, CAST(cName + ' ' + bText AS VARCHAR(MAX)) as bText, CAST(cName AS VARCHAR(MAX)) AS colList, fileGroupName
FROM allCols
WHERE column_id = 1
UNION ALL
SELECT r.sName, r.oName, r.cName, c.column_id, CAST(r.bText +', ' + c.cName + ' ' +c.bText AS VARCHAR(MAX)), CAST(r.colList+ ', ' +c.cName AS VARCHAR(MAX)), c.fileGroupName
FROM allCols c
INNER JOIN rCTE r
ON c.oName = r.oName
AND c.column_id - 1 = r.column_id
), allIndx AS (
SELECT 'CREATE '+CASE WHEN is_unique = 1 THEN ' UNIQUE ' ELSE '' END+i.type_desc+' INDEX ['+i.name+'] ON ['+CAST(s.name COLLATE DATABASE_DEFAULT AS NVARCHAR )+'].['+o.name+'] (' as prefix,
CASE WHEN is_included_column = 0 THEN '['+c.name+'] '+CASE WHEN ic.is_descending_key = 1 THEN 'DESC' ELSE 'ASC' END END As cols,
CASE WHEN is_included_column = 1 THEN '['+c.name+']'END As incCols,
') WITH ('+
CASE WHEN is_padded = 0 THEN 'PAD_INDEX = OFF,' ELSE 'PAD_INDEX = ON,' END+
CASE WHEN ignore_dup_key = 0 THEN 'IGNORE_DUP_KEY = OFF,' ELSE 'IGNORE_DUP_KEY = ON,' END+
CASE WHEN allow_row_locks = 0 THEN 'ALLOW_ROW_LOCKS = OFF,' ELSE 'ALLOW_ROW_LOCKS = ON,' END+
CASE WHEN allow_page_locks = 0 THEN 'ALLOW_PAGE_LOCKS = OFF' ELSE 'ALLOW_PAGE_LOCKS = ON' END+
')' as suffix, index_column_id, key_ordinal, f.name as fileGroupName
FROM sys.indexes i
LEFT OUTER JOIN sys.index_columns ic
ON i.object_id = ic.object_id
AND i.index_id = ic.index_id
LEFT OUTER JOIN sys.columns c
ON ic.object_id = c.object_id
AND ic.column_id = c.column_id
INNER JOIN sys.objects o
ON i.object_id = o.object_id
AND o.type = 'U'
AND i.type <> 0
INNER JOIN sys.schemas s
ON o.schema_id = s.schema_id
INNER JOIN sys.filegroups f
ON i.data_space_id = f.data_space_id
), idxrCTE AS (
SELECT r.prefix, CAST(r.cols AS NVARCHAR(MAX)) AS cols, CAST(r.incCols AS NVARCHAR(MAX)) AS incCols, r.suffix, r.index_column_id, r.key_ordinal, fileGroupName
FROM allIndx r
WHERE index_column_id = 1
UNION ALL
SELECT o.prefix, COALESCE(r.cols,'') + COALESCE(', '+o.cols,''), COALESCE(r.incCols+', ','') + o.incCols, o.suffix, o.index_column_id, o.key_ordinal, o.fileGroupName
FROM allIndx o
INNER JOIN idxrCTE r
ON o.prefix = r.prefix
AND o.index_column_id - 1 = r.index_column_id
SELECT 'CREATE TABLE ['+sName+'].[' + oName + '] ('+bText+') ON [' + fileGroupName +']'
FROM rCTE r
WHERE column_id = (SELECT MAX(column_id) FROM rCTE WHERE r.oName = oName)
UNION ALL
SELECT prefix + cols + CASE WHEN incCols IS NOT NULL THEN ') INCLUDE ('+incCols ELSE '' END + suffix+' ON [' + fileGroupName +']'
FROM idxrCTE x
WHERE index_column_id = (SELECT MAX(index_column_id) FROM idxrCTE WHERE x.prefix = prefix)

Similar Messages

  • How to get the values from struct data type using java code..?

    Hi ,
    I am newer to java.
    we are using oracle database.
    How to get the data from struct data type using java code.
    Thanks in Advance.
    Regards,
    kumar

    Hi Rajeev,
    To retrieve a FilterContainer you will need to traverse the report structure:
    ReportStructure boReportStructure = boDocumentInstance.getStructure();
    ReportContainer boReportContainer = (ReportContainer) boReportStructure.getReportElement(0);
    FilterContainer boFilterContainer = null;
    if (boReportContainer.hasFilter()) {
         boFilterContainer = boReportContainer.getFilter();
    } else {
         boFilterContainer = boReportContainer.createFilter(LogicalOperator.AND);
    Calling boDocumentInstance.getStructure() will retrieve the entire structure for the document.
    Calling boReportStructure.getReportElement(0) will retrieve the structure for the first report of the document.
    Hope this helps.
    Regards,
    Dan

  • I have an old iPod Classic with 80 GB (I think) of space. I saved all my songs in an external hard drive, but the iTunes library resided in an old computer (no longer working). Can I get the libray from my iPod and use it in my new computer (Windows)?

    I have an old iPod Classic with 80 GB (I think) of space. I saved all my songs in an external hard drive, but the iTunes library resided in an old computer (no longer working). Can I get the library from my iPod and use it in my new computer (Windows)?

    You might want to check your process for moving your iTunes music against this: http://support.apple.com/kb/HT4527.

  • How to get the value from a JavaScript and send the same to Java file?

    Hi.
    How to get the value from a JavaScript (this JS is called when an action invoked) and send the value from the JS to a Java file?
    Thanks and regards,
    Leslie V

    Yes, I am trying with web application.
    In the below code, a variable 'message' carries the needed info. I would like to send this 'message' variable with the 'request'.
    How to send this 'message' with and to the 'request'?
    Thanks for the help :-)
    The actual JS code is:
    function productdeselection()
    var i=0;
    var j=0;
    var deselectedproduct = new Array(5);
    var message = "Are you sure to delete Product ";
    mvi=document.forms[0].MVI;
    mei=document.forms[0].MEI;
    lpi=document.forms[0].LPI;
    if(null != mvi)
    ++i;
    if(null != mei )
    ++i;
    if(null != lpi)
    ++i;
    if(null != mvi && mvi.checked)
    deselectedproduct[++j]="MVI?";
    if(null != mei && mei.checked)
    deselectedproduct[++j]="GAP?";
    if(null != lpi && lpi.checked)
    deselectedproduct[++j]="LPI?";
    if( 0!=j)
    if(i!=j)
    for (x=0; x<deselectedproduct.length; x++)
    if(null != deselectedproduct[x])
    message =message+ "-" +deselectedproduct[x];
    alert(message);
    else
    //alert(" You cannot remove all products!");
    return false;
    return true;
    }

  • How to get the values from table region and how to set

    Hi,
    I have a requirement as Seeded Page Having One Table Region having around 8 columns, In That Item Description field is there. My Requirement is I need add one more field for that Region and assign the value depending Item Description.
    I will create one new Item in that region and will give name as Item, But how to set the values to Item Depending on Item Description.
    Is it possible to through CO Extension, If yes..Pls help how to get it.
    Thanks in Advance,
    Hanimi

    Hi Hanimi,
    1. You need to extend the VO, add a new Attribute.
    2. In VORowImpl of the extended VO, you can find the getter for your new attribute (example getItem())
    3. In this getter method you can write some code like:
    if("ABC".equals(getItemDescription())
    return "XYZ" ;
    -Prince
    http://princekapoor82.blogspot.com

  • How to get the cookie from a web service using Axis

    I used the AXIS wizard to consume a WSDL and create a bunch of boiler plate code. It works great in that I can talk to the web service and submit requests.
    The problem is that I need to retrieve the cookie from the login request and use it when making subsequent requests. I have been unable to find the cookie and would appreciate a point in the right direction.
    Currently I'm trying something like this
    String cookie = (String)((Stub)service)._getCall().getMessageContext().getProperty(HTTPConstants.HEADER_COOKIE);
    Thanks in advance.

    Answered on my own:
    Just have to use
    x_result = http_client->response->get_data( ).
    instead of
    x_result = http_client->response->to_xstring( ).
    Just don't knwo why the filesize is wrong also - but I can work with this image!

  • How to get the value from a label and store it in an sql database?

    I have tried all kinds of different ways and I always get the error that it is not a member of string or whatever data type I try.
    Try
    scoringlbl.Text.Validate()
    scoreinglbl.Text.HighScoresBindingSource.EndEdit()
    scoringlbl.Text.HighScoresTableAdapter.Update(Me.ScoresDataSet.HighScores)
    MsgBox("Update successful")
    Catch ex As Exception
    MsgBox("Update failed")
    End Try

    I know nothing about data binding, but maybe this works, or at least point you in the right direction:
    Try
    scoringlbl.Validate()
    HighScoresBindingSource.EndEdit()
    HighScoresTableAdapter.Update(ScoresDataSet.HighScores)
    MsgBox("Update successful")
    Catch ex As Exception
    MsgBox("Update failed")
    End Try
    Armin

  • How to get the data from one table and insert into another table

    Hi,
    We have requirement to build OA page with the data needs to be populated from one table and on save data into another table.
    For the above requirement what the best way to implement in OAF.
    I understand that if we attach VO object instance to region/page, we only can pull and put data in to only one table.
    Thanks

    You can achieve this in many different ways, one is
    1. Create another VO based on the EO which is based on the dest table.
    2. At save, copy the contents of the source VO into the dest VO (see copy routine in dev guide).
    3. commiting the transaction will push the data into the dest table on which the dest VO is based.
    I understand that if we attach VO object instance to region/page, we only can pull and put data in to only one table.
    if by table you mean a DB table, then no, you can have a VO based on multiple EOs which will do DMLs accordingly.Thanks
    Tapash

  • How to get the data from a file and insert into a table

    Good morning,
    NEED TO READ THIS FILE sui_facturacion_alcantarillado_15085_2011_01_76845_00A.csv containing the following information
    NUID,NUMERO_DE_CUENTA_CONTRATO,CÓDIGO_DANE_DEPARTAMENTO,CÓDIGO_DANE_MUNICIPIO,ZONA_IGAC,SECTOR_IGAC,MANZANA_O_VEREDA_IGAC,NÚMERO_DEL_PREDIO_IGAC,CONDICION_DE_PROPIEDAD_DEL_PREDIO_IGAC,DIRECCIÓN_DEL_PREDIO,NÚMERO_DE_FACTURA,FECHA_DE_EXPEDICIÓN_DE_LA_FACTURA,FECHA_DE_INICIO_DEL_PERÍODO_DE_FACTURACIÓN,DIAS_FACTURADOS,CÓDIGO_CLASE_DE_USO,UNIDADES_MULTIUSUARIO_RESIDENCIAL,UNIDADES_MULTIUSUARIO_NO_RESIDENCIAL,HOGAR_COMUNITARIO_O_SUSTITUTO,USUARIO_FACTURADO_CON_AFORO,USUARIO_CUENTA_CON_CARACTERIZACIÓN,CARGO_FIJO,CARGO_POR_VERTIMIENTO_BASICO,CARGO_POR_VERTIMIENTO_COMPLEMENTARIO,CARGO_POR_VERTIMIENTOSUNTUARIO,CMT,VERTIMIENTO_DEL_PERIOD_EN_METROS_CUBICOS,VALOR_FACTURADO_POR_VERTIDO,VALOR_DEL_SUBSIDIO,VALOR_DE_LA_CONTRIBUCIÓN,FACTOR_DE_SUBSIDIO_O_CONTRIBUCIÓN_CARGO_FIJO,FACTOR_DE_SUBSIDIO_O_CONTRIBUCIÓN_VERTIMIENTO,CARGOS_POR_CONEXIÓN,PAGO_ANTICIPADO_DEL_SERVICIO,DÍAS_DE_MORA,VALOR_DE_MORA,INTERESES_POR_MORA,OTROS_COBROS,CAUSAL_DE_REFACTURACIÓN,NUMERO_DE_LA_FACTURA_OBJETO_DE_REFACTURACIÓN,VALOR_TOTAL_FACTURADO,PAGOS_DEL_CLIENTE_DURANTE_EL_PERÍODO_FACTURADO
    242602,242602,76,845,99,99,9999,9999,999,CLL 5 CRA 7 PEATONAL,24911920,12-01-2011,01-12-2010,30,01,,,0,0,0,1,0000000000.00,0000000000.00,0000000000.00,0000000000.00,0000000005,0000002200.00,0000000000,0000000000,0.000,0.000,0000000000.00,0000000000.00,0,0000000000.00,0000000000.00,0000000000.00,0,0,0000002201.00,0000000000.00
    242604,242604,76,845,99,99,9999,9999,999,CRA 4 # 6 - 13,24911846,12-01-2011,01-12-2010,30,01,,,0,0,0,1,0000000000.00,0000000000.00,0000000000.00,0000000000.00,0000000013,0000002200.00,0000000000,0000000000,0.000,0.000,0000000000.00,0000000000.00,0,0000000000.00,0000000000.00,0000000000.00,0,0,0000002201.00,0000004411.00
    242605,242605,76,845,99,99,9999,9999,999,CRA 2 CLLES 3 Y 4,24911509,12-01-2011,01-12-2010,30,01,,,0,0,0,1,0000000000.00,0000000000.00,0000000000.00,0000000000.00,0000000004,0000002200.00,0000000000,0000000000,0.000,0.000,0000000000.00,0000000000.00,0,0000000000.00,0000000000.00,0000000000.00,0,0,0000002201.00,0000002200.00
    this is the function that I have
    <<function_test>>
    DECLARE
    TOTAL_CAR NUMBER;
    POS_1 NUMBER:= 0;
    POS_2 NUMBER:= 0;
    REST NUMBER:= 0;
    ACUM NUMBER:= 0;
    CADEN VARCHAR2(200);
    nom_archivo varchar2(80);
    v1 utl_file.file_type;
    v2 varchar2(2048);
    BEGIN
         nom_archivo := 'sui_facturacion_alcantarillado_15085_2011_01_76845_00A.csv';
         v1:= utl_file.fopen('PUBLIC_ACCESS',nom_archivo,'R',32767);
         utl_file.get_line(v1,v2);
         SELECT LENGTH(v2) INTO TOTAL_CAR FROM DUAL;
         ACUM:=1;
         POS_1:=0;
         WHILE ACUM <= 60
         LOOP
              select instr(v2, ',', 1, ACUM) PRUEBA
              INTO      POS_2
              FROM      DUAL;
              dbms_output.put_line(' TOTAL POSICION 1--> '|| POS_1);
              dbms_output.put_line(' TOTAL POSICION 2--> '|| POS_2);
              dbms_output.put_line(' TOTAL ACUMULADO --> '|| ACUM);
              REST := (POS_2-POS_1)-1;
              SELECT SUBSTR(v2,(POS_1+1),REST) PRUEBA2
                   INTO CADEN
              FROM      DUAL;     
              dbms_output.put_line(' CADENA SELECCIONADA --> '|| CADEN);
              ACUM := ACUM + 1;
              POS_1:= POS_2;
         END LOOP;
         utl_file.fclose(v1);
         dbms_output.put_line(' -->');
         dbms_output.put_line(' TOTAL POSICION 1-->'|| POS_1);
         dbms_output.put_line(' TOTAL POSICION 2-->'|| POS_2);
         dbms_output.put_line(' TOTAL ACUMULADO -->'|| ACUM);
         dbms_output.put_line(' TOTAL DE CARACTERES -->'|| TOTAL_CAR);
         dbms_output.put_line(' ');     
         EXCEPTION
              WHEN NO_DATA_FOUND THEN
                   dbms_output.put_line('NO SE ENCONTRARON MAS CARACTERES');
              WHEN OTHERS THEN
                   dbms_output.put_line('OTRO TIPO DE ERROR ');
                   dbms_output.put_line('CODIGO ERROR '|| SQLCODE ||' '||SQLERRM);
    END;
    Which must be separated by a comma and enter a table I have the following procedure in which only brings me the first line, which need not
    The current role I have just read and extract data from the row number 1, I do not need information.
    I need information for rows 2,3,4. In each row there are 41 fields, which I enter in a table called Dato_archivos.
    how to perform this function? ...
    I appreciate the cooperation and explanation ...
    GOOD DAY ...
    REYNEL SALAZAR MARTINEZ
    COLOMBIA ...

    When you get an error with external tables (or sql*loader) look in the same folder as the data file and you should get a .log file and maybe a .bad file too.
    The log file should indicate the nature of the error it has trying to load the data.
    I've just copied your sample data from your first post to a file on my server and tried it to find that you are not specifying the required format for your dates. The below shows it now working...
    CREATE TABLE tabla_prueba
      (NUID NUMBER,
       NUM_CUENTA_CONTRATO NUMBER,
       COD_DANE_DD NUMBER,
       COD_DANE_MM NUMBER,
       ZONA_IGAC NUMBER,
       SECTOR_IGAC NUMBER,
       MANZANA_VEREDA_IGAC NUMBER,
       NUM_PREDIO_IGAC NUMBER,
       CONDICION_PREDIO_IGAC NUMBER,
       DIRECCION_PREDIO_IGAC VARCHAR2(80),
       NUM_FACTURA NUMBER,
       FECHA_EXPED_FACTURA DATE,
       FECHA_INI_PERIODO_FACTURACION DATE,
       DIAS_FACTURADOS NUMBER,
       COD_CLASE_USO NUMBER,
       UNI_MULTIUSUARIO_RESIDENCIAL NUMBER,
       UNI_MULTIUSUARIO_NORESIDENCIAL NUMBER,
       HOGAR_COMUNITARIO NUMBER,
       USUARIO_FACTURADO_AFORO NUMBER,
       USUARIO_CON_CARACTERIZACION NUMBER,
       CARGO_FIJO NUMBER,
       CARGO_VERTIMENTO_BAS NUMBER,
       CARGO_VERTIMENTO_COMP NUMBER,
       CARGO_VERTIMENTO_SUNT NUMBER,
       CMT NUMBER,
       VLR_FACTURADO_VERTIDO NUMBER,
       VLR_SUBSIDIO NUMBER,
       VLR_CONTRIBUCCION NUMBER,
       FACTOR_SUBS_CONTR_CARGO_FIJO NUMBER,
       FACTOR_SUBS_CONTR_VERTIMENTO NUMBER,
       CARGO_CONEXION NUMBER,
       PAGO_ANTICIPADO_SERVICIO NUMBER,
       DIAS_MORA NUMBER,
       VLR_MORA NUMBER,
       INTERES_MORA NUMBER,
       OTROS_COBROS NUMBER,
       CAUSAL_REFACTURACION NUMBER,
       NUM_FACTURA_OBJ_REFACTURACION NUMBER,
       VLR_TOTAL_FACTURADO NUMBER,
       PAGOS_CLIENTE_DURANTE_PERIODO NUMBER
    ORGANIZATION EXTERNAL
      (TYPE ORACLE_LOADER
       DEFAULT DIRECTORY TEST_DIR
       ACCESS PARAMETERS
        (RECORDS DELIMITED BY NEWLINE
         SKIP 1
         FIELDS TERMINATED BY ","
         OPTIONALLY ENCLOSED BY '"'
          (NUID,
           NUM_CUENTA_CONTRATO,
           COD_DANE_DD,
           COD_DANE_MM,
           ZONA_IGAC,
           SECTOR_IGAC,
           MANZANA_VEREDA_IGAC,
           NUM_PREDIO_IGAC,
           CONDICION_PREDIO_IGAC,
           DIRECCION_PREDIO_IGAC,
           NUM_FACTURA,
           FECHA_EXPED_FACTURA CHAR DATE_FORMAT DATE MASK "DD-MM-YYYY",
           FECHA_INI_PERIODO_FACTURACION CHAR DATE_FORMAT DATE MASK "DD-MM-YYYY",
           DIAS_FACTURADOS,
           COD_CLASE_USO,
           UNI_MULTIUSUARIO_RESIDENCIAL ,
           UNI_MULTIUSUARIO_NORESIDENCIAL,
           HOGAR_COMUNITARIO ,
           USUARIO_FACTURADO_AFORO ,
           USUARIO_CON_CARACTERIZACION ,
           CARGO_FIJO ,
           CARGO_VERTIMENTO_BAS ,
           CARGO_VERTIMENTO_COMP,
           CARGO_VERTIMENTO_SUNT,
           CMT,
           VLR_FACTURADO_VERTIDO,
           VLR_SUBSIDIO ,
           VLR_CONTRIBUCCION ,
           FACTOR_SUBS_CONTR_CARGO_FIJO ,
           FACTOR_SUBS_CONTR_VERTIMENTO ,
           CARGO_CONEXION ,
           PAGO_ANTICIPADO_SERVICIO ,
           DIAS_MORA ,
           VLR_MORA ,
           INTERES_MORA ,
           OTROS_COBROS ,
           CAUSAL_REFACTURACION ,
           NUM_FACTURA_OBJ_REFACTURACION,
           VLR_TOTAL_FACTURADO,
           PAGOS_CLIENTE_DURANTE_PERIODO
        LOCATION ('test.csv')
    SQL> select * from tabla_prueba;
          NUID NUM_CUENTA_CONTRATO COD_DANE_DD COD_DANE_MM  ZONA_IGAC SECTOR_IGAC MANZANA_VEREDA_IGAC NUM_PREDIO_IGAC CONDICION_PREDIO_IGAC DIRECCION_PREDIO_IGAC                                                    NUM_FACTURA FECHA_EXPE FECHA_INI_
    DIAS_FACTURADOS COD_CLASE_USO UNI_MULTIUSUARIO_RESIDENCIAL UNI_MULTIUSUARIO_NORESIDENCIAL HOGAR_COMUNITARIO USUARIO_FACTURADO_AFORO USUARIO_CON_CARACTERIZACION CARGO_FIJO CARGO_VERTIMENTO_BAS CARGO_VERTIMENTO_COMP CARGO_VERTIMENTO_SUNT        CMT
    VLR_FACTURADO_VERTIDO VLR_SUBSIDIO VLR_CONTRIBUCCION FACTOR_SUBS_CONTR_CARGO_FIJO FACTOR_SUBS_CONTR_VERTIMENTO CARGO_CONEXION PAGO_ANTICIPADO_SERVICIO  DIAS_MORA   VLR_MORA INTERES_MORA OTROS_COBROS CAUSAL_REFACTURACION NUM_FACTURA_OBJ_REFACTURACION
    VLR_TOTAL_FACTURADO PAGOS_CLIENTE_DURANTE_PERIODO
        242602              242602          76         845         99          99                9999         9999              999 CLL 5 CRA 7 PEATONAL                                                         24911920 12-01-2011 01-12-2010
                 30             1                                                                             0               0                           0          1                    0                     0                     0          0
                        5         2200                 0                            0                            0              0                        0          0          0            0            0                    0                             0
                      0                          2201
        242604              242604          76         845         99          99                9999         9999              999 CRA 4 # 6 - 13                                                               24911846 12-01-2011 01-12-2010
                 30             1                                                                             0               0                           0          1                    0                     0                     0          0
                       13         2200                 0                            0                            0              0                        0          0          0            0            0                    0                             0
                      0                          2201
        242605              242605          76         845         99          99                9999         9999              999 CRA 2 CLLES 3 Y 4                                                            24911509 12-01-2011 01-12-2010
                 30             1                                                                             0               0                           0          1                    0                     0                     0          0
                        4         2200                 0                            0                            0              0                        0          0          0            0            0                    0                             0
                      0                          2201
    SQL>
    {code}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • How to get the value from databank

    Hi,
    How to get the value from databank? and how to set the same value to visual script object?
    thanks,
    ra

    Hi,
    You can use GetDatabankValue(HeaderName, Value) to get the value from databank and SetDataBankValue(HeaderName, Value) to set the value to databank.
    You can refer to the API Reference to see list of associated functions and techniques we can use with related to Data Bank.
    This is the for OFT but if you are using Open Script then you have direct access for getting the databank value but when it comes to setting a value you have to use File operation and write you own methods to do the set operation.
    Thanks
    Edited by: Openscript User 100 on Nov 13, 2009 7:01 AM

  • How to get the value from another report Customizes Form

    Dear all,
    I create a report such as
    select * from mytable.table1
    where field1 = :bind_variable
    I create a menu to run this Customized Form and user have to select the bind_variable values. So I have another report created which also want this bind_variable as it WHERE Clause. But I don't want my user to key the same bind variable twice. They can just same the Customized Form and run for both report.
    Could anybody know how to get the bind_variable on 1st report and used by the 2nd report.
    Thank you very much.
    Best Rgds,
    SL Voon

    Hi,
    are you on BI7.0? There you can create variables type replacement path and get the value out from a different variable without any coding.
    regards
    Cornelia

  • How to get the selectedIndex from a combobox made by classFactory?

    Dear All,
    I am trying to get the selectedIndex or selecetedItem.banda_id when changing a combobox that is created by classFactory and it is inside a datagrid.
    The code I have is:
    MXML:
    <mx:DataGrid width="100%" height="100%" id="salas_fin_dg" editable="true">
         <mx:columns>
    <mx:DataGridColumn headerText="Titulo" dataField="titulo" editable="false" width="250"/>
    <mx:DataGridColumn headerText="Data" dataField="start_dt" editable="false"/>
    <mx:DataGridColumn headerText="Dur" dataField="duration" editable="false" width="40"/>
    <mx:DataGridColumn headerText="Banda" dataField="banda_nome" editable="true" itemEditor="{combofac}"/>
    <mx:DataGridColumn headerText="$ Ensaio" dataField="total_ensaio" editable="true" itemEditor="controls.NumericInput"/>
    <mx:DataGridColumn headerText="$ Bar" dataField="total_bar" editable="true" itemEditor="controls.NumericInput"/>
    <mx:DataGridColumn headerText="$ Loja" dataField="total_loja" editable="true" itemEditor="controls.NumericInput"/>
    <mx:DataGridColumn headerText="$ CC" dataField="total_cc" editable="true" itemEditor="controls.NumericInput"/>
    <mx:DataGridColumn headerText="$ CH" dataField="total_ch" editable="true" itemEditor="controls.NumericInput"/>
    <mx:DataGridColumn headerText="$ DI" dataField="total_di" editable="true" itemEditor="controls.NumericInput"/>
    <mx:DataGridColumn headerText="$ Pend" dataField="total_pend" editable="true" itemEditor="controls.NumericInput"/>
         </mx:columns>
    </mx:DataGrid>
    Script:
    private function getSalasFinHandler(event:ResultEvent):void
    salas_fin_lst = new ArrayCollection(event.result as Array);
    salas_fin_dg.dataProvider = salas_fin_lst;
    myservice.getBandas();
    combofac=new ClassFactory(ComboBox);
         combofac.properties={dataProvider:bandas_lst, labelField:"banda_nome", prompt:"Selecione"};
    I am using Remote Object to get the data from a DB, and it is working properly.
    As I will update the datagrid cell values, I would like to update them on the DB.
    In order to do that, I would need to access the banda_id value, that is part of the combofac dataprovider, I mean that this dataprovider has 2 columns, being banda_nome and banda_id.
    The question is how to get the banda_id value, when I change the comobobox?
    Many thanks in advance,
    Gines

    Dear harUI and kolinitcom,
    Thanks for the your prompt response and guidelines.
    I went to research a little bit more on the itemEditEnd and found a way to access the data inside the combobox.
    The code for all application goes below. If you click on the button, it will show you all the datagrid data, plus the ID of the combobox when changed.
    Thanks again,
    Gines
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
            layout="vertical"
            verticalAlign="middle"
            backgroundColor="white" initialize="init();">
            <mx:Script>
               <![CDATA[
               import mx.utils.ObjectUtil;
               import mx.controls.ComboBox;
               import mx.controls.Alert;
               import mx.events.DataGridEvent;
               import mx.events.*;
          [Bindable]
          private var combofac:ClassFactory;
      public var newVal:String;
          private function init():void
            combofac=new ClassFactory(mx.controls.ComboBox);
            combofac.properties={dataProvider:arrcombo, prompt:"Selecione", labelField:"label"};      
                public function getCellInfo(event:DataGridEvent):void {
                    var myEditor:ComboBox = ComboBox(event.currentTarget.itemEditorInstance);
                    newVal = myEditor.selectedItem.data;
    public function mostra():void
    var dados:Object = new Object;
    dados.nome = dataGrid.selectedItem.label;
    dados.score = dataGrid.selectedItem.score;
    dados.score_id = newVal;
    Alert.show(ObjectUtil.toString(dados));
           ]]>
        </mx:Script>
        <mx:TextArea id="cellInfo" width="300" height="150" />
                <mx:ArrayCollection id="arrcombo">
            <mx:source>
                <mx:Array>
                    <mx:Object label="1" data="A1"/>
                    <mx:Object label="2" data="A2"/>
                    <mx:Object label="3" data="A3"/>
                    <mx:Object label="4" data="A4"/>
                    <mx:Object label="5" data="A5"/>
                    <mx:Object label="6" data="A6"/>
                    <mx:Object label="7" data="A7"/>
                    <mx:Object label="8" data="A8"/>
                    <mx:Object label="9" data="A9"/>
                </mx:Array>
            </mx:source>
        </mx:ArrayCollection>
        <mx:ArrayCollection id="arrColl">
            <mx:source>
                <mx:Array>
                    <mx:Object label="Student A" score="8" />
                    <mx:Object label="Student B" score="4" />
                    <mx:Object label="Student C" score="7" />
                    <mx:Object label="Student D" score="8" />
                    <mx:Object label="Student E" score="2" />
                    <mx:Object label="Student F" score="6" />
                    <mx:Object label="Student G" score="7" />
                    <mx:Object label="Student H" score="7" />
                    <mx:Object label="Student I" score="9" />
                    <mx:Object label="Student J" score="8" />
                    <mx:Object label="Student K" score="4" />
                    <mx:Object label="Student L" score="7" />
                </mx:Array>
            </mx:source>
        </mx:ArrayCollection>
        <mx:DataGrid id="dataGrid"
                dataProvider="{arrColl}"
                editable="true"
                rowCount="8"
                itemEditEnd="getCellInfo(event);">
            <mx:columns>
                <mx:DataGridColumn dataField="label"
                        editable="false" />
                <mx:DataGridColumn dataField="score"
                        editable="true"
                        itemEditor="{combofac}"/>
    <mx:DataGridColumn headerText="Salvar" width="50">
    <mx:itemRenderer>
    <mx:Component>
    <mx:VBox width="100%" height="100%">
    <mx:Button label="See the values" click="outerDocument.mostra();"/>
    </mx:VBox>
    </mx:Component>
    </mx:itemRenderer>
    </mx:DataGridColumn>
            </mx:columns>
        </mx:DataGrid>
    </mx:Application>

  • How to get the column index inside a dataTable

    Hello,
    before I get staked, there are multiple threads handling familiar topics to the one I'm questioning about but none gives an anwer. If there is one, I'm propably to less skilled to see it.
    So here is my Problem: I've build a web-interface to a time-recording system. The hours worked on a certain project are displayed in a dataTable component which is generated out of a mySQL Query. Each entry (column/row) contains a inputText component to display and edit the specific value.
    Editing one of these inputText elements now fires a valueChangeEvent which reads the new value and stores it in the database. For that cause I need to know the row- and column-index of the inputText component that fired the event.
    Using the getClientId method from the valueChangeEvent I get some Information which makes it possible to calculate the row/column index. A typical clientID looks like "form_table:mainTable:0:_id14". "form_table" is the ID of the form the dataTable is in. "mainTable" is the id of the dataTable component. "0" is the row the component is in. And finally "_id14" stands for the id randomly given to the inputText component by JSF.
    My Problem is now, that though I can calculate the column out of the[i] "_id14", this calculation is hardcoded. So everytime I add a component in before the dataTable, the calculation needs to be adjusted in the code.
    The Questions:
    - How to force a sensefull id indicating a column-index for the inputText components inside the columns of a dataTable?
    - Nicer since no workaround: How to get the column-index inside the dataTable on a natural way? (e.g. out of the valueChangeEvent the specific inputText component fires)
    After some investigation here on the board and on the net I know multiple ways to get the row index, (Things like component-binding and so on) but I can't find a answer on how to get the column-index.
    Thanks to all answers and/or links to things my eyes missed while searching for one.

    ...then index 0 becomes index 1 and my program doesn't work properlyThe program works properly, just not as you expect it to.
    As you've noticed the table gives you the flexibility to move columns around. So if you move column 0 to column 1, why would you expect to still use 0 as the index? The table manages the reordering of columns for you to make sure the data being displayed in each table column comes from the correct column in the data model.
    You can manage this yourself using one of the following methods (I forget which one):
    table.convertColumnIndexToModel(int viewColumnIndex)
    table.convertColumnIndexToView(int modelColumnIndex)
    Or, you can get data from the data model directly:
    table.getModel().getValueAt(row, 0);

  • How to get the column names of the table into the Dashboard prompt

    how to get the column names of the table into the Dashboard prompt
    Thanks & Regards
    Kishore P

    Hey john,
    My requirement is as follows
    I have created a Rank for Total sales by Region wise i.e RANK(SUM(Dollars By Region)) in a pivot table.
    My pivot table looks like this
    COLUMN SELECTOR: TOTAL US , REGION , DISTRICT , MARKET
    ---------------------------------------------------- JAN 2009          FEB 2009        MAR 2009
    RANK              REGION                  DOLLARS           DOLLARS        DOLLARS DOLLARS
    1 CENTRAL 10 20 30 40
    2 SOUTHERN 10 30 30 70
    3 EASTERN 20 20 20 60
    4 WESTERN 10 20 30 40
    When i select the District in column selector
    Report has to display rank based on Total Sales by District. i.e
    ------------------------------------------------- JAN 2009         FEB 2009       MAR 2009
    RANK             DISTRICT              DOLLARS           DOLLARS        DOLLARS DOLLARS
    for this i need to change the fx of rank i.e RANK(SUM(Dollars By Region)) to RANK(SUM(Dollars By District)) and fx of Region i.e Markets.Region to Markets.District dynamically.
    so , i need to capture column name of the value selected from the column selector and dynamically i need to update the fx 0f RANK & fx of region.
    do you have any solution for this?
    http://rapidshare.com/files/402337112/Presentation1.jpg.html
    Thanks & Regards
    Edited by: Kishore P on Jun 24, 2010 7:24 PM
    Edited by: Kishore P on Jun 24, 2010 7:28 PM

  • How to get the column count at the bottom of the column

    Hi Friends,
    How to get the column count at the bottom of the column
    Thanks
    Raj

    You mean row count? Add another column, click on the fx button and type RCOUNT(1).
    If you want just the total you can make it MAX(RCOUNT(1)), hide this column and then add a Narrative View after your report and enter "Total Number of Records: @n" where "n" represents what order your column is from the left side.

Maybe you are looking for