Query Of Query Not Working

What is wrong with this query of query... Basically it seems like the "IF" logic in the select statement isn't looking at the current results, but instead the first line of the AllCategories() query.  Any ideas would be much appreciated.
    <cffunction name="getCategoryDetail" returntype="query" >
        <cfargument name="CategoryID" default="">
        <cfset AllCategories = Application.Celerant.QueriesCached.getAllCategories()>
        <cfquery name="CategoryDetail" dbtype="query" >
            SELECT
                <cfif AllCategories.typ eq 'EMPTY'>
                    'DEPT' as ThisLevel,
                    AllCategories.Dept as ThisName
                <cfelseif AllCategories.subtyp_1 eq 'EMPTY'>
                    'TYP' as ThisLevel,
                    AllCategories.typ as ThisName
                <cfelseif AllCategories.subtyp_2 eq 'EMPTY'>
                    'SUBTYP_1' as ThisLevel,
                    AllCategories.subtyp_1 as ThisName
                <cfelseif AllCategories.subtyp_3 eq 'EMPTY'>
                    'SUBTYP_2' as ThisLevel,
                    AllCategories.subtyp_1 as ThisName
                <cfelse>
                    'SUBTYP_3' as ThisLevel,
                    AllCategories.subtyp_1 as ThisName
                </cfif>
            FROM
                AllCategories
            WHERE
                AllCategories.web_taxonomy_id = #arguments.CategoryID#
        </cfquery>
        <cfreturn CategoryDetail>
    </cffunction>

Basically it
seems like the "IF" logic in the select statement isn't
looking at the current results, but instead the first line
of the AllCategories() query. 
That is exactly what is happening. The IF is not evaluated within the QoQ. It is evaluated once, before the QoQ executes, using the values in the first record of the query.
QoQ are very limited. AFAIK they and do not support that kind of logic. So you must loop through the query, one row at a time, and calculate the desired values.

