Dynamic condition in UDO Matrix's Column

Hi all,
I have a user form with a matrix. The matrix's first column has a CFL linked to another UDO MasterData Code (lets call it UDOCode).
And on this matrix, the same UDOCode cannot be chosen more then once.
So, I've been trying to code a dynamic CFL that filters the UDOCode's already chosen in the Column.
Based on this thread I've achived this code:
Select Case pVal.ItemUID
                    Case "mtx_ACORDO" '// The Matrix
                        oConds = New SAPbouiCOM.Conditions
                        With oForm.DataSources.DBDataSources.Item("@ADAT_ACORDOS1") '// The Matrix's DBDataSource
                            If .Size = 1 Then
                                oCond = oConds.Add
                                oCond.Alias = "Code"
                                oCond.Operation = BoConditionOperation.co_NOT_NULL
                            Else
                                For i As Integer = 0 To .Size - 1
                                    oCond = oConds.Add()
                                    oCond.BracketOpenNum = 1
                                    oCond.Alias = "Code"
                                    oCond.Operation = BoConditionOperation.co_NOT_EQUAL
                                    oCond.CondVal = .GetValue("U_EspPrcCd", i)
                                    oCond.BracketCloseNum = 1
                                    If i > 0 And i < .Size - 1 Then
                                        oCond.Relationship = BoConditionRelationship.cr_OR
                                    End If
                                Next
                            End If
                        End With
                End Select
If Not oConds Is Nothing Then oCFL.SetConditions(oConds)
In the matrix's first row I have no problem. All the values are there. But on the second row, no values are display in the DataTable.
If I change the conditions from .Size -1 to .Size - 2, I get the correct values on the first and second rows, but on the third, again, no values are being display in the DataTable...
Can anyone help me?
Regads,
Vítor Vieira
Edited by: Rui Pereira on Dec 23, 2008 4:17 PM

Hi, Erwine Sukardy
Maybe it will be helpful if you have a specific task.
All of items on a Form have it's own DBDataSources.
For example, to get a table name and field name, that are Datasources to the ItemCode field in a Matrix in a  Purchase Order document, you can use this code:
SAPbouiCOM.Matrix        tblSNs;
SAPbouiCOM.Column      oColumnItems;           
tblSNs = (SAPbouiCOM.Matrix)oPurDNForm.Items.Item("38").Specific;
oColumnItems = (SAPbouiCOM.Column)tblSNs.Columns.Item("1");
string tableName = oColumnItems.DataBind.TableName;
string fieldName = oColumnItems.DataBind.Alias;
HTH!

