Using a date field in a JDOQL query crashes

Hello:
I am trying to use a date field in a JDOQL filter. It appears from the
log file that the date is not being substituted into the SQL.
It is not clear from the JDOQL spec how to do date queries.... doing date
queries in SQL involves several special operators, yet the
JDOQL defines the ">" and "<" operators as working on dates....and there is
no mention of date specific operators so I am hoping that I
can do a filter where I compare a date to an input parameter date using the
">" and "<" operators...
I have enclosed a copy of my driver code, followed by an except of my class
that contains the date, followed by the kodo exception log
I can't see where I am doing anything that violates the JDOQL spec and I
don't see any other way of doing date comparisions.
Brian
Here is the driver code that I am attempting:
public void getDateRange ()
PersistenceManager pm = JDOFactory.getPersistenceManager ();
String filter = "leafDates.contains (cdate) & cdate.statusName ==
myStatus & cdate.datePhaseStarted > myDate";
Date date = new Date ();
Calendar calendar = new GregorianCalendar (TimeZone.getDefault ());
calendar.set (2002, Calendar.DECEMBER, 26);
date=calendar.getTime();
Extent extent = pm.getExtent (LeafBase.class, false);
Query query = pm.newQuery (LeafBase.class, filter);
query.declareImports ("import aqueduct.*; import java.util.Date");
query.declareVariables ("aqueduct.LeafDate cdate; Date myDate");
query.declareParameters ("String myStatus");
System.out.println ("dated used = " + date);
Collection results = (Collection) query.execute ("closed", date);
Iterator iter = results.iterator ();
while (iter.hasNext () ) {
LeafBase myLeaf = (LeafBase) iter.next ();
System.out.println ("My leaf = " + myLeaf);
pm.close ();
Here is the class:
public class LeafDate implements Serializable
// *******The Attributes***************
private Date datePhaseStarted = null;
private boolean isEstimatedDate = false;
//mark this as non-persistent in the JDO metadata
private StatusType status = null;
//put here to enable one-to-many mapping using a single table in JDO
private LeafBase parent = null;
Here is the error I am getting:
C:\bcs\jdo\kodo-jdo-2.4.0\aqueduct>java aqueduct.DealMaint dated used = Thu
Dec 26 08:47:33 CST 2002
Exception in thread "main" javax.jdo.JDODataStoreException:
com.solarmetric.kodo.impl.jdbc.sql.SQLExceptionWrapper:
[SQL=SELECT DISTINCT t0.ID, t0.JDOCLASS, t0.IS_CONFLICT, t0.CURRENCYX,
t0.DEALPARENTX, t0.PARENTX, t0.PRODUCTKIND, t0.T_SIZE, t0.STATUSNAME FROM
JDO_DATE t1, JDO_LEAF t0 WHERE ((t1.STATUSNAME = 'closed' AND t1.DATESTARTED
*variable*) AND t0.ID = t1.PARENTX) PRE=SELECT DISTINCT t0.ID,
t0.JDOCLASS, t0.IS_CONFLICT, t0.CURRENCYX, t0.DEALPARENTX, t0.PARENTX,
t0.PRODUCTKIND, t0.T_SIZE, t0.STATUSNAME FROM JDO_DATE t1, JDO_LEAF t0 WHERE
((t1.STATUSNAME = ? AND t1.DATESTARTED > *variable*) AND t0.ID =
t1.PARENTX)
ORA-00936: missing expression
[code=936;state=42000]
NestedThrowables:com.solarmetric.kodo.impl.jdbc.sql.SQLExceptionWrapper:
[SQL=SELECT DISTINCT t0.ID, t0.JDOCLASS, t0.IS_CONFLICT, t0.CURRENCYX,
t0.DEALPA RENTX, t0.PARENTX, t0.PRODUCTKIND, t0.T_SIZE, t0.STATUSNAME FROM
JDO_DATE t1, JD O_LEAF t0 WHERE ((t1.STATUSNAME = 'closed' AND
t1.DATESTARTED > *variable*) AND t0.ID = t1.PARENTX)] [PRE=SELECT DISTINCT
t0.ID, t0.JDOCLASS, t0.IS_CONFLICT, t0.CURRENCYX, t0.DEALPA RENTX,
t0.PARENTX, t0.PRODUCTKIND, t0.T_SIZE, t0.STATUSNAME FROM JDO_DATE t1, JD
O_LEAF t0 WHERE ((t1.STATUSNAME = ? AND t1.DATESTARTED > *variable*) AND
t0.ID = t1.PARENTX)]
ORA-00936: missing expression
at
com.solarmetric.kodo.impl.jdbc.runtime.SQLExceptions.throwDataStore(SQLExcep
tions.java:23)
at
com.solarmetric.kodo.impl.jdbc.runtime.JDBCStoreManager.executeQuery(JDBCSto
reManager.java:742)
at
com.solarmetric.kodo.impl.jdbc.runtime.JDBCQuery.executeQuery(JDBCQuery.java
:92)
at com.solarmetric.kodo.query.QueryImpl.executeWithMap(QueryImpl.java:792)
at com.solarmetric.kodo.query.QueryImpl.executeWithArray(QueryImpl.java:668)
at com.solarmetric.kodo.query.QueryImpl.execute(QueryImpl.java:623)
at aqueduct.DealMaint.getDateRange(DealMaint.java:523)
at
aqueduct.DealMaint.main(DealMaint.java:35)NestedThrowablesStackTrace:java.sq
l.SQLException:
ORA-00936: missing expression
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:169)
at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:208)
at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:543)
at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1405)
at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteDescribe(TTC7Protocol.java:643)
at
oracle.jdbc.driver.OracleStatement.doExecuteQuery(OracleStatement.java:1819)
at
oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java
:2015)
at
oracle.jdbc.driver.OraclePreparedStatement.doScrollPstmtExecuteUpdate(Oracle
PreparedStatement.java:3021)
at
oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedState
ment.java:416)
at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePrepare

Oh, thanks for pointing this out.... I got caught up in trying to figure out
the date issues, I missed the obvious.
Brian
"Patrick Linskey" <[email protected]> wrote in message
news:[email protected]...
Brian,
The problem is that you're declaring myDate as a variable instead of a
parameter. Yes, we should be doing better error checking. But that's the
problem.
So, change your declareVariables() and declareParameters() statements
accordingly, and all should work out.
-Patrick
Brian Smith wrote:
Here is the driver code that I am attempting:
public void getDateRange ()
PersistenceManager pm = JDOFactory.getPersistenceManager ();
String filter = "leafDates.contains (cdate) & cdate.statusName ==
myStatus & cdate.datePhaseStarted > myDate";
Date date = new Date ();
Calendar calendar = new GregorianCalendar (TimeZone.getDefault
>>
calendar.set (2002, Calendar.DECEMBER, 26);
date=calendar.getTime();
Extent extent = pm.getExtent (LeafBase.class, false);
Query query = pm.newQuery (LeafBase.class, filter);
query.declareImports ("import aqueduct.*; importjava.util.Date");
>>
query.declareVariables ("aqueduct.LeafDate cdate; Date myDate");
query.declareParameters ("String myStatus");
System.out.println ("dated used = " + date);
Collection results = (Collection) query.execute ("closed", date);
Iterator iter = results.iterator ();
while (iter.hasNext () ) {
LeafBase myLeaf = (LeafBase) iter.next ();
System.out.println ("My leaf = " + myLeaf);
pm.close ();
>
Here is the class:
public class LeafDate implements Serializable
// *******The Attributes***************
private Date datePhaseStarted = null;
private boolean isEstimatedDate = false;
//mark this as non-persistent in the JDO metadata
private StatusType status = null;
//put here to enable one-to-many mapping using a single table in JDO
private LeafBase parent = null;
>
Here is the error I am getting:
C:\bcs\jdo\kodo-jdo-2.4.0\aqueduct>java aqueduct.DealMaint dated used
= Thu
Dec 26 08:47:33 CST 2002
Exception in thread "main" javax.jdo.JDODataStoreException:
com.solarmetric.kodo.impl.jdbc.sql.SQLExceptionWrapper:
[SQL=SELECT DISTINCT t0.ID, t0.JDOCLASS, t0.IS_CONFLICT, t0.CURRENCYX,
t0.DEALPARENTX, t0.PARENTX, t0.PRODUCTKIND, t0.T_SIZE, t0.STATUSNAMEFROM> > JDO_DATE t1, JDO_LEAF t0 WHERE ((t1.STATUSNAME = 'closed' AND> > t1.DATESTARTED> >> > >*variable*) AND t0.ID = t1.PARENTX) [PRE=SELECT DISTINCT t0.ID,
>
ORA-00936: missing expression
[code=936;state=42000]
NestedThrowables:com.solarmetric.kodo.impl.jdbc.sql.SQLExceptionWrapper:
[SQL=SELECT DISTINCT t0.ID, t0.JDOCLASS, t0.IS_CONFLICT, t0.CURRENCYX,
t0.DEALPA RENTX, t0.PARENTX, t0.PRODUCTKIND, t0.T_SIZE, t0.STATUSNAMEFROM
JDO_DATE t1, JD O_LEAF t0 WHERE ((t1.STATUSNAME = 'closed' AND
t1.DATESTARTED > variable) AND t0.ID = t1.PARENTX)] [PRE=SELECTDISTINCT
t0.ID, t0.JDOCLASS, t0.IS_CONFLICT, t0.CURRENCYX, t0.DEALPA RENTX,
t0.PARENTX, t0.PRODUCTKIND, t0.T_SIZE, t0.STATUSNAME FROM JDO_DATE t1,JD
O_LEAF t0 WHERE ((t1.STATUSNAME = ? AND t1.DATESTARTED > variable) AND
t0.ID = t1.PARENTX)]
ORA-00936: missing expression
at
com.solarmetric.kodo.impl.jdbc.runtime.SQLExceptions.throwDataStore(SQLExcep
tions.java:23)
at
com.solarmetric.kodo.impl.jdbc.runtime.JDBCStoreManager.executeQuery(JDBCSto
reManager.java:742)
at
com.solarmetric.kodo.impl.jdbc.runtime.JDBCQuery.executeQuery(JDBCQuery.java
:92)
atcom.solarmetric.kodo.query.QueryImpl.executeWithMap(QueryImpl.java:792)
>>
at
com.solarmetric.kodo.query.QueryImpl.executeWithArray(QueryImpl.java:668)
>>
at com.solarmetric.kodo.query.QueryImpl.execute(QueryImpl.java:623)
at aqueduct.DealMaint.getDateRange(DealMaint.java:523)
at
aqueduct.DealMaint.main(DealMaint.java:35)NestedThrowablesStackTrace:java.sq
l.SQLException:
ORA-00936: missing expression
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:169)
at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:208)
at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:543)
at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1405)
at
oracle.jdbc.ttc7.TTC7Protocol.parseExecuteDescribe(TTC7Protocol.java:643)
>>
at
oracle.jdbc.driver.OracleStatement.doExecuteQuery(OracleStatement.java:1819)
>>
at
oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java
:2015)
at
oracle.jdbc.driver.OraclePreparedStatement.doScrollPstmtExecuteUpdate(Oracle
PreparedStatement.java:3021)
at
oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedState
ment.java:416)
at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePrepare
Patrick Linskey [email protected]
SolarMetric Inc. http://www.solarmetric.com