Similar Messages

  • Query level filter not working in Webi report

    Hi All,
    I am using BOXI R3.1 (SP3), m facing one problem when refreshing Webi report on daily basis. I am using three query level filter as a prompt, but i checked one filter is not working then i need to reapply this filter and rest 2 filter is working fine.
    Can anyone suggest me why problem is coming?
    Regards,

    Hi,
    Prompts are interactive, and come from the query panel. Filters are not interactive, and are set on the report or block. There are also input controls, which are interactive filters
    1. Select the universe in the list of universes to open the Query Panel.
    2. Drag the Year object to the Result Objects pane.
    3. Drag the Number of Guests object to the Query Filters pane and create a report filter that restricts Number of Guests to greater than n.
    4. Click Combined Query.
    The Combined Query pane appears in the bottom left of the Query panel with the two queries joined by UNION.
    5. Click on the second query and remove the Year and Number of Guests objects.
    6. Drag the Reservation Year object to the Result Objects pane.
    7. Drag the Future Guests object to the Query Filters pane and create a report filter that restricts the future guests to greater than n.
    8. Click Run Query.
    Best Regards
    Naveen

  • Query remote table not working in PL/SQL

    I have a problem that is killing me to figure out. Basically we trying to query a remote table through PL/SQL and it comes back with invalid column name for the table. But the table exists in the remote database and has the column. The query works fine from the same database outside of PL/SQL, just not in PL/SQL. I'll setup a test case below.
    We have local database called DB1 and remote database called DB2. The table we are querying is called EMP.
    First we create database link:
    create database link DB2.WORLD connect to...
    Test the link:
    select ENAME from [email protected];
    ENAME
    SHAWN
    Works fine.
    Now we put this query inside a PL/SQL block:
    declare
    l_ename varchar2(20);
    begin
    select ename into l_ename from [email protected];
    end;
    This fails with the following error:
    select ename
    ERROR at line 274:
    ORA-06550: line 274, column 7:
    PL/SQL: ORA-00904: invalid column name
    ORA-06550: line 271, column 3:
    PL/SQL: SQL Statement ignored
    ORA-06550: line 279, column 9:
    PL/SQL: ORA-00904: invalid column name
    ORA-06550: line 277, column 3:
    PL/SQL: SQL Statement ignored
    Now, I've tried changing how we select from the remote table, I've put the select statement in a cursor, tried creating a synonym which points to the remote table and selecting using the synonym in PL/SQL, it always returns the same error. But always works outside of PL/SQL.
    Now the user we are connecting to the remote database as, has select on the EMP table, through a role, along with 30 other tables, all the other tables are able to be selected through the database link, in PL/SQL, it's just this one table.
    Additionally I can go to another database, and create the same database link, and the query in PL/SQL works fine to the remote table. It's just this one table, from this one database, that doesn't work just in PL/SQL. Any ideas would be appreciated, I've exhausted everything.
    Also, creating a copy of the table using "create table as select * from..." we can select from the copy of the table using PL/SQL through the database link. The problem is this is a central warehouse table, and is used my multiple applications and updated constantly, so dropping a recreating this table is a last resort.
    Yes, this process did work, for over a year, then suddenly it stopped. Of course, no one made any changes to either database, that's always the case. I know the code didn't change though, it was still timestamped from a year ago.
    Thanks in advance.

    Could this be a variant on an old favourite, viz privileges being granted through roles. We cannot use objects in PL/SQL if our privileges are assigned through a role.
    Maybe what has changed is that instead of being granted privileges on EMP@DB2 directly the privileges have been re-organised so that your user has them granted through a role.
    Cheers, APC

  • Passing Mutivalue Constant Query Filter is not working

    Hi All,
    I am using Webi4.0.On the Query panel when I try to pass multiple values to a constant filter it does not work.For example if I try to apply State filter in my Query and if I select Constant as its type and type A,B then Webi takes only A in the query and not B.
    I know it a simple task but however it is not working.
    Any help on this will be appreciated.
    Thanks in advance.

    Hi Riddhi,
    Can you pls put scrrenshot how you are passing multiple value to filter.
    ~Anuj

  • XMII Query Selected tags not working

    I am using a query template for tag list against a UDS PI server and the "Selected Tags" dos not seem to wok. It retuns all tags or masked ones even when the check box "Use Group.Mask .....'  is unchecked.
    The UDS does not have groups since the alias tool  doesn't seem to allow wildcarding accomadating future tags.
    Product Version: 11.5.3 b66
    Thanks, Ed (for Shari)

    Hi,
    As Jeremy said, 'Use Group or Mask for Tag selection' is used for Current, History, HistoryEvent, and Statistics query modes. For namespace query modes such as TagList/GroupList it will not work. Please find the below link for you help:
    http://help.sap.com/saphelp_xmii115/helpdata/en/index.htm
    Hope it helps!
    Best Regards,
    Kedar

  • SQL Query Single Row not working

    My workflow contain a Query Single row activity. I have added a where clause in Arabic which is not working. If I remove the Arabic condition its working.
    Is there something to do with the server?
    My server is windows 2008 R2 Server.
    The same workflow is running perfectly on another identical environment.
    Thanks for any valuable suggestions,
    Nith

    Hi Sastry,
    Connection to the database is trough Pivotal, I have tried ODBC connection as well but same error
    The instruction at "0x005d53e0" refereced memory at "0x00000014'. The memory could not be "read".
    With ODBC I have always compilation error saying
    Query Engine Error: '42000:[Microsoft][ODBC SQL Server Driver][SQL server] Incorrect syntax near the keyword 'SELECT'. '.
    but even the simple select statment is showing the error.
    Do you think the error is with Drivers???
    Regards
    Stefan

  • LOV in the Query Panel is not Working

    Hi Everyone,
    I dont see the LOV working in the Query Panel but it works in the table region, I am able to open the LOV and search some value and when i say ok it wont return any value... Do anyone have idea on that?
    Thanks

    Can anyone help me on this? Am really confused....
    Thanks..

  • Dynamic Interface in Query String does not work?

    Hi All,
    i have exposed a interface as a webservice with the help of the Define Web Service in Configuration Builder.
    In the SOAP Sender Communication Channel i have checked the options Use Encoded Headers and Use Query String
    The url of the webservice looks like this:
    http://server:50000/XISOAPAdapter/MessageServlet?channel=:BS:CC_SOAP_SENDER&version=3.0&Sender.Service=BS&Interface=http%3A%2F%2Fnamespace.com%2Fabc%2HER%2FGlobal%5EMIOS_GetDetails
    This works which is great, i can now retrieve supplier details with this webservice. Now i want to expose another interface as a webservice. That URL looks like this:
    http://server:50000/XISOAPAdapter/MessageServlet?channel=:BS:CC_SOAP_SENDER&version=3.0&Sender.Service=BS&Interface=http%3A%2F%2Fnamespace.com%2Fabc%2HER%2FGlobal%5EMIOS_EventBooking
    As you can see i have a different interface in the URL's of the Webservices. I want to have both make use of the same Communication Channel which is possible according to [SAP Note 856597|https://websmp130.sap-ag.de/sap(bD1ubCZjPTAwMQ==)/bc/bsp/spn/sapnotes/index2.htm?numm=856597] See Q: Can I set the interface name dynamically from the client? also in this document : [How to Use the XI 3.0 Soap Adapter|https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/d23cbe11-0d01-0010-5287-873a22024f79]
    The problem is that when i try to call the second web service (EventBooking) that is routes to the mapping of the GetDetails interface, i can see this in SXMB_MONI. Therefore it gives an Error.
    When i try both scenarios in Configuration Builder they both work fine, only the webservice call of EventBooking ends up in the Message Mapping of GetDetail.... Why? And how to solve this?
    Anyone have experience with the feature mentioned in the SAP note?

    After some further examination it seems that both calls are picked up by the same interface. In the RWB both the messages are picked up by the MIOS_GetDetails...
    How can i fix this?

  • 2.1.0.62: Exporting query results does not work if SQL has a join

    I get an error message, when I try to export the following test case to any data format.
    create table test1 (id number(2), text varchar2(5));
    create table test2 (id number(2), text varchar2(5));
    insert into test1 values (1,'test');
    insert into test2 values (1,'test');
    select t1.*
    from
    test1 t1,
    test2 t2
    where
    t1.id=t2.id;
    I try to translate my german error message to english:
    "There are no valid columns for export available. Clob- or Blob-Columns are currently not supported"
    I get this message, when I right click into the query result grid and select export and then any data format.
    Hope that is not a double post but searching for export did not find results for 2.1.
    The following SQL also produces the error:
    select t1.* from test1 t1;
    These SQLs can be exported though:
    select * from test1 t1;
    select t1.id from test1 t1;
    I should have mentioned that I work with Windows XP and Oracle 10.2.0.4.
    Regards,
    dhalek
    Edited by: dhalek on Oct 13, 2009 5:04 PM

    Hi,
    Dhalek.
    I've got the same problem here.
    In my SQL Dev, I disabled the Autopopup code completion insight in SQL Worksheet. (Tools - Preferences - Code Editor - Code Completion - untick the checkbox). Restart SQL Dev. Tried to export a query.
    The same error message appears.
    My workaround is to re-enable the autopopup and restart SQL Dev.
    The disabled autopopup code completion insight caused me these
    2.1 EA1: Bugs - cannot Export Data from Grid
    2.1 EA2: Bugs on code completion for displaying column name
    Hope this helps,
    Buntoro

  • Re-Query Iterator is not working (I tried everything)

    Hi,
    I'm trying to re-query an iterator with not luck, the first time it works well, but the second time it return the same data, this is the actual code:
        private static Row[] getSystems(String releaseId) {
            BindingContainer bc = BindingContext.getCurrent().getCurrentBindingsEntry();       
            OperationBinding op = bc.getOperationBinding("ExecuteWithParams3");
            op.getParamsMap().put("param_id", paramId);
            op.execute();
            DCIteratorBinding iter = (DCIteratorBinding)bc.get("Iterator");
            Row[] mappedSystems = rowSetItertor.getAllRowsInRange();
            return mappedSystems;
        }I tried things like this:
    In the property inspector set the iterator's refresh property to never never and cache to false false, the result its that the first time everything is fine, second time I don't have more info at the iterator.
    Call this metods:
    // Nothing
    iter.executeQuery();
    // It clears the data, but after that I can't obtain data from db.
    iter.getViewObject().clearCache();
    // Nothing
    iter.getViewObject().resetExecuted();
    // Nothing
    iter.executeQuery();
    iter.refresh(DCIteratorBinding.RANGESIZE_UNLIMITED);
    // Nothing
    iter.setRefreshOption(0);
    //Nothing
    iter.setRefreshOption(8192);
    // Tried to close the iterator set, second time it doesn't contain anything.
    RowSetIterator rowSetItertor = iter.getRowSetIterator();
    Row[] mappedSystems = rowSetItertor.getAllRowsInRange();
    rowSetItertor.closeRowSetIterator()Basically when the user clicks a button this code is call with the appropriate parameter, this must retrieve a row's list. This code is called in a ManageBean with TaskFlow scope.
    Any help would be great, thanks in advance.
    -Daniel
    P.S JDeveloper 11.1.1.4.0 & I also tried all the suggestions listed in this thread: Refresh Vo Iterator
    Edited by: 910260 on Jan 25, 2012 2:49 PM

    I did this but nothing (because I need to send the "param_id").
    private static Row[] getSystems(String releaseId) {
            BindingContainer bc = BindingContext.getCurrent().getCurrentBindingsEntry();       
            OperationBinding op = bc.getOperationBinding("ExecuteWithParams3");
            op.getParamsMap().put("param_id", paramId);
            op.execute();
            DCIteratorBinding iter = (DCIteratorBinding)bc.get("Iterator");
            iter.executeQuery();
            Row[] mappedSystems = rowSetItertor.getAllRowsInRange();
            return mappedSystems;
        }The properties for the iterator were Refresh = referred (default) and Cache Results = true. // Nothing
    And Refresh = never and Cache Results = false // Nothing.
    Edited by: 910260 on Jan 25, 2012 2:48 PM
    Edited by: 910260 on Jan 25, 2012 2:52 PM

  • Text valriable in Query Description is not working in Bex Broadcaster

    Hello Experts,
    I am using Bex broadcaster setting to displaying Query Description through text variable availabe as <OBJECT_DESCRIPTION> in subject of boradcasted mail.
    In Query Description I have used text variable at the end to display previous month/year i.e "Report &ZPREV&" .
    Text variable with description is working fine in RSRT/ Analyzer, I am able to see description as "Report 201012" but the same description displays "Report &ZPREV&" in the subject line of broadcasted mail i.e. text variable is not getting assigned with desired value and technical name appears.
    Thanks,

    this problem may arise due to non-assignment of text variable to the any of the characteristics you using the  year so, REFER THE TEXT VARIABLE TO THE FISCAL YEAR . WHICH IS IN  TIME CHARACTERISTICS.
    HAVE YOU CREATED ANY OFFSET VARIABLE,  CREATE A VARIABLE FOR THE FISCAL YEAR  AND CREATE OFFSET TO THE VARIABLE AS -1 THEN  YEAR  WILL YEAR-1   ,   THE TEXT VARIABLE YOU CREATED WILL REFER TO THE FISCAL YEAR SO THE  PREVIOUS YEAR VALUE OF THE TEXT VARIABLE WILL THE YEAR = YEAR - 1.

  • Nested SQL Query in CR10 not working

    Hi
    I have a SQL query See below but crashing CR
    SELECT     ax_Staff.ax_Name, ax_Staff.ax_Reference_Number, ax_Licence.Rn_Descriptor, ax_Licence.ax_Expiry_Date, ax_Department.ax_Name AS Department
    FROM         ax_Staff INNER JOIN
                          ax_Department ON ax_Staff.ax_Department_Id = ax_Department.ax_Department_Id LEFT OUTER JOIN
                          ax_Licence ON ax_Staff.ax_Staff_Id = ax_Licence.ax_Staff_Id
    Where ax_Staff.ax_Reference_Number not in (SELECT     ax_Staff.ax_Reference_Number
    FROM         ax_Staff INNER JOIN
                          ax_Licence ON ax_Staff.ax_Staff_Id = ax_Licence.ax_Staff_Id
    WHERE     (ax_Licence.Rn_Descriptor LIKE 'Driving Licence - Rider (R)'))
    ORDER BY Department, ax_Staff.ax_Name
    The query is working on MS SQL server 2005 and giving results as I want, but I have problem to recreate this in CR.Can anybody help how to creat the report???? where Looking for list of Staff who has no Particular Licence
    Sample of the report:
    GH1: Administarion
    GH2:  Peter Brown StaffID 4442 --- THIS Group IS OK to be on the list
    GH2:     John Smith StaffID 4444 -
    THIS whole GROUP NEEDS TO BE SUPPRESED or EXCLUDED
    Details:  Driving Licence Car (C)
      Details: Driving Licence Rider (R)   --this record passed condition
      Details: Driving Licence HR  (HR)                        
    GH2:  Julia Ng StaffID 4446 --- THIS Group IS OK to be on the list
    Details:  Driving Licence C
    I have 3 tables
    Department
    Staff
    Licence

    Hi Sastry,
    Connection to the database is trough Pivotal, I have tried ODBC connection as well but same error
    The instruction at "0x005d53e0" refereced memory at "0x00000014'. The memory could not be "read".
    With ODBC I have always compilation error saying
    Query Engine Error: '42000:[Microsoft][ODBC SQL Server Driver][SQL server] Incorrect syntax near the keyword 'SELECT'. '.
    but even the simple select statment is showing the error.
    Do you think the error is with Drivers???
    Regards
    Stefan

  • Export in Query Ready mode not Working.for FR reports in HTML view

    Hi,
    When we run the FR reports in HTML view in Workspace,there is an option at the bottom to "Export in Query Ready mode",it's not exporting the report in Smart view excel .
    But some of our users are able to export the report in SV.We are using EPM 11.1.1.3. I have checked the IE 7 settings with other users and it's same.
    Does anybody has any idea what could be the cause?
    Thanks in advance.
    BC

    It is the behavior, Query ready mode will only pulls the members which are in Essbase (no FR calculated fields)
    Regards
    Celvin
    http://www.orahyplabs.com

  • Query SQ07 Translation not working for default text

    HI Experts,
    In a query created with EN as default language, when execute - the selection screen will show the tiltle text (such as - Report-Specific Selection, Output Specification & Layout)
    I am unable to translate these selection text to other language using SQ07.
    When execute in different language - all text are translated except these 3 still remains in EN.
    Do you know where can I change the text?
    Should it not be standard and being translated automatically when log on to different language?
    Kindly advice.
    Thank You

    Thanks Sajid,
    But are you suggesting to go into the program which was generated by SAP once created the query and do a change mode in SE38 ?
    Isnt it not encourage to change from there & we need to register the object and get the access key ?
    Correct me if i am wrong.
    Any suggestions ?
    Thank You.

  • Query "magnifying" glass not working on forms - 1 workstation

    I have a single workstation that  has suddenly stopped showing the small magnifying glass that can be clicked and runs saved queries.   
    Example - we have a query that generates a new BP code - when you bring up the BP master data form it usually shows a magnifying glass - you click the magnifying glass and it populates the field with data.
    This is isolated to a single workstation, not a single user.
    Is there a local setting in the B1 software that may have accidently been turned off?  We also had a problem a week ago on this same workstation where usability package would not launch properly.  Our VAR deleted the temp folder which he said sometimes gets corrupted and it seemed to "fix" the issue.
    Any suggestions?  DNR B1 again?

    The temp files seemed to be corrupt...It made no difference in the pickers display or any of the other options - i was unable to delete files in the temp directory....I reloaded the workstation with a clean copy of windows and now all is operating normally.  FYI - the software is very picky about your .net framework...i was getting strange errors trying to connect to the SQL server until i had at least V2.xxx .net.
    Thank you to all for your response and help.

  • QUERY ONLY = YES not working when set in CUSTOM.pll

    Hi,
    Depending on the responsibility the user is logged on as I have set the element entries form PAYWSMEE to query only = yes within the custom.pll. This seems to work in so far as the elements screen is display-only but when i go into the entry values they are updateable. I have tried setting query only at WHEN-NEW-BLOCK-INSTANCE event and also on WHEN-NEW-FORM-INSTANCE but same results.
    Would really appreciate any help.
    Lorcan.

    EBS questions should be asked in the EBS Forum.

Maybe you are looking for