Use @TODATE with Subs Variable?

I'm have a series of calculations which depend on the elapsed time between now (stored in a substitution variable as &Todaysdate), and a date which is in an Attribute.While I can get the formulae to work using typed-in dates, when I swap the date for the variable, it gives an error:VAR TheDateDummymember( TheDate = @TODATE("dd-mm-yyyy", "23-08-2002"); )works fine, butVAR TheDateDummymember( TheDate = @TODATE("dd-mm-yyyy", &Todaysdate); )with &Todaysdate defined as either 23--8-2002 or "23-08-2002" gives a syntax error (error in TODATE command).If I split it in two:Temp = &Todaysdate;TheDate = @TODATE("dd-mm-yyyy", Temp); then I get no errorAm I missing something?

It could be that the @TODATE function wants a member reference - I know that it should work, but the workaround that you posted suggests to me that the function is not resolving the sub variable properly.Try using the @MEMBER function around the sub variable - I haven't tested it myself but it might work...Regards,Jade-------------------------------Jade ColeSenior Business Intelligence ConsultantClarity [email protected]

Similar Messages

  • How to use Decode with a variable

    Maybe you've seen this done.
    I want to take statement strMenu4 and subtract the previous value
    that is stored in an array as shown in strMenu5.
    My problem is this change as shown in strMenu5 produces
    an error code:
    ORA-00904 invalid column name
    So either I'm coding something wrong or it can't be done within the
    SUM(decode) construct. If I replace the variable with a literal
    like 1000 the code works:
    SUM(decode(name,'DBWR lru scans', c1.value) - 1000) DBWR_lru_scans
    but with an array variable or even a constant the code fails:
    SUM(decode(name,'DBWR lru scans', c1.value) - Array(3)) DBWR_lru_scans, "
    Any ideas how I can use Decode with a variable and not have it interrupt it
    as a invalid column name?
    Thanks,
    Joseph Karpinski
    [email protected]
    [email protected]
    strMenu4 = "SELECT d1.instance, " _
    & " to_char(sysdate, 'dd-mon-yy hh24:mi:ss') start_time, " _
    & " SUM(decode(name,'DBWR buffers scanned', c1.value)) DBWR_buffers_scanned, " _
    & " SUM(decode(name,'DBWR lru scans', c1.value)) DBWR_lru_scans, " _
    & " SUM(decode(name,'db block gets', c1.value)) db_block_gets , " _
    & " SUM(decode(name,'consistent gets', c1.value)) consistent_gets , " _
    & " SUM(decode(name,'physical reads', c1.value)) physical_reads " _
    & " from dual, v$sysstat c1, v$thread d1 " _
    & " group by d1.instance "
    strMenu5 = "SELECT d1.instance, " _
    & " to_char(sysdate, 'dd-mon-yy hh24:mi:ss') start_time, " _
    & " SUM(decode(name,'DBWR buffers scanned', c1.value) - Array(2)) DBWR_buffers_scanned, " _
    & " SUM(decode(name,'DBWR lru scans', c1.value) - Array(3)) DBWR_lru_scans, " _
    & " SUM(decode(name,'db block gets', c1.value) - Array(4)) db_block_gets , " _
    & " SUM(decode(name,'consistent gets', c1.value) - Array(5)) consistent_gets , " _
    & " SUM(decode(name,'physical reads', c1.value) - Array(6)) physical_reads " _
    & " from dual, v$sysstat c1, v$thread d1 " _
    & " group by d1.instance "

    Re-posting in the SQL and PL/SQL forum.
    It's more appropriate.
    Thanks,
    Closing

  • Is it necessary to use semaphores with shared variables

    is it ok to use semaphores with shared variables to prevent race conditions or is that built into the shared variable?
    - James
    Using LV 2012 on Windows 7 64 bit

    Semaphores are more of a method to protect a section of code from executing, and as tst as said they won't really help you.  There is nothing inherently harmful about having 2 sections of code trying to write to a shared variable at the same time.  Nothing like a crashed program, scrambled value, or an error message.  What will happen is that whatever happens 2nd is the value that sticks.  So a shared variable can still have the possiblility of race conditions just like local and global variables if you are dealing with multiple writers.  That is really an architecture problem.

  • Can I Use defaultTab with a Variable?

    Hello. I need to use the defaultTab values of a Spry tabbed panels with a variable but can't figure out how to do so. In short, I am creating links to specific tabs on another page like this:
    <a href="registration.html?sport=soccer&clinic=youth>
    The tabs are opened by assigning the sport and clinic names to their respective tabs like this:
    var params = Spry.Utils.getLocationParamsAsObject();
    theClinic = params.clinic;
    switch (theClinic)
    case 'youth':
        var Soccer = new Spry.Widget.TabbedPanels("Soccer", {defaultTab: 0});
      break;
    However, I now want to make sure that a default tab can be defined like this:
    var Soccer = new Spry.Widget.TabbedPanels("Soccer", {defaultTab: defaultClinic ? defaultClinic : 0});
    I was hoping to set up defaultClinic in the first piece of code (before the break) like this:
    var defaultClinic = defaultTab;
    But that doesn't work, so is there another way to take the defaultTab value and work it into a variable?
    Thank you.

    Hi,
    I don´t know the number of variables.
    Example 1:
    if (s = true) then
    column_clause:= 'emp';
    using_clause := 'var_emp';
    value_clause := ':x';
    end if
    if (y = true) then
    column_clause:= column_clause || ', emp';
    using_clause := using_clause || ', var_emp';
    value_clause := value_clause || ', :x';
    end if;
    EXECUTE IMMEDIATE
    'INSERT INTO TABLE (' || column_clause ||') VALUES ('|| value_clause ||') ||
    USING || using_clause;
    Because if I use:
    EXECUTE IMMEDIATE cmd_insert; --without "USING" clause, I have low performance.
    Someone have a sugestion to make the "Example 1" to work ?
    Thank you very much.

  • Is it possible to use attachMovie with a variable ID reference?

    Hello:
    I am trying to write an attachMovie statement with a variable
    feeding the ID parameter. Is that possible?
    For Example:
    fadeInVar = '"LS_body_home_ID"';
    _level0.LS_hitArea_body.attachMovie([fadeInVar],
    "attached_LS_body", 1);
    I can't quite figure out how to write this. I tried an eval
    function as well...
    If you have any ideas, please let me know.
    Thank you!
    - Garrett

    I'm not so sure that this will even work but off the top of my head I can say remove the [] from around [fadeInVar].
    AS2... not sure if this will work. I know in AS3 it wouldn't. It would for sure work if you externalized your images/swfs from the library and used a moviecliploader to load in a swf/image from a URL.
    function loadFile(fileURL:String):Void
         var mcl:MovieClipLoader = new MovieClipLoader();
         mcl.load(fileURL, container); //Where container would be the display object (movieclip or Bitmap) that you wanted to load the item into.
         //To dynamically create something you can add the image into, do this
         var mcContainer:MovieClip = stage.createEmptyMovieClip("containerClip" + stage.getNextHighestDepth()");
         mcl.load(fileURL, mcContainer); //Where container would be the  display object (movieclip or Bitmap) that you wanted to load the item  into.
    Use of the above function would be:
    loadFile("images/image1.jpg");
    Let me know if that helps.

  • Using LIKE with a variable in a report query

    Probably an stupid question, but I can't find the answer on this forum or by trying. How do use LIKE and a variable together in a query?
    The following solutions don't work f.e.:
    LIKE :P310_ENTITEITID%
    LIKE ':P310_ENTITEITID%'

    Hi Elmo
    Try '%'||:P310_ENTITEITID||'%'
    Elsie

  • Default form value using sql with bind variable

    I wish to create a form based upon a table with a foreign key. I wish to add a field to the form that is an uneditable text field with a default value using sql of 'select name from other_table where other_table_id = ?' where ? is a bind variable defined by a hidden field which is the value of the foreign key identified at runtime. How can this be done?
    null

    I don't think that will work. I have multiple people accessing the Portal at the same time with the same login (or lack of as public will be the most common user). I could set it easily enough as the value is passed to the form by a link object, so I could add it to the before page plsql block and set the value. But I am uncertain how it will behave in a multi-user mutlitasking environment.
    Maybe I should describe what I am looking to accomplish. I want to create a display above a form that will list static details from other tables (i.e. when editing a user's phone number, which is in one table, you want the user to see the person's name, which is in another table, and the form is based upon the phone table) ...
    Just as I am thinking about it, I thought of an idea. I could put some specific code in the before displaying page plsql section to query the database and use htp to output the information for data not in the table the form is based upon. I will try this and see how it works. It would have been nice to have just created a field that is not editable and had a default value, but this should work as well.
    Let me know if you see any problem with this or if you have any better suggestions.
    Thanks for the fast response.

  • Slow performance when using cursor with bind variable

    i'm facing the problem mentioned in the subject.
    whenever i use the bind variable it would take more than 5mins to fetch 157 records, but if i hardcode the value ( not using variable ) it would take only 10sec to fetch 157 records.
    can anyone give me some guide to solve this problem? thank you..
    Code :
    DECLARE
    cursor cur1(l_startdate IN varchar2,l_enddate IN varchar2) IS
    select * from shipment ship where ship.insertion_date >= to_date(l_startdate,'DD-MM-YYYY HH24:MI:SS') and ship.insertion_date < to_date(l_enddate ,'DD-MM-YYYY HH24:MI:SS')
    TYPE shipment_aat IS TABLE OF cur1%ROWTYPE INDEX BY PLS_INTEGER;
    l_shpt shipment_aat;
    limit_in INTEGER := 100;
    BEGIN
    v_startdate := '10-06-2008 14:00:00';
    v_enddate := '10-06-2008 17:00:00';
    OPEN C_shpt(v_startdate,v_enddate);
    LOOP --start shipment loop   
    FETCH C_shpt BULK COLLECT INTO l_shpt LIMIT limit_in;
         FOR indx IN 1 .. l_shpt.COUNT
    LOOP
    DBMS_OUTPUT.PUT_LINE('l_shpt value ' || l_shpt(indx).ship_number || '/' || l_shpt(indx).insertion_date);
    END LOOP;
    EXIT WHEN l_shpt.COUNT < limit_in;
    END LOOP; -- end of shipment loop
    CLOSE cur1;
    END;

    When your query takes too long ...

  • Syntax for using AND with a variable in Business Rule Source

    I've never fully gotten my head around the AND/OR syntax of calc scripts. What I'd like to do is as follows in some basic pseudo code:
    FIX( ("A97" AND [Selected_Entity]) OR ("B76" AND [Selected_Entity]) OR ("C63" AND [Selected_Entity]) ).
    I want my webform's business rule to execute on the selected Entity in the form (eg. A97) ONLY if that entity is part of a restricted list of members (in this case, 3 entities out of 200).
    Thanks for any advice!

    Hi,
    I am not sure if I have totally understood what you are trying to achieve so sorry if I have misread it.
    But what you could do is set up a variable in the Bus Rule, lets call EntVar.
    It is set up as a local variable of type member and dimension Entity with a run time prompt "Enter Entity"
    Now in your script it could look something like this....
    FIX(&CurrentYr, "Working".......)
    "AccMember"(
    IF(@ISMBR(&#91;EntVar]) AND (&#91;EntVar]=="A97" OR &#91;EntVar]=="B76" OR &#91;EntVar]=="C63") )
    AccMember=.......;
    ENDIF
    ENDFIX
    Once you have tested the business rule, you can get your form to pass through the entity into the variable.
    Is this what you are trying to do?
    Cheers
    John
    http://john-goodwin.blogspot.com/

  • Help on using hashtables with sub structures inside

    Hi everyone,
    I'm currently working on a script that scans Active Directory for computers, and lists current users logged, and logs to an hashtable the username as key, and a count as a value.
    After that it sends an email with the list. This part is all developed and working. Now I want to go further, and in the hash table, I would like to have as the key the username, and as the value the counter and a list of the computer names where the user
    is logged on.
    I have this code for working with the hashtable:
    ForEach ($c in $computer) {
    #Get explorer.exe processes
    $proc = gwmi win32_process -computer $c -Filter "Name = 'explorer.exe'"
    #Go through collection of processes
    ForEach ($p in $proc) {
    $temp = "" | Select Computer, Domain, User
    $temp.computer = $c
    $temp.user = ($p.GetOwner()).User
    $temp.domain = ($p.GetOwner()).Domain
    $report += $temp
    If($UsersList.ContainsKey($temp.user) -eq 1){
    $UsersList[$temp.user] = $UsersList[$temp.user] + 1
    #$UsersList
    Else {
    $UsersList.add($temp.user,1)
    Can I have it the way I'd like, or have to change my approach?
    Thanks in advance
    Nuno Silva

    Thanks for the help. One more question regarding printing the arraylist.
    I use the code below to print everything. I can print successfully the key and value but get an error on the computerlist.
    ($UsersList.GetEnumerator() |
    Sort-Object Value -descending |
    % { "{0}, {1} - {3}" -f $_.key, $_.value.Count, $_.value.ComputerList })
    Error formatting a string: Index (zero based) must be greater than or equal to zero and less than the size of the argument list..
    +     % { "{0}, {1} - {3}" -f $_.key, $_.value.Count, $_.value.ComputerList[0] })
    +         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : InvalidOperation: ({0}, {1} - {3}:String) [], RuntimeException
        + FullyQualifiedErrorId : FormatError
    Error formatting a string: Index (zero based) must be greater than or equal to zero and less than the size of the argument list..
    How can I print it out?
    Thanks in advance,
    Nuno Silva

  • BC4J bug with "bind variables" JBO-27122 ORA-01008

    I think we are found a BUG using BC4J with bind variables in a view object.
    If the bind variable appear in the WHERE condition two or more times at
    the beginning of the query the above error occur.
    oracle.jbo.SQLStmtException: JBO-27122: SQL error during statement preparation. Statement:
    SELECT Emp.EMPNO,Emp.ENAME,Emp.JOB,Emp.MGR,Emp.HIREDATE,Emp.SAL,Emp.COMM, Emp.DEPTNO
    FROM SCOTT.EMP Emp
    WHERE :1 <=10000 and :1 <= sal and :2=20
    java.sql.SQLException: ORA-01008: not all variables bound
    Otherwise if bind variable apper two or more times, but not together
    like this sample:
    WHERE :1 <=10000 and :2=20 and :1 <= sal
    the error not occur.
    We prove this with:
    JDeveloper 9.0.5.2 (build 1618)Business Components Version 9.0.5.16.0
    JDeveloper 9.0.5.0 (build 1375)Business Components Version 9.0.5.13.52
    I looking for a patch! or acceptable workaround.
    Tx for your help!
    diego.
    /* the cliente app */
    ApplicationModule am = Configuration.createRootApplicationModule("business_tier.AppModule","AppModuleLocal");
    ViewObject vo = am.findViewObject("EmpView");
    vo.setWhereClauseParam(0,"100");
    vo.setWhereClauseParam(1,"20");
    Row emp = vo.first();

    This is a known bug (1326006). The workaround is to use:
    vo.setWhereClauseParam(0,"100");
    vo.setWhereClauseParam(1,"20");
    vo.setWhereClauseParam(2,"20");
    Hope this helps,
    Lynn
    Java Tools Team

  • Why CBO don't use function-base index when I use like and bind variable

    Hello
    I have litle problem with function-base index and like with bind variable.
    When I use like with bind variable, the CBO don't use my function-base index.
    For example when I create table and index:
    ALTER SESSION SET NLS_SORT='BINARY_CI';
    ALTER SESSION SET NLS_COMP='LINGUISTIC';
    alter session set nls_language='ENGLISH';
    -- DROP TABLE TEST1;
    CREATE TABLE TEST1 (K1 VARCHAR2(32));
    create index test1_idx on test1(nlssort(K1,'nls_sort=BINARY_CI'));
    INSERT INTO TEST1
    SELECT OBJECT_NAME FROM ALL_OBJECTS;
    COMMIT;
    When I run:
    ALTER SESSION SET NLS_SORT='BINARY_CI';
    ALTER SESSION SET NLS_COMP='LINGUISTIC';
    SELECT * FROM TEST1 WHERE K1 = 'abcd';
    or
    SELECT * FROM TEST1 WHERE K1 LIKE 'abcd%';
    CBO use index.
    PLAN_TABLE_OUTPUT
    SQL_ID 4vrmp7cshbvqy, child number 1
    SELECT * FROM TEST1 WHERE K1 LIKE 'abcd%'
    Plan hash value: 1885706448
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
    | 0 | SELECT STATEMENT | | | | 1 (100)| |
    | 1 | TABLE ACCESS BY INDEX ROWID| TEST1 | 2 | 98 | 1 (0)| 00:00:01 |
    |* 2 | INDEX RANGE SCAN | TEST1_IDX | 2 | | 1 (0)| 00:00:01 |
    Predicate Information (identified by operation id):
    2 - access("TEST1"."SYS_NC00002$">=HEXTORAW('6162636400') AND
    "TEST1"."SYS_NC00002$"<HEXTORAW('6162636500') )
    but when I run
    SELECT * FROM TEST1 WHERE K1 LIKE :1;
    CBO don't use index
    PLAN_TABLE_OUTPUT
    SQL_ID 9t461s1669gru, child number 0
    SELECT * FROM TEST1 WHERE K1 LIKE :1
    Plan hash value: 4122059633
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
    | 0 | SELECT STATEMENT | | | | 89 (100)| |
    |* 1 | TABLE ACCESS FULL| TEST1 | 2 | 48 | 89 (3)| 00:00:02 |
    Predicate Information (identified by operation id):
    1 - filter("K1" LIKE :1)
    What should I change to force CBO to use index.
    I don't wont use index hint in query.
    My oracle version:
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
    PL/SQL Release 11.2.0.1.0 - Production
    CORE     11.2.0.1.0     Production
    TNS for 64-bit Windows: Version 11.2.0.1.0 - Production
    NLSRTL Version 11.2.0.1.0 - Production

    OK. But why if I create normal index (create index test1_idx on test1(K1)) and return to default nls settings this same query use index.
    PLAN_TABLE_OUTPUT
    SQL_ID 9t461s1669gru, child number 0
    SELECT * FROM TEST1 WHERE K1 LIKE :1
    Plan hash value: 598212486
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
    | 0 | SELECT STATEMENT | | | | 1 (100)| |
    |* 1 | INDEX RANGE SCAN| TEST1_IDX | 1 | 18 | 1 (0)| 00:00:01 |
    Predicate Information (identified by operation id):
    1 - access("K1" LIKE :1)
    filter("K1" LIKE :1)
    Note
    - dynamic sampling used for this statement (level=2)
    when index is function-base (create index test1_idx on test1(nlssort(K1,'nls_sort=BINARY_CI')))
    PLAN_TABLE_OUTPUT
    SQL_ID 9t461s1669gru, child number 1
    SELECT * FROM TEST1 WHERE K1 LIKE :1
    Plan hash value: 4122059633
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
    | 0 | SELECT STATEMENT | | | | 89 (100)| |
    |* 1 | TABLE ACCESS FULL| TEST1 | 3 | 54 | 89 (3)| 00:00:02 |
    Predicate Information (identified by operation id):
    1 - filter("K1" LIKE :1)
    Note
    - dynamic sampling used for this statement (level=2)
    when I create index with upper function "index test1_idx on test1(upper(K1))" the query use index
    SELECT * FROM TEST1 WHERE upper(K1) LIKE :1
    Plan hash value: 1885706448
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
    | 0 | SELECT STATEMENT | | | | 1 (100)| |
    | 1 | TABLE ACCESS BY INDEX ROWID| TEST1 | 4481 | 157K| 1 (0)| 00:00:01 |
    |* 2 | INDEX RANGE SCAN | TEST1_IDX | 806 | | 1 (0)| 00:00:01 |
    Predicate Information (identified by operation id):
    2 - access("TEST1"."SYS_NC00002$" LIKE :1)
    filter("TEST1"."SYS_NC00002$" LIKE :1)
    Note
    - dynamic sampling used for this statement (level=2)

  • Filter query with sub query using Dropdown box

    Dear Community,
    I have 2 queries
    1. Main Query with 2 fields:  Project | Project value
    2. Sub Query with 2 fields:  Project group | Project
    Project group can be belonging to number of projects and project can be belong to number of project group (Many to Many).
    My customer wants the main query will open without any filtering.
    When I choose project group from WAD dropdown box, the main query will filtering all the projects that belong to the project group.
    I create WAD; define dropdown box as sub query, and Analysis as main query.
    In the dropdown box I choose "data binding" char and create command "set selection state by binding" (project to project) but it doesnu2019t work. 
    I also try to do this by Replacement Path in the main query, but the variable requires the attribute will be ready for input.
    Thanks a lot
    Yaniv

    I am not sure about your comments on replacement path variable. Without having tried it, here is what I would have attempted:
    The main query needs to use a replacement path variable for Project that is replaced by the results of the sub-query. Sub-query would have a regular input variable for project group. (as a quick test, if you had one analysis item for main query with variable input enabled, it should prompt you to enter Project group).
    Now the drop-down needs to be associated with a javascript function. The javascript function needs to implement command "Set variable state" for the main query data provider to selected value of the drop-down.
    The drop-down should be associated with the sub-query data provider, just used to populate the list of values in drop-down.

  • Do sub variables work with bus rules 931?

    Do sub variables work with bus rules 931?

    Hi,
    Yes you can use essbase substitution variables with Business Rules 9.3.1
    e.g. &CurrYear points to substitution variable called CurrYear
    Cheers
    John

  • Query with bind variable, how can use it in managed bean ?

    Hi
    I create query with bind variable (BindControlTextValue), this query return description of value that i set in BindControlTextValue variable, how can i use this query in managed bean? I need to set this value in String parameter in managed bean.
    Thanks

    Put the query in a VO and execute it the usual way.
    If you need to, you can write a parameterized method in VOImpl that executes the VO query with the parameter and then call that method from the UI (as a methodAction binding) either through the managed bean or via a direct button click on the page.

Maybe you are looking for

  • Access Sequence JEXC missing after upgrade to EHP7

    Dear Experts, we are facing an error while saving excise invoice through transaction J1IIN in development system after upgrade to EHP 7, Access sequence JEXC missing  ( ) Message no. VE306, could you please suggest to find out solution. Regards, Amit

  • Spotlight reindex, mds crash

    Hello, I was searching a lot of stuff and I didn't found any resonable solution. It starts about the last update to 10.9.1. (17.12.). Main problem is like this: every time I open a lid on my AriMac, spotlight is starting reindexation. I found some li

  • What is the use of embedding Xcelsius Swf file in to Crysatl report?

    Hi all, I read some documents related to this integration, but still am in a confusion about the final purpose. Can any of you answer my question patiently? 1.Is the embedded SWF acts just like a static object (just like a SWF)? 2.If, I embed a swf f

  • Java command not working - path problem ?

    Im not really new to Java, but rather new to Linux :=) Ive got NetBeans setup and working great on Redhat 7.2 and I can run Java apps from within the IDE...but not from a command line. I get "bash: java: command not found" This tells me something is

  • Error including icons in package

    I am attempting to include icons in my Air application. Unfortunately, during the package phase, I am receiving the following errors: /Users/gene/Development/Projects/Flex/app/My-app.xml(18): error 303: Icon Source/assets/icons/icon16.png is missing