Checking exsistance of query inside a struct

in CF 7
I want to do this...
<cfif isdefined('variables.getReport["STATUS"][1]')>
<!--- do stuff --->
</cfif>
But it seems CF does not like this convention. Even though its happy enough to use the same convention NOT within a isdefined statement.
Any ideas how else I could test for the existance of 'variables.getReport["STATUS"][1] ?

Is defined takes a string and checks to see if there are any variables named with the same string.
"variables.getReport" is the variable name.
["STATUS"][1] are a structure key and array index of that variable, but has nothing to do with the variable name.
<cfif isDefined("variables.getReport") AND
      structKeyExists(variables.getReport,"STATUS") AND
      arrayIsDefined(variables.getReport["STATUS"],1>
Is how one might check all three layers of that variable.
Message was edited by: ilssac     Sorry, arrayIsDefined() was added in CF 8, rereading I see you are on CF7.  Until you update, you would have to use something like "arrayLen(variables.getReport["STATUS"]) GTE 1" for the third test.

Similar Messages

  • Reg: Check View/MView query -

    Hi Experts,
    I'm trying to search for all references of a Table (in ALL_SOURCE). But not able to check into the query of VIEWs and MVIEWs.
    ALL_VIEWS and ALL_MVIEWS have LONG columns called TEXT and QUERY respectively.
    Any pointers how can I search into these columns?
    Help much appreciated!
    Ranit B.

    You can use all_dependencies
    SELECT *
      FROM all_dependencies
    WHERE type = 'VIEW'
       AND referenced_owner = 'TABLE_OWNER'
       AND referenced_name = 'YOUR_TABLE';Or you can have a look at Long to Varchar2 conversion....

  • Index in Query inside Stored procedure

    How to put a index on Select query inside a stored procedure.Please help me on below to write a index
    Coalesce ((select sum (ICD.mAmount)
    from ItemCommonData ICD (Index(PK_ItemCommonData))
    Join ItemsInBundle IIBun on
    (ICD.iBundleDocId = IIBun.iBundleDocId) and
    (ICD.iDocId = IIBun.iDocId)
    Join ItemsInBlock IIB (Index(ItemsInBlockbyBlockDoc)) on
    (ICD.iDocId = IIB.iDocId)
    where (Bundles.iDocId = ICD.iBundleDocId
    and IIBun.fDeleted = False
    and IIB.iBlockId = iBlockId)),

    Are you migrating to Oracle SQL and PL/SQL?
    Anyway, you don't define an Index on the fly in Oracle. You create them ahead of time on the table. You can use hints to manipulate the query into using a certain execution path.

  • Select query inside PL/SQL block.

    Hello Experts,
    I am just a beginner with PL/SQL.
    If I write a select query from client like SQL dev and fire it against a database, it gives me result.
    Eg: select * from employee;
    Now when I use the same Query inside a PL/SQL block suppose:
    Declare
    begin
    select * from employee;
    end;
    This gives error on execution, mentioning that an INTO is expected etc...
    I have doubts here:
    1. Can't I use a plain select inside a PL/SQL block (if so why?)
    I know this is kind of very basic question, I tried searching this on the forum but could not find the thread, please redirect me to the link if this is already answered.

    user8578271 wrote:
    Hello Experts,
    I am just a beginner with PL/SQL.
    If I write a select query from client like SQL dev and fire it against a database, it gives me result.
    Eg: select * from employee;
    Now when I use the same Query inside a PL/SQL block suppose:
    Declare
    begin
    select * from employee;
    end;
    This gives error on execution, mentioning that an INTO is expected etc...
    I have doubts here:
    1. Can't I use a plain select inside a PL/SQL block (if so why?) Because when you run a query in a tool like SQL Developer, or SQL*Plus or TOAD etc. then it opens up a cursor and fetches the data into internal memory structures before displaying it, and that is all done automatically and hidden from you. In PL/SQL, there is no interface to display the results of SQL queries, so you have to specifically tell it what to put the data into.
    The syntax is (in basic terms)...
    SELECT column1, column2... columnX
    INTO variables or record structure
    FROM ...Though that can only select a single row of data. If your query returns more than 1 row it will give a TOO_MANY_ROWS exception. If your query returns no rows you will get a NO_DATA_FOUND exception.
    If you need to select multiple rows into variables etc., then you would need to "BULK COLLECT" into a collection/array structure, though this takes up valuable memory on the server and shouldn't be used unless necessary (and you understand the implications of doing it).

  • Authorisation check in ABAP Query..

    Hi Gurus
      Can we put Authorization check in ABAP Query ?
    Your help is appreciated.
    Regards,
    Gajanan

    Hi,
    Please check this online document on how to setup authorization for SAP query.
    http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCSRVQUE/BCSRVQUE.pdf
    Regards,
    Ferry Lianto

  • Execute Query inside an @Entity

    Hi All,
    I would like to execute a relative query inside an entity.
    For example: A 1:n B. Now I want a way to create a method in A like. A.getBCount(). Which executes a query on B.
    Something like: selectet Count(*) from B where b.parent = :a;
    Is there a way to have a @transient method in A to work with relatitionships in a different manner, then A.getBList().size(). I dont feel its performant as you need to fetch greedy on BList just to get the size of B :\
    Any Idea or example?

    you cannot do so, im afraid, you have to create query outside of entity

  • Authority Check to a Query

    HELLO,
    I am trying to introduce an authority check in a query, to do this I use the SQ02 transaction but I have 2 problems:
    1.- I can't change the At selection-screen module
    2.- If I change the Start Of Selection, then I save the code and finally I generate the infoset but I can`t see the modifications in the query.
    Do you Know what can I do to solve this problem?
    Thanks

    I think you don`t understand me.
    I have put ZTCO_SOLTRAS_CAB-BUKRS in the GoTo ..., it works correctly, but it is not my problem. My problem is:
    before I modified the query, the query read the field SP$00001(a select options) and get all the bukrs between the SP$00001-low and the SP$00001-high . Then I had to put a new field s_bukrs in the selection screen and now the user put the bukrs in muy new field, in that way I can check the authrity perfectly; so up to now all is correct...
    but the problem arrives in order to show the query results,  it doesn't matter what values fill the user in my field (s_bukrs) because the query still uses the SP$00001 field to filter data.
    An example:
    The user introduces the values 'A41' in the SP$00001-low and 'A43' in the SP$00001-high.
    I get those values and I check the authority. Imagine tha the user can see all the bukrs and the query goes on.
    Here is the problem!!!!!!!!!!! The query continuous (and it was code so) and in order to show the bukrs, goes to the field SP$00001 to filter data.( I can´t modify this code....) SP$00001 is empty so the query shows all the bukrs and the user only want to see bukrs between A41 and A43
    Do you understand me now?
    Thanks a lot, yo are helping me a lot!

  • Can i check for invalid chars inside characters () method

    Hi There
    Cani check for invalid charcaters inside characters() method of SAX api so as to take care of invalid charactrers that mey come up while parsing an xml file from the internet
    Thanks
    Mum

    Hi DrClap
    Thanks for responding.But i have no control on the encoding of the xml file that is coming to me
    So i will be thankful to u if u could just tell me if there is any way in which i can change the encoding format used for parsing the xml file so my parsing process reaches its logical end
    Thanks
    Mumtaz

  • [SSRS] Abnormal behavior for parameter usage in checking case within query of dataset

    Details :
    Following error is displayed when I preview a report (SUR_EXPLORER-NG.rdl) in Microsoft Visual Studio:
    “An error occurred during local report processing.
    An error has occurred during local report processing.
    Cannot set the command text for dataset 'GET_FDA_CONFIG_ID'.
    Error during processing of the CommandText expression of dataset 'GET_FDA_CONFIG_ID'.”
    Following is the query set in dataset 'GET_FDA_CONFIG_ID':
    =IIF(
    Parameters!IN_Dimension.Value = -1,
           "SELECT -1 AS FDA_CONFIG_ID FROM DUAL WHERE :H_IN_InstanceId = :H_IN_InstanceId",
           "SELECT RA_SUMM_RECON_MEASURE.FDA_CONFIG_ID AS FDA_CONFIG_ID FROM RA_SUMM_RECON_MEASURE, RA_SUMM_RECON_HISTORY WHERE RA_SUMM_RECON_MEASURE.RECON_ID
    = RA_SUMM_RECON_HISTORY.RECON_ID AND RA_SUMM_RECON_HISTORY.SUMM_RECON_INSTANCE_ID = :H_IN_InstanceId"
    As a trial, I change the report parameter used in the checking condition as follows (SUR_EXPLORER-OK.rdl):
    =IIF(
    Parameters!H_IN_InstanceId.Value = -1,
           "SELECT -1 AS FDA_CONFIG_ID FROM DUAL WHERE :H_IN_InstanceId = :H_IN_InstanceId",
           "SELECT RA_SUMM_RECON_MEASURE.FDA_CONFIG_ID AS FDA_CONFIG_ID FROM RA_SUMM_RECON_MEASURE, RA_SUMM_RECON_HISTORY WHERE RA_SUMM_RECON_MEASURE.RECON_ID
    = RA_SUMM_RECON_HISTORY.RECON_ID AND RA_SUMM_RECON_HISTORY.SUMM_RECON_INSTANCE_ID = :H_IN_InstanceId"
    Then the mentioned error message is not shown (of course I can’t get desired report generated as the logic is incorrect).
    Besides, I try with other report parameters but the mentioned error message is not shown.

    Hi chrisd921,
    According to your description, you want to do a dynamic query based on parameter select in your report dataset. Right?
    In Reporting Services, if we use query to retrieve data when creating dataset, this query will only be processed one time during report processing. So we can't make it change to another query after we change the parameter selection. And we can't combine
    the data from two query together in a dataset, because in a dataset, if multiple result sets are retrieved through a single query, only the first result set is processed, and all other result sets are ignored. For your requirement, it can't be achieved currently.
    In this scenario, we suggest you add one more column, and put in "-1" in detail row. Then control the visibility to show either "-1" or report data.
    Reference:
    Report Embedded Datasets and Shared Datasets (Report Builder and SSRS)
    If you have any question, please feel free to ask.
    Best Regards,
    Simon Hou

  • How to check the sql:query is return null value

    I have use :
    <sql:query var="sql1" dataSource="${db}">
    select col_name from table_name
    where a=<c:out value="${row.test1}"/>
    and b='<c:out value="${row.test2}"/>'
    </sql:query>
    So, how can I check this statement return null value which is no record within this table?

    The Result should never be null but can be empty. You can check if the Result is empty using an if tag and checking the rowCount property:
        <sql:query var="books"
          sql="select * from PUBLIC.books where id = ?" >
          <sql:param value="${bookId}" />
        </sql:query>
         <c:if test="${books.rowCount > 0}">
         </c:if>http://java.sun.com/j2ee/1.4/docs/tutorial/doc/JSTL7.html#wp84217
    Look for query Tag Result Interface

  • Spatial query inside the exists clause return ora-13226

    The following does not work:
    select b.state, b.county from counties b where exists
    (select 's' from states a where a.state = 'New Jersey'
    and mdsys.sdo_relate (b.geom, a.geom, 'mask=INSIDE querytype=WINDOW' ) = 'TRUE');
    ERROR at line 1:
    ORA-13226: interface not supported without a spatial index
    ORA-06512: at "MDSYS.MD", line 1723
    ORA-06512: at "MDSYS.MDERR", line 8
    ORA-06512: at "MDSYS.SDO_3GL", line 302
    ORA-06512: at line 1
    The following does work:
    select b.* from states a,
    counties b where a.state = 'New Jersey'
    and mdsys.sdo_relate (b.geom, a.geom, 'mask=INSIDE querytype=WINDOW') = 'TRUE';
    I found bug 1243095 telling that this is not a bug but a limitation of the spatial operator. It cannot be invoked on a table that is not spatially indexed. In fact, the table is indexed but oracle cannot find the spatial index because table b(counties) is declared outside the EXISTS clause.
    In my case, I use object table. I cannot use the workaround specified above because I should use the DISTINCT clause but I cannot define the MAP and ORDER function (this is a general query).
    I've found another workaround :
    select b.state, b.county from counties b where exists
    (select 's' from states a where a.state = 'New Jersey'
    and mdsys.sdo_relate (a.geom, b.geom, 'mask=CONTAINS querytype=WINDOW') = 'TRUE');
    but sdo_relate still doesn't use the spatial index of table b (even if I specify it explicitely in the operator) and the query is very slow (more than 15 minutes).
    Is there a better workaround ?

    OK but I work in object model.
    And if I don't use the EXISTS clause, I must use the distinct clause.(I used the exists because of that)
    If I will to retrieve all the country that have at least a state beginning with the C letter, I will wrote :
    select c.* from country c, table(c.states) s where s.column_value.name like 'C%';
    (It is a simplified request to express the problem)
    In this case, I must use the distinct clause to select one occurence of each country objet (one country may contains more than one state beginning with C).
    select distinct c.* from country c, table(c.states) s where s.column_value.name like 'C%';
    For that, I must define a MAP or ORDER function for EACH type used in the country object.
    My first question is : I must retrieve all different country objects. Why the request doesn't use the MAP or ORDER function of the country type to distinct them ? Is there another syntax (or a hint) to express that ?
    In this case, it will make an ORA-00932 : incoherent datatype because the type of the nested table column cannot contain map or order method.
    Any suggestion ?
    Thanks in advance.

  • Views - SELECT from VIEW and SELECT from the query inside view definition returning different results

    Hi,
    I am facing this weird issue. Any help would be appriciated.
    I have view with the following definition:
    CREATE VIEW [marketing].[OpenedMails]
    AS
    SELECT
    ID_EmailAddress, 
    ID_Date_Opened, 
    ID_Contact, 
    ID_MailSendJobs,
    COUNT(ID_OpenedMails) AS OpenCount,
    CASE
    WHEN ROW_NUMBER() OVER (PARTITION BY CAST(ID_EmailAddress AS VARCHAR(10)) + ' ' + CAST(ID_MailSendJobs AS VARCHAR(10)) ORDER BY ID_Date_Opened) = 1 THEN 1 
    ELSE 0 
    END
    AS UniqueOpenCount
    FROM            
    dbo.Fact_OpenedMails
    where ID_Contact = 382340
    GROUP BY ID_EmailAddress, ID_Date_Opened, ID_Contact, ID_MailSendJobs;
    order by ID_MailSendJobs 
    When I run the the select statement in the view definition I get combination of both 1 and 0 for the 'UniqueOpenCount' column.
    But when I run the select from the view itself using the following query:
    SELECT [ID_EmailAddress]
          ,[ID_Date_Opened]
          ,[ID_Contact]
          ,[ID_MailSendJobs]
          ,[OpenCount]
          ,[UniqueOpenCount]
      FROM [marketing].[OpenedMails]
    I get equal amount of rows but only 0 values for the 'UniqueOpenCount' column which seems to be very weird to me. Why is this happening ? Can anyone help regarding how to solve this ??
    Result from the select inside view definition:
    Result from the select query directly from the view:
    Thanks in advance.
    Vivek Kamath

    Please post DDL, so that people do not have to guess what the keys, constraints, Declarative Referential Integrity, data types, etc. in your schema are. Learn how to follow ISO-11179 data element naming conventions and formatting rules. You failed. Temporal
    data should use ISO-8601 formats – you failed again. Code should be in Standard SQL AS much AS possible and not local dialect. 
    This is minimal polite behavior on SQL forums. 
    Things like “ID_Date_Opened” are wrong. The affixes “id” and “date” are called attribute properties in ISO-11179 and data modeling. Since a date is a unit of measurement on a temporal scale, it cannot be an identifier by definition. My guess is this would be
    “open_date” if it were done right. And the only display format in ANSI/ISO Standard SQL is ISO-8601 (yyyy-mm-dd)
    An email address of -1?? Email addresses are VARCHAR(256), not numeric. There is no reason to cast them AS string!
    Your vague “mail_send_jobs” is plural, but columns hold scalars and cannot be plural by definition. The partition cause can hold a list of columns: 
    WHEN ROW_NUMBER() 
         OVER (PARTITION BY email_address, mail_send_job 
                   ORDER BY open_date)
         = 1 
    THEN 1 ELSE 0 END 
    This still makes no sense, but the syntax is better. You do not understand how ROW_NUMBER() works. 
    Would you like to try again with proper Netiquette? 
    --CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
    in Sets / Trees and Hierarchies in SQL

  • Problem with select query inside a function.

    Hi,
    i have created a function as
    create or replace function "NEW"
    (emp in number,
    s_date in DATE,
    e_date in DATE)
    return number
    is
    v_alo number default 0;
    v_alo2 number default 0;
    v_date date;
    begin
    select sum(allocation_percent) into v_alo from employeeproject where start_date < s_date and end_date > e_date and pid != 'BPDE-KER12' and employee_id = emp;
    select allocation_percent into v_alo2 from employeeproject where start_date < s_date and end_date > e_date and pid = 'BPDE-KER12' and employee_id = emp;
    select max(end_date) into v_date from employeeproject where employee_id=emp having max(end_date) <= S_DATE;
    if v_alo < 100 then
    return 1;
    else if v_alo2 = 100 then
    return 2;
    else if v_date < s_date then
    return 3;
    else
    return 4;
    end if;
    end if;
    end if;
    exception
    when NO_DATA_FOUND then
    return 5;
    end;it is compiled correctly.
    when executing the function with
    select abc.a,new(a,'03-jan-2011','04-jan-2011') "status" from abc where new(a,'03-jan-2011','04-jan-2011') in (1,2,3,4);it is returning
    A status
    1 5
    2 5
    3 5
    instead of
    A status
    1 1
    2 2
    3 3
    and when i comment any two select statements then some part of my ans is correct.
    unable to understand the behaviour.
    can any pls help me understand it.
    Thanks,
    hari

    Hi,
    thanks for the reply, and sorry for my ugly code.
    i am using Oracle database 10g express edition.
    Case could be a option to use but i need to figure why my query is not returning any value when used together.
    my requirement is to find
    the employees who are have allocation percent sum < 100 for a defined period(excluding pid=BPDE-KER12) and
    employee who is mapped to pid=BPDE-KER12 not in my first requirement in that period and
    the employees whose latest end date is less than the new start date.
    i have tried the new modified code as you said but this time it returns null, not even exceptions running.
    i divide my requirement into three functions which will return value.
    1.  create or replace function "NEW4"
    (emp in number,
    s_date in DATE,
    e_date in DATE)
    return number
    is
    v_alo number default 0;
    v_alo2 number default 0;
    v_date date;
    begin
    --to check if the employee total percentage is <100 then return 1 else return 4
    select sum(allocation_percent) into v_alo from pm_employee_project
    where
    start_date < s_date and end_date > e_date and pid !='BPDE-KER12' and employee_id = emp;
    if v_alo < 100 then
    return 1;
    elsif v_alo2 = 100 then
    return 2;
    elsif v_date < s_date then
    return 3;
    else
    return 4;
    end if;
    exception
    when NO_DATA_FOUND then
    return 5;
    end;
    then,
    select abc.a,NEW4(a,'03-jan-2011','30-jan-2011') "STATUS" from abc
    result,
    A STATUS
    1 *1*
    2 4
    3 4 2.create or replace function "NEW5"
    (emp in number,
    s_date in DATE,
    e_date in DATE)
    return number
    is
    v_alo number default 0;
    v_alo2 number default 0;
    v_date date;
    begin
    --To select employee who are in a specific pid.
    select allocation_percent into v_alo2 from pm_employee_project where
    start_date < s_date and end_date > e_date and pid = 'BPDE-KER12' and
    employee_id = emp;
    if v_alo2 = 100 then
    return 2;
    elsif v_alo < 100 then
    return 1;
    elsif v_date < s_date then
    return 3;
    else
    return 4;
    end if;
    exception
    when NO_DATA_FOUND then
    return 5;
    end;
    then,
    select abc.a,NEW5(a,'03-jan-2011','30-jan-2011') "STATUS" from abc
    Result,
    A STATUS
    1 5
    2 *2*
    3 5 3.   create or replace function "NEW6"
    (emp in number,
    s_date in DATE,
    e_date in DATE)
    return number
    is
    v_alo number default 0;
    v_alo2 number default 0;
    v_date date;
    begin
    --to select the employee whose project end date is less thann the new date.
    select max(end_date) into v_date from pm_employee_project where
    employee_id=emp having max(end_date) <= S_DATE;
    if v_alo2 = 100 then
    return 2;
    elsif v_alo = 100 then
    return 1;
    elsif v_date < s_date then
    return 3;
    else
    return 4;
    end if;
    exception
    when NO_DATA_FOUND then
    return 5;
    end;
    then,
    select abc.a,NEW6(a,'03-jan-2011','30-jan-2011') "STATUS" from abc
    Result,
    A STATUS
    1 5
    2 5
    3 *3* so my function works properly individually, but i want all the three conditions in a single function with same order as above 1 then 2 and then 3.
    and when i try to do it that way i am not getting my result as
    A STATUS
    1 *1*
    2 *2*
    3 *3*
    so how can i proceed.
    my input table values,
    select * from abc
    A B C
    1 2 2
    2 1 3
    3 1 2
    select * from pm_employee_project
    varchar2 varchar2 date date date varchar2
    EMPLOYEE_ID PID START_DATE END_DATE ALLOCATION_PERCENT SUPERVISOR_ID
    1 10 02-JAN-11 31-JAN-11 89 -
    1 20 05-JAN-11 20-JAN-11 9 -
    1 BPDE-KER12 21-JAN-11 31-JAN-11 11 -
    2 BPDE-KER12 01-JAN-11 31-JAN-11 100 -
    3 30 01-JAN-10 01-JAN-11 100

  • Authority-Check in ABAP Query

    Hello,
            I have a requirement to add authority check on two fields "Sales Organization" & "Plant" in a ABAP Query.
    Please let me know how can I do it?
    Will I be required to add some "Authority-check" code in sq02 or is there any button/checkbox available to do the same.
    Please let me know.
    Thanks in advance.
    Best regards,
    Tejas Savla

    Hi Ronak,
    Check this thread, this might help you.
    Authorisation on field
    Regards,
    Chandra Sekhar

  • What to check in my query running slow

    Hi,
    Our 11g database was migrated from one platform to another. A query which ran very quickly before on the source platform now takes ages to run on the target platform. Please could you point me in the right direction as to what things I should check to fix this problem?
    thank you

    Hi,
    Following are the areas which can be explored. I hope this will help you.
    1) Check the Explain plan for both servers. I hope you know how to gahter the explain plan for quries. Its better to use dbms_XPLAIN
    -Most probably your explain plan will be different..
    2) Check the init parameters of source and target tables
    3) check the optimizer parameters of source and target tables. Parameters like optimizer_ind_cost_adj,sort_area_size,hash_area_size,Optimizer_mode,cursor_sharing etc
    4) check the data volumn of source and target tables.
    5) Check the statistics of source and target tables. Its cumbersome to compare the statistics of source and target. So what you can do is
    a) Take the export of statistics of target tables
    b) Import those statistics to source tables(Before importing take the backup of source table statistics)
    c) Once done the check the explain plan, it should be the same like target database.
    -If step 2 confirms that statistics is the problem then you should take the export of source table statistics and import in target to get the same explain plan.
    HTH

Maybe you are looking for

  • Finding minimum value in each row using dynamic query

    need to find the minimum and maximum value from each row using dynamic query [from curr] will be given as input Tuky

  • Standard Program for User Maintaince

    hi friends can anybody give me the standard prograname in which has output , user name , tcode which has acces with descriptions regards

  • SHould I buy an extra insurance?

    Hi, when I bought the ipad last friday the store (ECI, not Apple) gave me the 2 year warranty as the law says (1 year apple and 1 year extra). But they also told me that they have their own insurance. Which the call "total protection". For 77€ (my mo

  • Mail crashes all the time

    Hello, i'm having problem with mail.app which crashes when i'm moving a mail into a local mailbox without using the mouse. Since there's no shortcut to move a mail in a given mailbox, i'm using cmd-?, type in search form the name of the mailbox in wh

  • Printer or spool issues

    what are the printer issues which comes in real time and what are the solutions for it ? please help me out ..