How to change VO query dynamically

Hi,
Iam trying to change the VO query dynamically. My req. is I have 6 columns in a header page 3 columns(default single column) for sorting purpose and another 3 columns(default single column) for data querying purpose.
al these are in one view so I have created one VO.
Sorting Searching
A A
B B
C C
When I give any values in Sorting and hit submit button VO query should change dynamically.
I have searched older post regarding this.
My query is some thing like this
SELECT * from cust_table where a = NVL(:1 ,a)
UNION
SELECT * from cust_table where a<> NVL(:1 ,a)
order by a
Iam trying to pas the below part dynamicaly in my AM method
vo.setWherecaluse("where a = NVL(:1 ,a)
UNION
SELECT * from cust_table where a<> NVL(:1 ,a)
order by a ")
and trying to pass the params to that query. But it is not working.Giving error "Bind variable could not find"
Can any one suggest how to solve the issue.
Thanks,
Mahesh

Hello Ajay,
THanks for your response.
My vo query is select col1,col2,col3,col4,col5,col6 from cust_table;
and and changing vo.setwhereclause dynamically based on different scenerios.
in one scenerio i need my query to be some thing like
SELECT col1,col2,col3,col4,col5,col6 from cust_table where a = NVL(:1 ,a)
UNION
SELECT col1,col2,col3,col4,col5,col6 from cust_table where a <> NVL(:1 ,a)
order by a
so can i concatenate my vo.setwhereclause like *"where a = NVL(:1 ,a) UNION SELECT col1,col2,col3,col4,col5,col6 from cust_table where a NVL(:2 ,a) order by a"*
in the setwhereclause iam setting bind variables is this method correct? Hope it is clear pleaselet me know if it is not clear I will explain in detail.
Thanks,

Similar Messages

  • How to change report query dynamically in Oracle APEX?

    Hi,
    I want to dynamically change the where condition in APEX report query. Can anyone help me solve my this problem?
    (Just want to change the query which we change in Oracle Reports using lexical parameter to change &Where, &Order by etc. dynamically!!)
    Thanks, Praful

    Hi
    I've been using flexible queries in APEX for a few years now, and your question just added a whole new dimension to the flexible and powerful nature or writing reports in APEX.
    While APEX Interactive reporting has almost completely removed the need the equivalent of Lexicals in Oracle Reports, I thought it might be fun to try and use lexicals in an APEX report.
    Before we start I should summarise the powerful capability of APEX reporting to have oprtional parameters (lots and lots of them if this is needed).
    For each parameter, you simply add a page item which will hold the value of the parameter.
    The item/parameter can be populated by typing in the value, defining an LOV, using a date-picker etc.
    To make the parameter optional simply use an OR in the where clause.
    So for a apge item P200_PARAM1.....include
    WHERE (:P200_PARAM1 IS NULL
    OR COLUMN1 = :P200_PARAM1)
    This way you can either leave the page item null or type in / select a value from a LOV.
    There is a small quirk in APEX LOV's which sometimes returns a value of '%' or '%null%' - depending on the version - when no value is selected.
    See Patrick Wolf's solution for this at Re: Null value handling in LOVs
    I include this Application Process in all my APEX applications ;)
    Now let's look at using the equivalent of Oracle Reports Lexicals......
    First-off - this is based on the APEX SQL report - NOT Interactive Report.
    It relies on the fact that you can let the query be parsed only at runtime.
    1. Define an SQL report entering the 'core' of your query.
    With a query like SELECT ENAME, JOB FROM EMP
    Select 'Generic Columns' option in the 'Column Headings' section
    Finish the report creation
    2. Define a page item - say P200_LEXICAL - type text on the page
    3. Edit the report and update the SQL query to include your lexical page item
    SELECT ENAME, JOB FROM EMP &P200_LEXICAL. (REMEMBER THE '.' AT THE END)
    Ensure that the option "Use Generic Column Names (parse query at runtime only)" is selected at the bottom of the query
    4. Add a button to the page -using 'Create a button displayed among this region's items' the will submit the page.
    5. Run the page - you will see all the employee names and job desdriptions
    6. Enter a where clause into the 'Lexical' textbox - say "WHERE ENAME LIKE 'K%'" and click the 'Go' button
    Voila! your where clause is magically applied.
    Try any variant you like adding an ORDER BY clause etc...... this is FUN!
    7. Clear the value of the LEXICAL and click go.
    Edit the report and move the &P200_LEXICAL. into the selected columns (or add another one)
    SELECT ENAME, JOB &P200_LEXICAL. FROM EMP
    8. Run the page
    Enter ",SAL" in the textbox and "Go"
    We can add as many columns as we like (subject to the "Maximum number of generic report columns:" set below the SQL query in the report edit section)
    Now because we have all the flexibility in APEX of setting page items using SQL or PLSQL you can set the value of the lexical programatically, or just pre-set a few values in an LOV - the options are limitless.
    While I've never had the need to use lexicals - you can see that APEX provides the most Flexible Lexicals in town.
    Eat your heart out "Oracle Reports"!!!
    Have fun
    Mike

  • How to change the images dynamically in a table.

    Hai,
                     How to change the images dynamically in a table based on the condition in webdynpro abap.
    Edited by: Ravi.Seela on Oct 13, 2011 2:17 PM

    This has been much discussed earlier. Do search posts.
    For your scenario i would do the following.
    inside your node which is binded to the table, i create a new node image with cardinality 1 ..1 and a attribute called path of type string.
    create a  supply function for the node image .
    Supply method now has a Element (Parent element ) and node.
    Based on your record in element, set the right image source to path attribute and bind the node.
    This will make sure that the framework calls the image supply function for every row in a table.

  • How to change the query ?

    Gurus,
    Please clarify this
    Select ils.item,(nvl(sum(decode(tdh.loc_type,'S',decode(tdh.tran_code, 1,tdh.units,0),
    'W',decode(tdh.tran_code,30,0,31,0,32, tdh.units,33, tdh.units,37,0,38, tdh.units,20,0,1,0))),0))"result"
    from tran_data_history tdh, item_loc_soh ils
    where tdh.item = ils.item
    and ils.item in('100002513','100002484')
    and trunc(tdh.TRAN_DATE)
    between (*select first_date from (select item,min(trunc(first_received)) first_date From Item_loc_soh*
    where item in('100002513','100002484') and first_received is not null
    group by item ))
    and trunc(sysdate)
    group by ils.item
    Problem with this query is, the block mentioned in BOLD is returning two rows, and I am writing between and clause .. since the query in bold is returning more than one row, it is throwing error stating that single query returns more than one row .. Requirement is, whatever date which is returned with value 100002513 should be compared with sysdate, and other value 100002484 should be compared with sysdate .. Irrespective of number of items (whether 1 or more than 1) should simultaneously be compared with sysdate
    How to change my query
    Regards

    Inner query
    Select First_Date From (Select Item, Min(Trunc(First_Received)) First_Date
                                        From Item_Loc_Soh *
                                        Where Item In ('100002513', '100002484')
                                        And First_Received Is Not Null
                                        Group By Item)
    this will return 2 rows for each of the item id 2513 and 2484 because you write query for this 2 rows
    and select min date
    which means
    item id 2513  min date
    item id 2482  min date
    if you want to compare just a date to sysdate then do it directly,
    Select Ils.Item,
           (Nvl(Sum(Decode(Tdh.Loc_Type,
                           'S',
                           Decode(Tdh.Tran_Code, 1, Tdh.Units, 0),
                           'W',
                           Decode(Tdh.Tran_Code,
                                  30,
                                  0,
                                  31,
                                  0,
                                  32,
                                  Tdh.Units,
                                  33,
                                  Tdh.Units,
                                  37,
                                  0,
                                  38,
                                  Tdh.Units,
                                  20,
                                  0,
                                  1,
                                  0))),
                0)) "result"
      From Tran_Data_History Tdh, Item_Loc_Soh Ils
    Where Tdh.Item = Ils.Item
       And Ils.Item In ('100002513', '100002484')
       And Trunc(First_Received)  = Sysdate;
    however i dont understand importance of Tdh.Tran_Date and which date you exactly want to compare
    hope this helps,
    if not plz clarify more on the questionsEdited by: Nicloei W on Sep 24, 2008 11:51 PM

  • How to change the image dynamically depend upon the input parameter

    Hi All
    I have one report running depend upon the Organization specific, I have 15 operating unit and 15 different logo for each operating unit.
    How to change the Logo dynamically depend upon the input passed by the user.
    If I have three or four logo i can add in my layout using if else statement and its works fine but i have more that 10 logos so its no possible to keep these in My RTF Template.
    Is it possible to change the logo according to the input without keeping this in Template.
    I have seen this link but its not working fine
    http://erpschools.com/articles/display-and-change-images-dynamically-in-xml-publisher
    Regards
    Srikkanth.M

    Hi,
    I have not completed fully,so sorry i cant able to share the files, could you please give me some tips and steps to do.
    Without having the logo in RTF if it possible to bring the logo depends on the user input (Ie Operating unit).
    Regards
    Srikkanth

  • HOW TO CHANGE SQL QUERY TO GET SPECIFIC RESULT

    I HAVE FOLLOWING QUERY AND ITS FUNCTIONING BUT I WANT ALL THOSE RECORD SHOULD BE DISPLADE WICH HAVE NO TRANSACTION IN SALES ANS SALES RETURN WHILE RETREVING DATA FROM DATABASE.
    I TRIED TO USE + OPERATOR BUT I DON'T KNOW HOW TO CHANGE THE QUERY TO GET THE RESULT
    MAIN TABLE IS BEING USED TO FETCH RECORD
    SALES_HEADER,SALES_DETAIL
    SALES_HEADERR,SALES_DETAILR
    STOCK_REG
    AND THE QUERY IS
    select s.item_code,S.DESCR,s.GRAND_TOTAL,
    sum(decode(d.dayno,01,NVL(S.QTY,0),0)) DAY1,
    sum(decode(d.dayno,02,NVL(S.QTY,0),0)) DAY2,
    sum(decode(d.dayno,03,NVL(S.QTY,0),0)) DAY3,
    sum(decode(d.dayno,04,NVL(S.QTY,0),0)) DAY4,
    sum(decode(d.dayno,05,NVL(S.QTY,0),0)) DAY5,
    sum(decode(d.dayno,06,NVL(S.QTY,0),0)) DAY6,
    sum(decode(d.dayno,07,NVL(S.QTY,0),0)) DAY7,
    sum(decode(d.dayno,08,NVL(S.QTY,0),0)) DAY8,
    sum(decode(d.dayno,09,NVL(S.QTY,0),0)) DAY9,
    sum(decode(d.dayno,10,NVL(S.QTY,0),0)) DAY10,
    sum(decode(d.dayno,11,NVL(S.QTY,0),0)) DAY11,
    sum(decode(d.dayno,12,NVL(S.QTY,0),0)) DAY12,
    sum(decode(d.dayno,13,NVL(S.QTY,0),0)) DAY13,
    sum(decode(d.dayno,14,NVL(S.QTY,0),0)) DAY14,
    sum(decode(d.dayno,15,NVL(S.QTY,0),0)) DAY15,
    sum(decode(d.dayno,16,NVL(S.QTY,0),0)) DAY16,
    sum(decode(d.dayno,17,NVL(S.QTY,0),0)) DAY17,
    sum(decode(d.dayno,18,NVL(S.QTY,0),0)) DAY18,
    sum(decode(d.dayno,19,NVL(S.QTY,0),0)) DAY19,
    sum(decode(d.dayno,20,NVL(S.QTY,0),0)) DAY20,
    sum(decode(d.dayno,21,NVL(S.QTY,0),0)) DAY21,
    sum(decode(d.dayno,22,NVL(S.QTY,0),0)) DAY22,
    sum(decode(d.dayno,23,NVL(S.QTY,0),0)) DAY23,
    sum(decode(d.dayno,24,NVL(S.QTY,0),0)) DAY24,
    sum(decode(d.dayno,25,NVL(S.QTY,0),0)) DAY25,
    sum(decode(d.dayno,26,NVL(S.QTY,0),0)) DAY26,
    sum(decode(d.dayno,27,NVL(S.QTY,0),0)) DAY27,
    sum(decode(d.dayno,28,NVL(S.QTY,0),0)) DAY28,
    sum(decode(d.dayno,29,NVL(S.QTY,0),0)) DAY29,
    sum(decode(d.dayno,30,NVL(S.QTY,0),0)) DAY30,
    sum(decode(d.dayno,31,NVL(S.QTY,0),0)) DAY31,
    sum(S.qty) TU
    FROM
    (select nvl(sales_detail.qty+sales_detail.bonus,0) as qty,
    sales_detail.item_code AS ITEM_CODE,
    stock_reg.descr AS descr,
    s_date as sale_date,stock_reg.GRAND_TOTAL AS GRAND_TOTAL FROM
    SALES_DETAIL,SALES_HEADER,STOCK_REG
    WHERE SALES_DETAIL.S_ID = SALES_HEADER.S_ID AND
    SALES_DETAIL.ITEM_CODE = STOCK_REG.ITEM_CODE(+) AND
    STOCK_REG.COMCODE='C1'
    UNION all
    select -1*nvl(sales_detailR.qty+sales_detailR.bonus,0) as qty,
    sales_detailR.item_code AS ITEM_CODE,
    stock_reg.descr AS descr,
    RETURN_date as sale_date,stock_reg.GRAND_TOTAL AS GRAND_TOTAL FROM
    SALES_DETAILR,SALES_HEADERR,STOCK_REG
    WHERE SALES_DETAILR.SR_ID = SALES_HEADERR.SR_ID AND
    SALES_DETAILR.ITEM_CODE = STOCK_REG.ITEM_CODE(+) AND
    STOCK_REG.COMCODE='C1') S,
    (select level as dayno
    from dual
    connect by level <= 31) d
    where d.dayno = to_char(s.sALE_date, 'DD') AND TO_DATE(S.SALE_DATE) BETWEEN '&FROMDATE' AND '&TODATE'
    GROUP BY S.ITEM_CODE,S.DESCR,S.GRAND_TOTAL

    well my query running successfully just the quesion was that i wanted to bring some changes in the query to retrieve the complete record which has no transaction in sales
    for exmple
    if i write the quey
    select dept.deptno,sum(sal) from emp,dept
    where dept.deptno = emp.deptno
    group by dept.deptno
    the recult comes as
    DEPTNO SUM(SAL)
    10 8750
    20 10875
    30 9400
    though there is another deptno which is deptno no 40
    have no sal
    and when i use this query
    select dept.deptno,sum(sal) from emp,dept
    where dept.deptno = emp.deptno(+)
    group by dept.deptno
    it shows the dept no 40 also
    DEPTNO SUM(SAL)
    10 8750
    20 10875
    30 9400
    40
    so to get this i posted query which was to long to understand easily.
    i accept that i sholud post short query to make other understand
    so check out this
    select STOCK_rEG.item_code AS ITEM_CODE,SUM(qty) as qty
    FROM
    SALES_DETAILR,SALES_HEADERR,STOCK_REG
    WHERE SALES_DETAILR.SR_ID = SALES_HEADERR.SR_ID AND
    SALES_DETAILR.STOCKCODE = STOCK_REG.STOCKCODE
    AND RETURN_DATE = '01-APR-08'
    GROUP BY STOCK_rEG.item_code
    ORDER BY TO_NUMBER(ITEM_CODE) ASC
    when i execute this query i get the following result
    ITEM_CODE QTY
    84 2
    102 3
    108 3
    116 6
    166 3
    170 3
    thoug there is other items are aalso available in stock which transaction
    yet not been done or not been sold out/
    so when i use the outer join i get the same result
    select STOCK_rEG.item_code AS ITEM_CODE,SUM(qty) as qty
    FROM
    SALES_DETAILR,SALES_HEADERR,STOCK_REG
    WHERE SALES_DETAILR.SR_ID = SALES_HEADERR.SR_ID AND
    SALES_DETAILR.STOCKCODE(+) = STOCK_REG.STOCKCODE
    AND RETURN_DATE = '01-APR-08'
    GROUP BY STOCK_rEG.item_code
    ORDER BY TO_NUMBER(ITEM_CODE) ASC
    ITEM_CODE QTY
    84 2
    102 3
    108 3
    116 6
    166 3
    170 3
    hope i tried to make u understand on better way

  • How to change destination table dynamically in configuration file in ssis?

    hello,
            i have a package i am having one data flow task.in data flow task i have one source and one destination.source and destination are different.i have created xml configuration file by configuring source and destination connection
    strings.
    now i want to change destination in the same server to different database with out opening the package.i want to directly change in the config file.we can change it by modifying configured value proerty and intial catalogue value.but if the table is not
    existed in the changed database.how we can create it dynamically.

    HI jiri Neoral,
                       thanks for reply,as you said above process by this we can do change only databasename.if in my destination database,the table which i used in package is not existed,can we create it dynamically
    using config file.later changing table name is possible?
    For that you need to have a step in SSIS package prior to data flow task to check if table exists and if not create it
    You can use  execute sql task with query like below
    IF OBJECT_ID('TableName') IS NULL
    CREATE TABLE TableName
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • How to change VO's dynamically for a item for each row in advanced table?

    Hi All,
    We had a requirement to filter the employees based on the search criteria table. I am using advanced table for developing search criteria.
    In that table I am having three columns. Operator (messagechoice), Criteria Type (messagechoice), and Criteria value (messageLovInput). Also 'Add Another Row' functionality is available.
    My requirement is:
    First Row:(Initial Row)
    When the user selects a value in Criteria Type, only the values that are relevant to that type should be displayed in the Criteria Value.
    Second Row: (when the user selects Add Another Row button)
    When the user selects a value in Criteria Type, only the values that are relevant to that type should be displayed in the Criteria Value.
    The problem I am facing here is, the Criteria Value column is pointing to only one VO at design time. But wee need to change that VO dynamically without disturbing other rows depending on the Criteria Type value.
    Is it possible to do so?
    Note: User can add n number of conditions as he want.
    Can anyone help how to acheive this.
    Regards,
    Sundeep.

    Check Dynamic Poplist section under Standard Web Widgets in Chapter 4 of OA Framework Developers guide.

  • How to build a query dynamically....

    hi...i want to build a query dynamically. i don't want to build query by using string buffer. i want to create it directly by using sql query itself.
    my situation is like this....i have four drop down list in a page. The user can search the things based on one or two or three or four selected values.
    how to build a query for this kind of situation....pls let me know.
    Edited by: success_shiva6mca on Mar 3, 2008 12:39 PM

    there are two problems with building sql directly.
    1. it allows sql injection
    2.it allows XSS
    google them and you will understand if you dont already.
    I will recoment catching the values and using preparedStatements

  • How to change a TAB dynamically to be the active tab?

    Hi,
    I have a portlet written in Java and registered using a web provider. This portlet exposes a link which drives the content of another portlet through parameters&events.
    This other portlet is placed on the same page but on a different TAB (!).
    What I want is, when clicked on the link in Portlet1, this changes the content of the Portlet2 (via an event and parameter - that works) AND should change the TAB, so that the TAB which contains the Portlet2 is active and shown.
    I couldn't figure out, how to change the TAB with an event or any other way. I can easily change the page through an event, but not to a tab on the same page. Do I overlook something or can I just don't use events for this?
    Is there any API function which does changing tabs or getting the tab id or is there any other programmatic workaround to do dynamic tab changing?
    If so, can someone point me to a code fragment?
    Any help would be much appreciated.
    Cheers,
    Erik

    A work around may be to change the location.href to the url of the tab you want to switch to.
    Have you tried that already?

  • BEx: How to change a Query Variable that is not visible in Filters List?

    Hello Experts,
    Good day, I'm currently editing an old query, I am changing the Query Variables with new ones, but I found one variable that I cannot replace.
    Please see the screenshot below, in the Query Properties Window [Variable Sequence Tab (right side of picture)] the Variable that I am trying to replace (Unit) is visible. But when I look for the variable in the "Filter Tab" (left side of picture) under Characteristic Restrictions, it doesn't exist in the list.
    How can I find this Variable and replace it with a new one?
    Other reports are still using this variable so it will impact the other reports if I simply edit the variable. So I need to replace it with a new variable instead.
    Thank you for your time.

    Hi,
            SInce you are searching for a variable for Unit, look into below screenshot and navigate to the variables.
    First click on drop down and select 'Entry for variable' then you will get lisl (after you click on drop down in 'Target Unit' drop down option.
    Normally these type of variable called 'Formula Variable' try editing any of the formula and locate the option as shown below,
    Hope it helps! don't forget to update the final solution and mark the correct/helpful answers.
    Remember it will help others to find the solution and motivate the members to answer your question.
    Thanks,
    Umashankar

  • How to change a Query in a DataProvider

    Hi.
    I am trying to chante DataProvider´s Query during runtime. I have tried this:
    Did anyone could help me?
    Thanks

    Hi.
    I have tried your suggestion but i got the same error.
    Something like this: "The filter´s item RADIOGROUP_1 specified a not valid characteristc 41I6LBPF9JKHCC5YLXH9LXC0Z"
    This characteristc (41I6LBPF9JKHCC5YLXH9LXC0Z) is set to the radiogroup during the development of the template, but when i use the following command:
    It seems like system get lost when i change the DataProvider´s Query to one which not have that characteristic. That command should change the Query and the RadioGroup´s IOBJNM, but seems that only the Qurey is changed.
    Do you have any idea how to solve this problem?
    Thanks

  • How to change the font dynamically in SAP script

    Hello,
    There are three fields for a line item to be printed in SAP form (Through Script). The font of one field has to be bigger than rest of the two.
    Can anybody tell me how to change the font of a specific field in a line of an SAP-script?
    Regards
    Kiran

    Hi,
    Its like any other character format. you can have any field with a character format.
    --Ragu

  • How to change the query of detailVO,

    Hi,
    I have 2 VOs, say HeaderVO and LinesVO, these VOs are used to create a view link - HeaderToLinesVL - HeaderVO is Master VO and LinesVO is DetailVO. These VOs and VL are used in HGrid. Depending on the search criteria entered by user I have to change the query of HeaderVO and LinesVO. I am able to change query of HeaderVO using setQuery, but when setQuery used on LinesVO, it is throwing an exception saying Query can't be changed because it is detail VO. Is there any other way to change the query. Or any other idea to implement this functionality.
    Thanks
    Shaneed

    Hi,
    I have 2 VOs, say HeaderVO and LinesVO, these VOs are used to create a view link - HeaderToLinesVL - HeaderVO is Master VO and LinesVO is DetailVO. These VOs and VL are used in HGrid. Depending on the search criteria entered by user I have to change the query of HeaderVO and LinesVO. I am able to change query of HeaderVO using setQuery, but when setQuery used on LinesVO, it is throwing an exception saying Query can't be changed because it is detail VO. Is there any other way to change the query. Or any other idea to implement this functionality.
    Thanks
    Shaneed

  • How to change varient values dynamically in APD

    Hi Friends,
    I have created an APD ,to this APD i am feeding 4 query out puts.For this 4 querys i am using the varients, i wante to change the varient values i.e date field/date ranges fields dynamically.pl.let me know if any b'dy worked such scnarios.
    Thanks in advance.
    Sirisha.

    sk_java wrote:
    Hi,
    I need to know how we can change the values of annotation dynamically.Annotations in source code must be compile-time constants. The annotation objects returned by the runtime are immutable.
    That said, there are a few ways to get the effect of changing annotation values. First, you can use the redefine classes API and then getting a new annotation object will have the updated values. Also, an annotation type is just a specialized kind of interface and that interface can be implemented by your own classes too.

Maybe you are looking for