Similar Messages

  • How to select data from a table using a date field in the where condition?

    How to select data from a table using a date field in the where condition?
    For eg:
    data itab like equk occurs 0 with header line.
    select * from equk into table itab where werks = 'C001'
                                                      and bdatu = '31129999'.
    thanks.

    Hi Ramesh,
    Specify the date format as YYYYMMDD in where condition.
    Dates are internally stored in SAP as YYYYMMDD only.
    Change your date format in WHERE condition as follows.
    data itab like equk occurs 0 with header line.
    select * from equk into table itab where werks = 'C001'
    and bdatu = <b>'99991231'.</b>
    I doubt check your data base table EQUK on this date for the existince of data.
    Otherwise, just change the conidition on BDATU like below to see all entries prior to this date.
    data itab like equk occurs 0 with header line.
    select * from equk into table itab where werks = 'C001'
    and <b> bdatu <= '99991231'.</b>
    Thanks,
    Vinay
    Thanks,
    Vinay

  • Sorting of Date field in the SQL Query useing ORDER BY

    Hi
    I am facing a problem when I am getting the results of a query from the ORacle 8i database using jdbc connection.
    The query is having a date field and I have to sort the query results using ORDER By for the Date field. The query is giving exact results in the SQL PLus interface.
    When I am getting this results in the GUI where servlets are being used an Exception is coming as not supported RefreshRow method.
    If anyone has faced this problem and have got the solutions please let me know.
    thanks
    sulfy

    That doesn't sound at all like an SQL problem.
    More like you trying to do updates on the resultset which is not allowed ...
    send a some code (not to much pls :) and we'll be
    able to help more
    cu
    Spieler

  • Problem Querying Oracle Forms Using a Date Field and a Format Mask

    Hello,
    We are experiencing a problem with Oracle Forms that I was wondering if you can help me with.
    We have several Forms that have single database blocks assigned to Oracle tables. The Forms are queryable and one of the fields we’re querying on is assigned to a field on the base table which is Not Null and has a Type of DATE. We are storing date/time information in this field on the database table. The item on the form is set up as a Date field with a Maximum Length of 7, a Format Mask ‘MMDDYY’ and having a Query Length of 10.
    We’ve seen a discrepancy in how these fields are used to query the base table block. On some user’s computers they are able to enter a 6 digit date followed by the % sign (e.g. ‘091808%’) and they get the expected results. Other users get ‘FRM-40301: Query caused no records to be retrieved. Re-enter’. Do you know why we are experiencing this difference?
    - The Oracle Database version we are running is Release 10.1.0.5.0.
    - The Forms Developer version that we’re experiencing the problem with is 4.5.10.15.2
    Thanks,
    Kris

    There is no obvious reason that I can see.
    Version 4.5 is very old so you might have problems calling Oracle Support. If you can reproduce the same problem o0n 10.1.2 you should call have them analyze the problem.

  • Creating a Calendar View using alternative date fields

    I have a Sharepoint 2007 calendar list that includes the standard Start and End Date fields.  I also have "Suggested Start Date" and "Suggested End Date" fields that are utilized by users to recommend the Start and End Dates for
    the event.
    I can create a Calendar view that displays the events according to the Start and End dates.
    I cannot create a Calendar view that displays the events according to the Suggested Start and Suggested End date fields.
    In practice, all items are not displayed on this second calendar view that should be displayed even though you can choose these fields as Time Interval values when establishing the calendar.
    Is there a way to create a Calendar View that will use date fields other than the default Start and End date fields?
    Thanks,
    Chris Mang>> JDA Software Group, Inc.

    Hello,
    It seems problem with time value. Have you included time value in custom datatime column wile creating? What happens when you select "date only" from column settings?
    You can also try below suggestion to include "IncludeTimeValue" parameter in CAMl query by designer:
    http://stackoverflow.com/questions/18362853/how-do-i-filter-by-today-and-time-in-sharepoint-list-view
    OR else create two more calculated column and save date only in those columns then filter by them.
    Hope it could help
    Hemendra:Yesterday is just a memory,Tomorrow we may never see
    Please remember to mark the replies as answers if they help and unmark them if they provide no help

  • Date field not working in Query definition

    Hello Experts ,
    I am trying to prepare one report which will pull some fields ( extended fields ) from Rfx header page and display in the report . For this I have made one  query definition and written SQL query .  Now all fields except the date fields are successfully fetched and displayed by the query .  Only when I am adding the date field inside "result field" tab , the query is throwing error  like -
    " ORA-00904: "EFFECTIVE_START_DATE": invalid identifier   "
    but this field name is correct  .
    Any formatting needs for this field ?
    Regards
    Sudipta

    Hi Sudipta,
    Thanks for your reply.
    Actually I have created a diferent extension field and want to add that field in Results fields of particular Query Definition. But when I use it Tablename.Extension_Field_Name, its giving below exception
    ORA-00904: "t"."fieldname": invalid identifier
    Any idea what needs to be taken care of while using extension fields in Queries.
    Thanks,
    Saloni

  • How do I apply filters or limit the rows on my report using a Date field in SQL report builder 3.0?

    I have a status of completed and a date field in the dataset. The date field is either empty or contains a date. All 2015 dates are holding dates.
    So how can I limit the report to only pull completed status with an empty date or a holding date?
    I have not been able to set an OR option on a date field filter and if I add two filters on the date column one for empty one for > 12/31/2014 then it treats it as an "and" and pulls nothing from the list I have in sharepoint.
    any help will be appreciated.

    Hi MB,
    In Reporting Services, the relationship of  filters is “And”, and there is no option to change the relationship from “And” to “Or”. While we can use “or” operator within the expression to create one filter to integrated all filters to work around this
    issue.
    We can add a filter as follows in the dataset to limit the rows in your report:
    Expression: =Fields!date.Value is nothing or Fields!date.Value>"12/31/2014"    Type: Boolean
    Operator: =
    Value: true
    If there are any other questions, please feel free to ask.
    Thanks,
    Katherine Xiong
    If you have any feedback on our support, please click
    here.
    Katherine Xiong
    TechNet Community Support

  • Selective Deletion using 0REQUID & Date fields in combination

    We are running SAP NetWeaver 2004s patch 15 I have tried to run a selective deletion with request ID and date fields but we are getting an SQL error.  The cube is compressed but the requests I am after have not been compressed.  Is this an activity I should be able to do?  I have checked SAP messages and found one but it was for version much older than ours  below is the error message I recieve in the Job Log.
    Job started
    Step 001 started (program RSINDEX1, variant &0000000000098, user ID BROWNAW)
    SQL: 2010/12/16 15:06:21
    CREATE TABLE "/BI0/0100000703" (DIMID INTEGER
    NOT NULL) IN CMC#BTAB
    SQL-END: 2010/12/16 15:06:21 00:00:00
    SQL: 2010/12/16 15:06:21
    insert into "/BI0/0100000703" SELECT DISTINCT
    DIMID FROM "/BIC/DZFIGL_STGP" WHERE (
    "DIM"."SID_0REQUID" =  109126
    SQL Error: SQL0206N  "DIM.SID_0REQUID" is not valid in the co ntext where it is used
    SQL-END: 2010/12/16 15:06:21 00:00:00
    System error: CREATE_TABLE_AS_SELECT/RSDU_EXEC_SQL /BI0/0100000703 206-
    Job cancelled after system exception ERROR_MESSAGE

    Thanks for the quick response.  I have validated that the data ranges do exist for the requests.  Part of our process is to use the same selection to output the data before the deletion is ran so we can validate the number of records that are purged and have a backup of the data in case another issue is discovered at a later date. 
    When I run this seleciton for output I get over 30k records.  Unfortunately I cannot just blow away the requests as most contain data that needs to remain.  As well as we use this as a source for delta records that come from multiple sources so the logistics of resetting the delta indicator on the requests and not screwing up other delta's is a big risk.  If I should be able to run a selective deletion with request I am hoping SAP can respond with a fix to the issue.

  • Using a date field to remove 'duplicates'

    Hi all,
    Really struggling here, would appreciate some fresh ideas !!
    I have a ton of rows in a table that are duplicates with the exception of a date field that differs very slightly.
    e.g.
    TO_CHAR(START_DATE,'
    13-JUN-2007 12:39:03
    13-JUN-2007 12:39:10 << dup
    18-JUN-2007 05:49:15
    18-JUN-2007 05:49:21 << dup
    13-JUN-2007 09:02:25
    13-JUN-2007 09:02:32 << dup
    It would be great if I could identify these dups in SQL and remove them. I've sampled the data and the times are out by between 5 and 7 seconds so if I could weed out all rows that have another row with a time that differs by <10 seconds that would be ideal.
    My other, but not as thorough, idea was to drop the seconds and I would be then able to drop them as if they were true duplicates ... run the risk of not catching some that way though.
    Any ideas?
    Many thanks in advance!
    Adam

    Assuming that you could legititmately have two records for the same day that are more then 10 seconds apart (and you would not consider these to be duplicates, then something along these lines should do it. In the initial select, I have bolded the "duplicates"
    pre]SQL> SELECT * FROM rt;
    SNO SDATE
    1 13-jun-2007 12:39:03
    1 13-jun-2007 12:39:10
    1 13-jun-2007 12:39:12
    1 13-jun-2007 12:39:45
    2 18-jun-2007 05:49:15
    2 18-jun-2007 05:49:21
    3 13-jun-2007 09:02:25
    3 13-jun-2007 09:02:32
    SQL> DELETE FROM rt
    2 WHERE rowid IN (SELECT rid
    3 FROM (SELECT sno, sdate, rowid rid,
    4 LAG(sdate) OVER (PARTITION BY sno
    5 ORDER BY sdate) rn
    6 FROM rt)
    7 WHERE (sdate - NVL(rn, sdate))*24*60*60 BETWEEN 1 and 10);
    4 rows deleted.
    SQL> SELECT * FROM rt;
    SNO SDATE
    1 13-jun-2007 12:39:03
    1 13-jun-2007 12:39:45
    2 18-jun-2007 05:49:15
    3 13-jun-2007 09:02:25
    This keeps the oldest of the duplicates by sdate, if you want to keep the newest, then something like:
    SQL> rollback;
    Rollback complete.
    SQL> DELETE FROM rt
      2  WHERE rowid IN (SELECT rid
      3                  FROM (SELECT sno, sdate, rowid rid,
      4                               LEAD(sdate) OVER (PARTITION BY sno
      5                                                ORDER BY sdate) rn
      6                        FROM rt)
      7                  WHERE (NVL(rn, sdate) - sdate)*24*60*60 BETWEEN 1 and 10);
    4 rows deleted.
    SQL> SELECT * FROM rt;
           SNO SDATE
             1 13-jun-2007 12:39:12
             1 13-jun-2007 12:39:45
             2 18-jun-2007 05:49:21
             3 13-jun-2007 09:02:32John

  • Date field in Input ready query

    Hi Folks,
    I have created a input ready query on transactional infocube.
    Its working fine and able to input for keyfigures except one keyfigure it is Date Keyfigure.
    I just created one more keyfigure with Datatype as Date so that user will able to enter date aswell in input ready query.
    but problem here is  I have done same changes/enable for the date keyfigure like remaining keyfigures.
    in query anylazer i cannot see input enable for the particual date keyfigure.
    please let me know what are the steps need to do extra for the particular date keyfigure to make enable for input..
    Thanks.

    Hi,
    Thanks for your response.
    if it not happened by IP is there any other option available to update changes in to DSO/Infocube.
    one more thing.I have a created one Multiprovider on the transactional DSO then i created query on the multiprovider,but in query designer i cannot change the option to change mode for the keyfigures.its in display mode only.
    why it is not enabled.is there anythying missing to do..
    Thanks..

  • Sending reports to various recipients using a data field on the report

    Hi,
    I am currently running Crystal Reports Server 2008 with SP 3  applied.
    I was wondering if this was possible.
    I have a report that I would like to be sent to an email address field on the table that the report runs from. Fields are something like this:
    Amount Due, Invoice #, Client's email address, Date
    What I would like CRS to do is send out emails depending on what's on the table. Obviously I would need the server to send out the report to a particular client with only the records that should be for them.
    I, for some reason, thought there was an ability to add a field from the report on the email itself using brackets or some sort of variable but I'm not sure if this is true.
    If anyone can help, I would appreciate it greatly.
    Thanks!

    You can use Publications for that. As far as I know this should be supported natively in CRS 2008 with SP3.
    Take a look at the demo on building a data-driver publication here:
    http://www.sap.com/solutions/sap-crystal-solutions/information-infrastructure/sapcrystalserver/featuresfunctions/index.epx
    You have to have CALs (concurrent access licenses) though.
    Regards,
    Stratos

  • How to use 2 date field as delta control in generic extractor.

    Hi colleagues:
    I have developed a generic extractor to extract logistic data: Purchase Orders and Invoice. In order to do that, I have defined a view joining EKBE, EKKO, EKPO, EKET tables on R/3. By this approach, the delta mechanism is supposed to be controlled by the EKBE-BUDAT field and also by the EKPO-AEDAT field. Both fields are available on the view used to create the Datasource. However, the Datasource creation allows us to define just one field as delta control.
    I have a few questions regarding to this scenario:
    <b>1 - Is it possible to define 2 fields as delta control field on Generic Datasource?</b>
    <b>2 - How about creating two similar Datasouces, one having AEDAT as delta control, the other having BUDAT as delta control, and then connect those Datasources to an unique Infosource on the bw side?</b>
    Best regards
    Waldemar

    hi,
    1 - as far as I know it is not possible to define 2 fields
    2 - this workaround is used often in cases like yours.
    Just remember about order of extracting: first you extract new documents then changed
    Regards,
    Andrzej

  • Is there a way to use a date field and conditionally change its LABEL?

    Hi I have 2 date select lists and desire to change the label text at runtime.
    If I use it for one query it would be Order Date, another it would be Start Date.
    ?? BillC

    Vikas,
    ...a page template is a special case since everything is finally rendered on a page.Don't know what you mean.
    references in page templates probably get evaluated first...References in page templates get replaced with their session state values when the portion of the page template containing the references is rendered, e.g., before the box, inside the box, after the box, in the footer..., and within each section each item reference is replaced "when it is encountered" with the current value of the item from session state.
    There is a Before Footer computation that sets that item to the current timestamp.I see an "After Regions" computation. On your page, the form item is rendered using the current (from the previous page request) value of the item in session state. Then your compuation sets a new value. Then the remaining sections of the page template (after the regions) are rendered and you see the newly computed value in the footer section of the template.
    Is there a way to pass in the current form item name to the shortcut so that I can have a generic shortcut that returns a different value for the label depending on which item it is being invoked from?Starting in XE and now in 2.2, you can use the strings #CURRENT_FORM_ELEMENT#, #CURRENT_ITEM_ID#, and #CURRENT_ITEM_NAME# in shortcuts. This makes PL/SQL Function shortcuts such as the following possible:  if '#CURRENT_ITEM_NAME#' = 'P2_ENAME' then
        return ('employee name');
      elsif '#CURRENT_ITEM_NAME#' = 'P2_JOB' then
        return ('job');
      else
        return ('foo');
      end if; Scott

  • Using a Date field to calculate another date equalling + 6 'Working Days'

    I am trying to provide a schedule return date based upon an Issued Date value
    The problem is that I only want the estimated return date value to include working days (6 to be precise), which are Monday to Friday.
    Any assistance in disregarding weekend days from my results would be greatly appreciated

    Try this
    DateTimevar IssueDate:={IssueDate field here};
    DateTimevar Scheduledate;
    Numbervar WeekEnds;
    Scheduledate:=DateAdd('d',6,IssueDate);
    Weekends:= DateDiff('WW',IssueDat,Scheduledate,CrSaturday)+DateDiff('WW',IssueDat,Scheduledate,CrSunday);
    Scheduledate:=Dateadd('d',Weekends,Scheduledate);
    IF DAYOFWEEK( Scheduledate) = CrSaturday THEN
       Scheduledate:= DATEADD('d', 2, Scheduledate);
    IF DAYOFWEEK( Scheduledate) = CrSunday THEN
       Scheduledate:= DATEADD('d', 1, Scheduledate);
    Scheduledate
    Jyothi
    Edited by: Jyothi Yepuri on Sep 3, 2009 6:55 AM
    Edited by: Jyothi Yepuri on Sep 3, 2009 7:07 AM

  • Bug or DUE attempting navigation to Date field in query

    I am encountering trouble executing a query that involves
    navigating a one-way one-to-one relationship
    (persistent reference to PC object) to use a Date field.
    The query is the following: "period.endingDate <=
    p.endingDate" with a query class of Vote. The right side of the
    query has been varied and varying it yields different errors,
    but the query will not execute. The parameter is defined as:
    "VotingPeriod p". The import string is present and appears
    okay.
    For the current form, the error is:
    javax.jdo.JDOUserException: The given filter/ordering String
    "period.endingDate <= p.endingDate" is not valid.
    Make sure all parentheses are properly matched and that the filter uses
    proper Java syntax.
         at com.solarmetric.kodo.query.FilterParser.evaluate(FilterParser.java:536)
         at com.solarmetric.kodo.query.QueryImpl.getExpression(QueryImpl.java:371)
         at com.solarmetric.kodo.impl.jdbc.runtime.JDBCQuery.getExpression(JDBCQuery.java:49)
         at com.solarmetric.kodo.query.QueryImpl.executeWithMap(QueryImpl.java:312)
         at com.solarmetric.kodo.query.QueryImpl.executeWithArray(QueryImpl.java:393)
         at com.solarmetric.kodo.query.QueryImpl.execute(QueryImpl.java:285)
    The Vote class is defined as:
    public class Vote
    // The pair (topic, period) is unique for all votes
    private Topic topic;
    private VotingPeriod period;
    private int count;
    The VotingPeriod class is defined as:
    public class VotingPeriod
    // the pair (startingDate, endingDate) are unique for all voting periods
    private Date startingDate;
    private Date endingDate;
    If the query is modified to be: "period.endingDate <= d" and
    the parameter is declared as "java.util.Date d", then the error
    is:
    javax.jdo.JDOException: com.ysoft.jdo.book.voting.VotingPeriod
    NestedThrowables:
    java.io.NotSerializableException: com.ysoft.jdo.book.voting.VotingPeriod
         at
    com.solarmetric.kodo.impl.jdbc.schema.dict.GenericDictionary.toSQL(GenericDictionary.java:122)
         at
    com.solarmetric.kodo.impl.jdbc.runtime.JDBCExpressionFactory$Constant.<init>(JDBCExpressionFactory.java:419)
         at
    com.solarmetric.kodo.impl.jdbc.runtime.JDBCExpressionFactory.getConstant(JDBCExpressionFactory.java:213)
         at com.solarmetric.kodo.query.FilterParser.eval(FilterParser.java:562)
         at com.solarmetric.kodo.query.FilterParser.getValue(FilterParser.java:668)
         at com.solarmetric.kodo.query.FilterParser.eval(FilterParser.java:601)
         at com.solarmetric.kodo.query.FilterParser.getExpression(FilterParser.java:677)
         at com.solarmetric.kodo.query.FilterParser.evaluate(FilterParser.java:527)
         at com.solarmetric.kodo.query.QueryImpl.getExpression(QueryImpl.java:371)
         at com.solarmetric.kodo.impl.jdbc.runtime.JDBCQuery.getExpression(JDBCQuery.java:49)
         at com.solarmetric.kodo.query.QueryImpl.executeWithMap(QueryImpl.java:312)
         at com.solarmetric.kodo.query.QueryImpl.executeWithArray(QueryImpl.java:393)
         at com.solarmetric.kodo.query.QueryImpl.execute(QueryImpl.java:285)
    David Ezzio
    Yankee Software

    Hi Patrick,
    Okay, there is a bug. Your parser doesn't know how to handle the ProxyDate class. So if a "Date"
    is passed into the query that came from a persistent object, then a ProxyDate object is passed. If
    the date is a simple "Date" object then all is well. For the simple date, the parser constructs a
    query in nice JDBC escape syntax, but for ProxyDate objects, it generates garbage.
    David
    David Ezzio wrote:
    >
    I am encountering trouble executing a query that involves
    navigating a one-way one-to-one relationship
    (persistent reference to PC object) to use a Date field.
    The query is the following: "period.endingDate <=
    p.endingDate" with a query class of Vote. The right side of the
    query has been varied and varying it yields different errors,
    but the query will not execute. The parameter is defined as:
    "VotingPeriod p". The import string is present and appears
    okay.
    For the current form, the error is:
    javax.jdo.JDOUserException: The given filter/ordering String
    "period.endingDate <= p.endingDate" is not valid.
    Make sure all parentheses are properly matched and that the filter uses
    proper Java syntax.
    at com.solarmetric.kodo.query.FilterParser.evaluate(FilterParser.java:536)
    at com.solarmetric.kodo.query.QueryImpl.getExpression(QueryImpl.java:371)
    at com.solarmetric.kodo.impl.jdbc.runtime.JDBCQuery.getExpression(JDBCQuery.java:49)
    at com.solarmetric.kodo.query.QueryImpl.executeWithMap(QueryImpl.java:312)
    at com.solarmetric.kodo.query.QueryImpl.executeWithArray(QueryImpl.java:393)
    at com.solarmetric.kodo.query.QueryImpl.execute(QueryImpl.java:285)
    The Vote class is defined as:
    public class Vote
    // The pair (topic, period) is unique for all votes
    private Topic topic;
    private VotingPeriod period;
    private int count;
    The VotingPeriod class is defined as:
    public class VotingPeriod
    // the pair (startingDate, endingDate) are unique for all voting periods
    private Date startingDate;
    private Date endingDate;
    If the query is modified to be: "period.endingDate <= d" and
    the parameter is declared as "java.util.Date d", then the error
    is:
    javax.jdo.JDOException: com.ysoft.jdo.book.voting.VotingPeriod
    NestedThrowables:
    java.io.NotSerializableException: com.ysoft.jdo.book.voting.VotingPeriod
    at
    com.solarmetric.kodo.impl.jdbc.schema.dict.GenericDictionary.toSQL(GenericDictionary.java:122)
    at
    com.solarmetric.kodo.impl.jdbc.runtime.JDBCExpressionFactory$Constant.<init>(JDBCExpressionFactory.java:419)
    at
    com.solarmetric.kodo.impl.jdbc.runtime.JDBCExpressionFactory.getConstant(JDBCExpressionFactory.java:213)
    at com.solarmetric.kodo.query.FilterParser.eval(FilterParser.java:562)
    at com.solarmetric.kodo.query.FilterParser.getValue(FilterParser.java:668)
    at com.solarmetric.kodo.query.FilterParser.eval(FilterParser.java:601)
    at com.solarmetric.kodo.query.FilterParser.getExpression(FilterParser.java:677)
    at com.solarmetric.kodo.query.FilterParser.evaluate(FilterParser.java:527)
    at com.solarmetric.kodo.query.QueryImpl.getExpression(QueryImpl.java:371)
    at com.solarmetric.kodo.impl.jdbc.runtime.JDBCQuery.getExpression(JDBCQuery.java:49)
    at com.solarmetric.kodo.query.QueryImpl.executeWithMap(QueryImpl.java:312)
    at com.solarmetric.kodo.query.QueryImpl.executeWithArray(QueryImpl.java:393)
    at com.solarmetric.kodo.query.QueryImpl.execute(QueryImpl.java:285)
    David Ezzio
    Yankee Software

Maybe you are looking for