Similar Messages

  • Sorting UDO Matrix

    Hi,
    I need help in the following:
    1. How to sort or group UDO table(s) using conditions
    2. How to enable double-click on column header in UDO matrix
    I am using VB and 2004B. Your input will be greatly appreciated.

    To my knowlegde this can't be done yet. Not in SBO2004A or in SBO2005A... Sort was part of the planned release of 2005A but it didn't make it before the release. Now the plan is SBO2005A SP1... I don't know the release plan form the B-Cluster...

  • Conditional format in Matrix report

    Hi all,
    I have the column wise matrix output which I am require to put some highlight on the entire row if the condition meet.
    The output will be something like this :-
    Name ____________JOB A______JOB B _______JOB C
    AAAA____________2___________2____________2
    BBBB____________4___________4____________4
    CCCC____________5___________0____________5
    With the above displayed, I will like the last row to be highlighted as one of the matrix cell column was not having the same qty with the rest.
    It is possible to do that ?
    Please advise.
    Regards,
    Lim

    Hope the following helps...
    I tested using sample xml
    <ROWSET>
    <ROW>
    <DAY>Day 1</DAY>
    <MONTH>Jan</MONTH>
    <VAL>8</VAL>
    </ROW>
    <ROW>
    <DAY>Day 2</DAY>
    <MONTH>Jan</MONTH>
    <VAL>128</VAL>
    </ROW>
    <ROW>
    <DAY>Day 3</DAY>
    <MONTH>Jan</MONTH>
    <VAL>88</VAL>
    </ROW>
    <ROW>
    <DAY>Day 4</DAY>
    <MONTH>Jan</MONTH>
    <VAL>-8</VAL>
    </ROW>
    <ROW>
    <DAY>Day 1</DAY>
    <MONTH>Feb</MONTH>
    <VAL>12</VAL>
    </ROW>
    <ROW>
    <DAY>Day 2</DAY>
    <MONTH>Feb</MONTH>
    <VAL>0</VAL>
    </ROW>
    <ROW>
    <DAY>Day 3</DAY>
    <MONTH>Feb</MONTH>
    <VAL>-88</VAL>
    </ROW>
    <ROW>
    <DAY>Day 4</DAY>
    <MONTH>Feb</MONTH>
    <VAL>-11</VAL>
    </ROW>
    <ROW>
    <DAY>Day 1</DAY>
    <MONTH>Mar</MONTH>
    <VAL>-20</VAL>
    </ROW>
    <ROW>
    <DAY>Day 2</DAY>
    <MONTH>Mar</MONTH>
    <VAL>12</VAL>
    </ROW>
    <ROW>
    <DAY>Day 3</DAY>
    <MONTH>Mar</MONTH>
    <VAL>99</VAL>
    </ROW>
    <ROW>
    <DAY>Day 4</DAY>
    <MONTH>Mar</MONTH>
    <VAL>32</VAL>
    </ROW>
    </ROWSET>Crosstab structure...
    (1,1)<?horizontal-break-table:1?>
    (1,2)<?for-each-group@column:ROW;./DAY?><?DAY?><?end for-each-group?>
    (2,1)<?for-each-group:ROW;./MONTH?><?variable@incontext:G1;current-group()?><?MONTH?>
    (2,2)<?for-each-group@cell://ROW;./DAY?><?if:($G1[(./DAY=current()/DAY)]/VAL)<0?><?attribute@incontext:background-color;'Red'?><?end if?><?($G1[(./DAY=current()/DAY)]/VAL)?><?end for-each-group?><?end for-each-group?>In the IF statement either you can format the color or put some text..

  • Choose From List and Golden arrow link in System Matrix UDF column

    I'm wondering if there is a way through the SDK to create a 'Choose From List' and Golden arrow linked button in a System Matrix UDF column? 
    For example the Item Code in a sales order matrix does both.

    Hi,
    Try this code for adding CFL.             
                   SAPbouiCOM.ChooseFromListCollection oCFLs = null;
                    SAPbouiCOM.Conditions oCons = null;
                    SAPbouiCOM.Condition oCon = null;
                    oCFLs = oForm.ChooseFromLists;
                    SAPbouiCOM.ChooseFromList oCFL = null;
                    SAPbouiCOM.ChooseFromListCreationParams oCFLCreationParams = null;
                    oCFLCreationParams = ( ( SAPbouiCOM.ChooseFromListCreationParams )( SBO_Application.CreateObject( SAPbouiCOM.BoCreatableObjectType.cot_ChooseFromListCreationParams ) ) );
                    oCFLCreationParams.MultiSelection = false;
                    oCFLCreationParams.ObjectType = "object id ";
                    oCFLCreationParams.UniqueID = "CFL1";
                    oCFL = oCFLs.Add( oCFLCreationParams );
                   oColumn.ChooseFromListUID = "CFL1";
                  //where oColumn is the instance of that column.
    Hope u will get help....
    Thanks and Regards,
    Lalit

  • Udo matrix -save problem

    Hi,
    i am creating a form by using UDO form generator.
    in that documet and doucument rows are existed. if user select the combobox value from the form, by taking that value and i am generating a query, i am generating a recordset. by using Userdatasources i am binding each column in matrix.
    i binded all values to the matrix successfully. but
    but when i press Add button, this matrix rows are not getting saved. and also if i have two rows, when i press add, in database only one row is adding with NULL values. how to save that matrix data?
    please help me urgent
    asap
    regards,
    nagababu

    I believe this is a duplicate of
    Udo matrix rows saving problem
    Pls read the guidelines. Don't duplicate requests, this just cause confusion and
    inefficiency in the forum. And pls remember that this is a community of very very
    busy developers, each of them with his/her "urgencies" ....

  • UDO matrix sort

    Hello All:
       Currently have a UDO that user users, as it get larger there is a need to have the matrix value sorted by a different way (default of course is alphabetically against code column).
       Aside from write a new form and handle data source of the matrix myself. Any easier I can resort the exist UDO matrix?
       Thank you for any help you can give me.
    Also.
        I am having a weired problem that when I change viewpanel, element does not change.
        I set the item's frompanel and topanel.. And I have the handling script that does "form.PaneLevel = " thing. I know it is something stupid as I done something like this before and stuck on this a bits before and fixed before. But that was several years ago. Can't remember what I did. Any obvious suggestion would be greatly appreciated. First part of this message is more important!
    Thank You!

    Matrix columns can be sort using this code
    yourmatrix.Columns.Item("yourcolumn").TitleObject.Sortable = true;
    when you click on matrix column header the column will sort automatically

  • Binding matrix - picture column - datatables

    Hi,
    I have matrix with column type picture as
    oColumn = oColumns.Add("Pict", SAPbouiCOM.BoFormItemTypes.it_PICTURE)
    oColumn.TitleObject.Caption = "Pict"
    oColumn.Editable = False
    I have usertable with userfield type image as
    oUserFieldsMD.Type = SAPbobsCOM.BoFieldTypes.db_Alpha
    oUserFieldsMD.SubType = SAPbobsCOM.BoFldSubTypes.st_Image
    When I bind the table to matrix through datasource as
    oDBDataSource = oOrderForm.DataSources.DBDataSources.Add("@SKIL_ATTACH")
    oConditions = New SAPbouiCOM.Conditions
    oDBDataSource.Query(oConditions)
    and bind as
    oColumn = oColumns.Item("pict")
    oColumn.DataBind.SetBound(True, "@SKIL_ATTACH", "U_pict")
    The image is shown in matrix directly in proper column.
    Problem is, that I must use datatables because i must implement sorting. When I create datatable and bound it to column as
    Dim odbtable As SAPbouiCOM.DataTable
    Dim sql As String
    odbtable = oOrderForm.DataSources.DataTables.Add("VEP")
    sql = "SELECT u_path, u_pict from [dbo].[@skil_attach]"
    odbtable.ExecuteQuery(sql)
    oColumn = oColumns.Item("Pict")
    oColumn.DataBind.Bind("VEP", "U_PATH")
    The matrix is bounded, no error shown and in result the image is not shown in matrix. Does anybody experiences with binding datatables to matrix with type image?
    Thanks a lot for help or idea.
    Petr

    I found it. I dont know why, but through datatables it accept only jpg files and not gif files as in datasources...

  • How to display the rows in a color for specific dynamic condition.

    Hi,
    I am new to OAF. I created a custom Search Page.My requirement is we need to display a color for specific dynamic condition. Could any one help me how to do this?
    Thanks in Advance
    Sruthi.

    Hi,
    Sruthi wrote:
    I am new to OAF. I created a custom Search Page.My requirement is we need to display a color for specific dynamic condition. Could any one help me how to do this?------I think we can display colours at coloumns level only,nt at row levevl.
    ------use CSSStyle to set the colour, via webBean.
    Co-ProcessRequest:*
    import oracle.cabo.style.CSSStyle;
    CSSStyle oraaniltext = new CSSStyle();
    oraaniltext.setProperty("color", "#F6358A");
    oraaniltext.setProperty("background-color", "#000000");
    OAMessageTextInputBean comCode = (OAMessageTextInputBean)webBean.findChildRecursive("InvoiceIdTI");
    comCode.setInlineStyle(oraaniltext);
    http://www.computerhope.com/htmcolor.htm
    Regards
    Meher Irk
    Edited by: Meher Irk on Oct 25, 2010 9:46 PM

  • How to read an interal table with dynamic conditions

    Dear all,
       I have an internal table IN_TAB and I want to read a record of the table with dynamic condition as below.
    a) IN_TAB  structure : |      ColA     |      Col B     | Col C        | Col D        |
    b) Requirement: there are four condtions, and reading data from IN_TAB (not use loop) based on these conditions. If one condition is empty, it'll be ommited.
    Ex: |      ColA     |      Col B     |    Col C      |    ColD      |
    x1
    b
    c
    d
    x1
    x2
    x3
    x1
    x2
    x3
    x4
    y1
    y2
    y3
    y4
    The conditons consist of ColA = ' x1' , ColB = 'x2' , ColC = '', ColD = ''
    The result will be:
    x1
    x2
    x3
    x1
    x2
    x3
    x4
    Could you please help to solve this problem.
    Thanks and regards,
    Nguyen Huy.

    Hi Nabheet,
      Thanks for your solution, It solved my problem. I also suggest the another way to obtain this.
    - The internal table have to declare with header line, note that the internal table mustn't has x type in the structure.
    - Assign all conditions into header line wether condtion is empty or not.
    - Use statement READ TABLE IN_TAB.
    Ex:
       DATA: BEGIN OF RT OCCURS 0,
            MATNR(18) TYPE C,
            ERNAM(12) TYPE C,
            BISMT(18) TYPE C,
            LAEDA TYPE MARA-LAEDA,
          END OF RT .
    SELECT
      MATNR
      ERNAM
      BISMT
      LAEDA
      UP TO 10 ROWS
      INTO CORRESPONDING FIELDS OF TABLE RT
      FROM MARA.
    RT-MATNR = '7F01113'.
    RT-LAEDA = '20111005'.
    READ TABLE RT.
    @ponvignesh : thanks for your reply, I thinks that the Nabheet's solution is the good way.
    Kindly regards,
    Nguyen Huy

  • Adding Specific columns of dynamic internal table row into another column

    Hi Gurus,
    I need to add  few columns of a dynamic internal table row into another column:
    Article description hy01 hy02 total
    101      panza         10     12      22
    102      masht         12     12     24
    dynamic internal table is created and columns hy01 hy02.... can increase
    How to add the the values in hy01 hy 02... into total.
    Regards,
    Dep

    Hi,
    If you really want to have a dynamic table, then you will have to find a way to generate a whole new table, and then copy the data from the old table to the new one. There is no way to modify a type during runtime in ABAP.
    Here an example how to generate a dynamic table based on another internal table, hope this will help you.
    TYPE-POOLS: slis.
    PARAMETERS: p_nb_hy TYPE i DEFAULT 2. "Number of new HY columns to be added
    * Type ZST_T:
    *   matnr  TYPE matnr
    *   maktx  TYPE maktx
    *   hy01   TYPE i
    *   total  TYPE i
    TYPES: ty_t TYPE STANDARD TABLE OF zst_s.
    PERFORM main.
    *&      Form  main
    *       text
    FORM main.
      DATA: lt_fieldcat     TYPE slis_t_fieldcat_alv,
            lt_t            TYPE ty_t,
            lr_new_t        TYPE REF TO data.
      FIELD-SYMBOLS: <lt_new_t> TYPE STANDARD TABLE.
      "Add some lines to LT_T just to have something to display on screen
      DO 10 TIMES.
        APPEND INITIAL LINE TO lt_t.
      ENDDO.
      CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
        EXPORTING
          i_structure_name = 'ZST_S'
        CHANGING
          ct_fieldcat      = lt_fieldcat.
      "Copy LT_T to LR_NEW_T
      PERFORM extend_and_copy_table USING lt_t p_nb_hy CHANGING lr_new_t lt_fieldcat.
      CLEAR lt_t. "Not needed anymore...
      ASSIGN lr_new_t->* TO <lt_new_t>.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          it_fieldcat = lt_fieldcat
        TABLES
          t_outtab    = <lt_new_t>.
    ENDFORM.                    "main
    *&      Form  extend_and_copy_table
    FORM extend_and_copy_table USING ut_t           TYPE STANDARD TABLE
                                     uv_nb_hy       TYPE i
                               CHANGING cr_t        TYPE REF TO data
                                        ct_fieldcat TYPE slis_t_fieldcat_alv
                               RAISING cx_sy_struct_creation cx_sy_table_creation.
      DATA: lo_tabledescr      TYPE REF TO cl_abap_tabledescr,
            lo_structdescr     TYPE REF TO cl_abap_structdescr,
            lo_new_structdescr TYPE REF TO cl_abap_structdescr,
            lo_new_tabledescr  TYPE REF TO cl_abap_tabledescr,
            lt_components      TYPE cl_abap_structdescr=>component_table,
            ls_component       TYPE cl_abap_structdescr=>component,
            lv_field_cnt       TYPE numc2,
            ls_fieldcat        TYPE slis_fieldcat_alv,
            lr_fieldcat        TYPE REF TO slis_fieldcat_alv.
      FIELD-SYMBOLS: <ls_old_s> TYPE ANY,
                     <lt_new_t> TYPE STANDARD TABLE,
                     <ls_new_s> TYPE ANY.
      "Get the list of all components from UT_T line structure
      lo_tabledescr  ?= cl_abap_tabledescr=>describe_by_data( ut_t ).
      lo_structdescr ?= lo_tabledescr->get_table_line_type( ).
      lt_components  = lo_structdescr->get_components( ).
      "The new columns will be from type of column HY01
      ls_component-type = lo_structdescr->get_component_type( 'HY01' ).
      "The new columns will have the same fieldcat info as column HY01
      READ TABLE ct_fieldcat INTO ls_fieldcat WITH KEY fieldname = 'HY01'.
      "HY<lv_field_cnt> = new field name
      lv_field_cnt = uv_nb_hy + 1.
      "For each new column...
      DO uv_nb_hy TIMES.
        "Generate the new column field name
        CONCATENATE  'HY' lv_field_cnt INTO ls_component-name.
        ls_fieldcat-fieldname = ls_component-name.
        "Add the new field to the components of the new structure
        INSERT ls_component INTO lt_components INDEX 4.
        "Add the new field's fieldcat info to the fieldcat
        INSERT ls_fieldcat  INTO ct_fieldcat   INDEX 4.
        lv_field_cnt = lv_field_cnt - 1.
      ENDDO.
      "Adjust the COL_POS from fieldcat
      LOOP AT ct_fieldcat REFERENCE INTO lr_fieldcat.
        lr_fieldcat->col_pos = sy-tabix.
      ENDLOOP.
      "Create the new table
      lo_new_structdescr = cl_abap_structdescr=>create( p_components = lt_components ).
      lo_new_tabledescr  = cl_abap_tabledescr=>create( p_line_type = lo_new_structdescr ).
      CREATE DATA cr_t TYPE HANDLE lo_new_tabledescr.
      ASSIGN cr_t->* TO <lt_new_t>.
      "Copy all data from old to new table
      LOOP AT ut_t ASSIGNING <ls_old_s>.
        APPEND INITIAL LINE TO <lt_new_t> ASSIGNING <ls_new_s>.
        MOVE-CORRESPONDING <ls_old_s> TO <ls_new_s>.
      ENDLOOP.
    ENDFORM.                    "main

  • *** How to add dynamic condition to Query ***

    Hi All,
    Could you please help me out logic
    i need only query
    There is tables emp, dept
    SELECT E.ENAME,D.DNAME
    FROM EMP E, DEPT D
    WHERE d.DEPTNO = e.DEPTNO(+)
    AND (DYNAMIC CONDITION)
    DYNAMIC CONDITION LOGIC IS
    IF D.DEPTNO IS THERE IN E.DEPTNO THEN [E.JOB = 'MANAGER'] --- CONDITIION SHOULD ADD IN THE PLACE OF (DYNAMIC CONDITION)
    IF D.DEPTNO IS NOT THERE IN E.DEPTNO THEN [ D.LOC = 'LONDON'] --- CONDITIION SHOULD ADD IN THE PLACE OF (DYNAMIC CONDITION)
    I tried below
    select e.ENAME, e.SAL, d.dname from emp e, dept d
    where CASE WHEN e.deptno = d.deptno then e.job = 'MANAGER'
    else D.loc = 'LONDON'
    END
    But its giving error...
    Please give a solution
    Thanks in Advance
    KC

    SELECT E.ENAME,D.DNAME, d.loc, e.job, e.deptno
    FROM EMP E, DEPT D
    WHERE d.DEPTNO = e.DEPTNO(+)
    and (
           (e.deptno is null and d.loc='LONDON')
             or
           (e.deptno is not null and e.job='MANAGER')
         );  (But thats no dynamic sql!)

  • About Dynamic Conditions

    hello,
    if i want to use Dynamic Conditions in select,how can i do? Dynamic Conditions 'where'.

    Hi,
         TABLES: VBAK.
    SELECT-OPTIONS S_VBELN FOR VBAK-VBELN.
    DATA: lV_STR1(20) TYPE C VALUE 'VBELN IN S_VBELN.'.
    DATA: GI_WHERE(72) OCCURS 0 WITH HEADER LINE.
          GI_WHERE = LV_STR1.
           APPEND GI_WHERE.
    DATA GI_VBAK LIKE VBAK OCCURS 0 WITH HEADER LINE.
    SELECT VBELN
    INTO TABLE GI_VBAK
    FROM VBAK
    WHERE (gi_where).
    Regards
    amole

  • How to evaluate the dynamic condition string in PL/SQL ?

    Hello, I am solving the issue of checking and validating the event table.
    For Example, the event table namely "Contract_validated" contains some atts about a contract as follow:
    CONTRACT_VALIDATED (SEQ_ID, CO_ID, VALID_T, CHANGE_KEY, ATT1, ATT1_FROM, ATT2, ATT2_FROM, REASON, CHANGE_KEY_ORIG, ATT1_ORIG, ATT2_ORIG)
    In this table, the pairs (ATT1 and ATT1_FROM), (ATT2 and ATT2_FROM) must be compared to check whether the values are changed or not in the update event (change_key = U). If some records have change_key = U but the values does not change, I need to protocol and correct such records.
    The table name and attributes list could be dynamic, and will be provided as parameters. Therefore, I use Dynamic PL/SQL to generate the code to test the conditions between the values between the pairs columns for detecting the invalid event. However, I am stucking in testing the condition phrases because I can not evaluate the condition string in the SELECT statement. I can not use IF because parts of this condition string take the value from a record and collection type. Anyone has the idea how to evaluate the condition in such case, please give me instructions or recommendations (it could be other alternatives to solve the problems)
    Here is the code which generated from my Dynamic PL/SQL string, however, Oracle raise exception error at the EXECUTE IMMEDIATE v_sql command
    SELECT 'x' FROM DUAL WHERE (NVL(v_rec.ATT1, NULL) <> NVL(v_rec.ATT1_FROM , NULL) OR (NVL(v_rec.ATT2, NULL) <> NVL(v_rec.ATT2_FROM , NULL))
    E-0008: Unkown Exception raised in Loop. ORACLE:ORA-00904: "V_REC"."ATT2_FROM": invalid identifier
    vo_traced_list has type Table of VARCHAR2(2000), storing the atts list of table (CONTRACT_VALIDATED), it has value already from other procedure invocation.
    Here is the dynmic PL/SQL code generated dynamically depends on the table name, and attr list:
    DECLARE v_rec CONTRACT_VALIDATED%ROWTYPE;
    TYPE cv_type IS REF CURSOR;
    v_rec_cv CV_TYPE;
    v_cond VARCHAR2(4000);
    cond BOOLEAN := FALSE;
    v_exec VARCHAR2(1000);
    v_default VARCHAR2(10):= 'NULL';
    tk_val CONTRACT_VALIDATED.VALID_T%TYPE;
    pk_val CONTRACT_VALIDATED.CO_ID%TYPE;
    v_cnt NUMBER;
    BEGIN
    OPEN v_rec_cv FOR SELECT /*+ parallel(x,4) */ x.* FROM CONTRACT_VALIDATED x WHERE CHANGE_KEY = 'U' ORDER BY VALID_T;
    FETCH v_rec_cv INTO v_rec;
    IF v_rec_cv%NOTFOUND THEN
    Add_Log('Event_Validating',v_user,v_event_validated,'INFO','I-0001: No-Procession needed');
    ELSE
    BEGIN
    LOOP
    pk_val := v_rec.co_id;
    tk_val := v_rec.valid_t;
    v_cnt := vo_traced_atts_list.COUNT;
    v_cond := '(NVL(v_rec.'|| vo_traced_atts_list(1)||', ' || v_default || ') <> NVL(v_rec.' || vo_traced_atts_list(1)||'_FROM'
    ||' , ' || v_default || '))';
    cond := (BOOLEAN) v_cond;
    FOR v_i IN 2..v_cnt LOOP
    BEGIN
    v_cond := v_cond ||CHR(13)||CHR(10)||'OR (NVL(v_rec.'||vo_traced_atts_list(v_i)||', ' || v_default || ') <> NVL(v_rec.'||vo_traced_atts_list(v_i)||'_FROM'
    ||' , ' || v_default || '))';
    END;
    END LOOP;
    v_exec := 'SELECT ''x'' FROM DUAL WHERE '||v_cond;
    Add_Log('Event_Validating',v_user,v_event_validated,'INFO',v_exec);
    EXECUTE IMMEDIATE v_exec;
    /* Exception raised from here
    E-0008: Unkown Exception raised in Loop. ORACLE:ORA-00904: "V_REC"."ATT2_FROM": invalid identifier
    It seems that Oracle does not understand the dynamic reference v_rec.ATT2_FROM, v_rec.ATT2,... to test the condtion
    IF SQL%ROWCOUNT = 0     THEN -- condition is false ==> traced attributes does not changed
    -- update the REASON = 4 - not interested event
    v_exec := 'UPDATE CONTRACT_VALIDATED SET REASON = 4 WHERE CO_ID = '||pk_val||' AND VALID_T = '||tk_val;
    EXECUTE IMMEDIATE v_exec;
    END IF;
    FETCH v_rec_cv INTO v_rec;
    EXIT WHEN v_rec_cv%NOTFOUND;
    END LOOP;
    EXCEPTION
    WHEN OTHERS THEN
    Add_Log('SCD_VALIDATION',v_user,v_event_validated,'ERROR','E-0008: Unkown Exception raised in Loop. ORACLE:'||SQLERRM);
    RAISE ge_raise_error;
    END;
    END IF;
    CLOSE v_rec_cv;
    EXCEPTION
    WHEN OTHERS THEN
    Add_Log('SCD_VALIDATION',v_user,v_event_validated,'ERROR','E-0008: Unkown Exception raised in Loop. ORACLE:'||SQLERRM);
    RAISE ge_raise_error;
    END;

    Dear Andrew,
    Thank you so much for your suggestions, however, I think it will be better to let me explain more about the situation.
    I am working at Data Warehousing and Analysis part. The event tables are provided by other applications such as Customer OTLP system, Sales Management, etc. We therefore just have the results stored in the event tables (which could be wrong or inconsistency) and no way to force them to be valid by constraints. Before further processing the events , their records should be checked and overridden if possible, and that is the point I am trying to solve now.
    The Event table names, their attributes list, data types, primary key, timestamp columns etc are dynamic and are provided via parameters. I would like to write a procedure which can check the invalid events (not only update, but also insert, delete), protocol them, and override them if possible before processing further. Because the table name, attribute lists, data type, etc are not known in advanced, to my best knowledge, the only choice is generating dynamic PL/SQL code although it could suck the performance. The code you have seen in my first question is the output from the follwoing procedure, where the i_att_list provides the atts list has been parsed from other procedure invocation, i_pk is the primary key, i_tk is the time key, i_table_name is the table name (which is Event_Validation in previous example). The stucking point I have met now is that I do not know how to test the condition to detect the different between column pairs (ATT1 and ATT1_FROM, ...). Using Select from dual is just a dummy select for testing the where condition which must be formed as a string by that way.
    Thank you very much for your answer and looking forward to seeing your further recommendations or suggestions.
    Regards,
    Tho.
    CREATE OR REPLACE PROCEDURE Update_Validation
    ( i_att_list enum_string, -- list of attributes
    i_pk IN VARCHAR2, -- primary key column
    i_tk IN VARCHAR2, -- time key column
    i_table_name IN VARCHAR2 -- table_name - the columns format be checked
    ) AUTHID Current_User IS
    TYPE LoopCurType           IS REF CURSOR;
    ln_parallel NUMBER := 4;
    ge_raise_error EXCEPTION;
    v_user VARCHAR2(100);
    v_sql VARCHAR2(4000);
    v_string VARCHAR2(4000);
    v_crlf VARCHAR2(2) := CHR(13)||CHR(10);
    BEGIN
    SELECT sys_context('USERENV','current_schema') INTO v_user FROM DUAL;
    v_sql:= 'SELECT /*+ parallel(x,'||ln_parallel||') */ x.* FROM ' ||i_table_name|| ' x '||
              'WHERE CHANGE_KEY = ''U'''||
    ' order by '||i_tk;
    v_string := 'DECLARE v_rec '||i_table_name||'%ROWTYPE;' ||v_crlf||
              ' TYPE cv_type IS REF CURSOR; ' ||v_crlf||
    ' v_rec_cv CV_TYPE; ' ||v_crlf||
              ' v_cond VARCHAR2(4000); ' ||v_crlf||
         ' v_exec VARCHAR2(100);' ||v_crlf||
              ' v_default VARCHAR2(10):= ''~~''; ' ||v_crlf||
    ' tk_val '||i_table_name||'.'||i_tk||'.%TYPE;'||v_crlf||
    ' pk_val '||i_table_name||'.'||i_pk||'.%TYPE;'||v_crlf||
              ' v_cnt NUMBER;' ||v_crlf||
              'BEGIN ' ||v_crlf||
                        'OPEN v_rec_cv FOR ' ||v_sql ||';' ||v_crlf||
                        'FETCH v_rec_cv INTO v_rec;' ||v_crlf||
                             ' IF v_rec_cv%NOTFOUND THEN ' ||v_crlf||
                                  'Add_Log(''Event_Validating'',v_user,i_table_name,''INFO'',''I-0001: No-Procession needed'');'||v_crlf||
                             ' ELSE ' ||v_crlf||
                                  ' BEGIN '||v_crlf||
                                  ' LOOP '||v_crlf||
                                  'pk_val := v_rec.'||i_pk||';'||v_crlf||
    'tk_val := v_rec.'||i_tk||';'||v_crlf||
    'v_cnt := i_att_list.COUNT;' ||v_crlf||
                                            'v_cond := ''NVL(v_rec.''|| i_att_list(1)||'', '' || v_default || '') <> NVL(v_rec.'' || i_att_list(1)||''_FROM'''||v_crlf||
                             '||'' , '' || v_default || '')'';'||v_crlf||
                                            'FOR v_i IN 2..v_cnt LOOP'||v_crlf||
                                                 'BEGIN'||v_crlf||
                                                 'v_cond := v_cond ||CHR(13)||CHR(10)||''OR NVL(v_rec.''||i_att_list(v_i)||''), <> NVL(v_rec.''||i_att_list(v_i)||''_FROM'''||v_crlf||
                                                 '||'' , '' || v_default || '')'';'||v_crlf||
                                                 'END;'||v_crlf||
                                            'END LOOP;'||v_crlf||
                                            'v_exec := ''SELECT ''x'' FROM DUAL WHERE ''||v_cond;'||v_crlf||
                                            'EXECUTE IMMEDIATE v_exec;'||v_crlf||
                                            'IF SQL%ROWCOUNT = 0     THEN -- condition is false ==> traced attributes does not changed'||v_crlf||
                                            '-- update the REASON = 4 - not interested event'||v_crlf||
                                            'UPDATE '||i_table_name||' SET REASON = 4 WHERE '||i_pk||' = '||v_tk||' AND '||i_tk||' = '||tk_val||';'||v_crlf||
                                            'END IF;'||v_crlf||
                                       'FETCH v_rec_cv INTO v_rec;' ||v_crlf||
                                       'EXIT WHEN v_rec_cv%NOTFOUND;'||v_crlf||
                        ' END LOOP;'||v_crlf||
                                  'EXCEPTION' ||v_crlf||
                             'WHEN OTHERS THEN'||v_crlf||
                        'Add_Log(''SCD_VALIDATION'',v_user,i_table_name,''ERROR'',''E-0008: Unkown Exception raised in Loop. ORACLE:''||SQLERRM);'||v_crlf||
                        'RAISE ge_raise_error;'||v_crlf||
                                  'END;'||v_crlf||
                                  'END IF;'|| v_crlf||
                        'Close v_rec_cv;'||v_crlf||
                        'EXCEPTION' ||v_crlf||
                   'WHEN OTHERS THEN'||v_crlf||
              'Add_Log(''SCD_VALIDATION'',v_user,i_table_name,''ERROR'',''E-0008: Unkown Exception raised in Loop. ORACLE:''||SQLERRM);'||v_crlf||
              'RAISE ge_raise_error;'||v_crlf||
                   'END;';               
         Add_Log('SCD_UPDATE_VALIDATION',v_user,i_table_name,'INFO','I-0006: Update Validation : '||v_string);     
         EXECUTE IMMEDIATE v_string;
    EXCEPTION
    WHEN OTHERS THEN
    Add_Log('SCD_VALIDATION',v_user,i_table_name,'ERROR','E-0008: Unkown Exception raised in Loop. ORACLE:'||SQLERRM);
    END Update_Validation;

  • Can I have a conditional javascript:apex.confirm when column is null

    Hi All,
    I am relatively new to the product but am picking up things all the time. I was recently asked to create a confirmation on submit dialog which I did quite easily using javascript:apex.confirm. I was then asked to only display the confirmation message if a comment column was empty. The column is optional but it is preferred if something is added. I am using 4.1.1. Is this possible? Any ideas would be appreciated
    Regards
    Chris

    Hello Chris,
    >
    user4023958 wrote:
    I am relatively new to the product but am picking up things all the time. I was recently asked to create a confirmation on submit dialog which I did quite easily using javascript:apex.confirm. I was then asked to only display the confirmation message if a comment column was empty. The column is optional but it is preferred if something is added. I am using 4.1.1. Is this possible? Any ideas would be appreciated.
    >
    How have you implemented the apex.confirm?
    <ul>
    <li>If you have done it in dynamic action on button click then you have to make the dynamic action conditional by using Item/Column value is not null condition with expression as your comment item say P1_COMMENTS</li>
    <li>If you have done it in Button Action as Redirect to URL then simply you can write a javascript function in your page header as :
    <script type="text/javascript">
    function f_showConfirm () {
      if ($x('P1_COMMENTS').value == '') {
        apex.confirm('Do you want to submit this page?', 'SUBMIT');
      } else {
        apex.submit('SUBMIT');
    </script>and call this javascript function in Button Action - Redirect to URL with URL Target set as:
    javascript:f_showConfirm();</li>
    </ul>
    In order to get accurate/appropriate response you should include relevant details from following information with your question:
    <ul>
    <li>Full APEX version</li>
    <li>Full Database version</li>
    <li>APEX Web server architecture (EPG, OHS or APEX listener)</li>
    <li>Browser(s) and version(s) used</li>
    <li>Operating system with version, architecture(32/64)</li>
    <li>Theme</li>
    <li>Template(s)</li>
    <li>Region/item type(s)</li>
    </ul>
    The above information will help the forum members to ascertain the problem context and post most relevant response.
    Please read the [url https://wikis.oracle.com/display/Forums/Forums+FAQ]FAQ and [url https://forums.oracle.com/forums/ann.jspa?annID=1324]forum instructions for more information on using OTN forums effectively.
    Please update your forum profile with a real handle instead of user4023958.
    Hope it helps!
    Regards,
    Kiran

  • How to frame dynamic condition and evaluate them

    hi all
    i have a table which has 3 columns
    col1 col2
    coloumn 1 will have relational operators like =,>,< etc
    and coloumn 2 will have some values
    in a procedure which has a in parameter. i need to check the parameter with the col2 using col1 ie using the relational operator.
    for ex
    the parameter will be 10 and the operator will be > and the column2 will be 11
    how will i do this dynamically and how will i evaluate this conditions
    thanks in advance
    hari

    One approach:
    SQL> create or replace function DynamicFunction ( op1 number, operator varchar2, op2 number) return boolean is
    2 plsqlBlock varchar2(4000);
    3 boolInt integer;
    4 begin
    5 plsqlBlock :=
    6 'declare
    7 function ExecFunc return boolean is
    8 begin
    9 return('||op1||operator||op2||');
    10 end;
    11 begin
    12 if ExecFunc then
    13 :result := 1;
    14 else
    15 :result := 0;
    16 end if;
    17 end;
    18 ';
    19
    20 execute immediate plsqlBlock using OUT boolInt;
    21
    22 return(boolInt=1);
    23 end;
    24 /
    Function created.
    SQL> show errors
    No errors.
    SQL>
    SQL>
    SQL> set serveroutput on
    SQL> declare
    2 procedure Eval( op1 varchar2, operator varchar2, op2 varchar2 ) is
    3 begin
    4 DBMS_OUTPUT.put( op1||operator||op2||'=' );
    5 if DynamicFunction( op1, operator, op2 ) then
    6 DBMS_OUTPUT.put_line( 'TRUE' );
    7 else
    8 DBMS_OUTPUT.put_line( 'FALSE' );
    9 end if;
    10 end;
    11 begin
    12 Eval( 1, '=', 2 );
    13 Eval( 2, '>=', '2' );
    14 end;
    15 /
    1=2=FALSE
    2>=2=TRUE
    PL/SQL procedure successfully completed.
    SQL>

Maybe you are looking for

  • Right way to preserve all parent table entries in a join with many tables!!

    This problem is quite interesting to me. I have asked this question to others but no body is able to provide me with proper answers. The problem is: How do I join a huge parent table with many child tables (more than 5 child tables) preserving all of

  • Will Siri be available to the ipod touch in IOS 6

    ive heard rumors that siri will be available to the iphone 4 on the ios 6 update but im not sure if that goes for the ipod touch.

  • Exporting full quality

    Everytime I export my movie using Full Quality DV the end result is not as crisp as the original. I even exported a clip with no edits and the exported clip doesn't look as good. Is this loss of quality what I'm supposed to expect everytime I export

  • GTX580 TFII artifacts with the new bios

    Hello everyone. I got a brand new sealed GTX580 TFII as a replacement for my old one that had a problem with one of the 2 fans. My previous card had the old bios installed which gave 1.00mV so the card was not stable. Finally I updated the bios from

  • Cannot view list of tables in Connections Panel

    Problem: When I click on the plus near the Tables item in the list under one particular connection in the Connections Panel I see no table list, is empty. Informations: 1. For other connections in the Panel I can see the list of tables under the Tabl