Validate date in Xquery version "1.0" to be used in OSB

I have a requirement where i have to populate error code and messages if a date is invalid. For which I can use
xquery version "1.0" encoding "Cp1252";
(:: pragma bea:global-element-return element="Error" location="../../IDCardStatus/xsd/xsdError.xsd" ::)
declare namespace xf = "http://tempuri.org/IDCardRequest/xq/DateValidation/";
declare function xf:DateValidation($date as xs:string)
    as element(Error) {
<Error>
{if ((fn:concat(fn:substring($date,1,4),'-',fn:substring($date,5,2),'-',fn:substring($date,7,8))) castable as xs:date)
then
else
        <ErrorSeq>
        <ErrorCode>97534</ErrorCode>
  <ErrorMssg></ErrorMssg>
  </ErrorSeq>
</Error>
declare variable $date as xs:string external;
xf:DateValidation($date)
But castable is not implemented in Oracle Fusion Middleware Xquery implementation and Try Catch can be used if Xquery throughs error but are implemented in xquery version "3.0" and Oracle Fusion Middleware still uses version "1.0". Please Help as its a common requirement in most of the projects i have come along.Thanks in anticipation

Sorry, I assumed you were using 12c.  OSB 11g supports the XQuery 1.0 W3C Working Draft from 23 July 2004 and also does not include the castable expression.  OSB 12c supports the full XQuery 1.0 recommendation (including the castable expression). 

Similar Messages

  • How to validate a date in xquery transformation

    i am doing the xquery transformation for mfl(non-xml) and xml
    i have a date-pickup and i should validate this field as my datatype is date , instead of date i am getting the data as 00000000 ,my date-pickup format is yyyymmdd
    can we do a validation for this specific field and all the failed date validations should be written as blank tag in xsd
    Please give me a suggestion for this

    Hi,
    There's a xquery extension function that you can use for that
    fn-bea:date-from-string-with-format
    The fn-bea:date-from-string-with-format() function returns a new date value from a string source value according to the specified pattern.
    The function has the following signature:
    fn-bea:date-from-string-with-format($format as xs:string?, $dateString as xs:string?) as xs:date?
    where $format is the pattern and $dateString is the date. For more information about specifying patterns, see Date and Time Patterns.
    Examples:
    fn-bea:date-from-string-with-format("yyyy-MM-dd G", "2005-06-22 AD") returns the specified date in the current time zone.
    fn-bea:date-from-string-with-format("yyyy-MM-dd", "2002-July-22") generates an error because the date string does not match the specified format.
    fn-bea:date-from-string-with-format(“yyyy-MMM-dd”, “2005-JUL-22”) returns the specified date in the current time zone.
    http://docs.oracle.com/cd/E13162_01/odsi/docs10gr3/xquery/extensions.html#wp1297249
    Cheers,
    Vlad
    It is considered good etiquette to reward answerers with points (as "helpful" - 5 pts - or "correct" - 10pts)
    https://forums.oracle.com/forums/ann.jspa?annID=893

  • OSM Order Data Rule - XQuery doesn't loop

    Hi
    I'm using OSM 7.2.0.3 and I have cartridge with an Order Recognition Rule, with its Order Data Rule (inside Transformation tab)
    In the ODR I have this XQuery code:
    declare namespace im="http://xxx";
    declare namespace xs="http://www.w3.org/2001/XMLSchema";
    declare variable $ord := fn:root(.)/im:Order;
    <_root>
    <Order>
    for $moli in $ord/MainOrderLineItem
    return
    $moli/LineItemAttributeInfo/LineItemAttribute
    </Order>
    </_root>
    The XML input to the OSM is:
    <?xml version="1.0" encoding="UTF-8"?>
    <ord:CreateOrder
         xmlns:ord="http://xmlns.oracle.com/communications/ordermanagement">
         <im:Order xmlns:im="http://xxx"
              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xsi:schemaLocation="http://xmlns.oracle.com/communications/sce/dictionary/BaseOrderCommonCartridge/DataDictionary_BaseOrderCommon ../dataDictionary/DataDictionary_BaseOrderCommon.xsd">
    <OrderHeader>
    <OrderID>12345</OrderID>
    <RevisionNumber>1</RevisionNumber>
    </OrderHeader>
    <MainOrderLineItem>
    <LineItemAttributeInfo>
    <LineItemAttribute>
    <AttributeID>1234</AttributeID>
    </LineItemAttribute>
    </LineItemAttributeInfo>
    </MainOrderLineItem>
    <MainOrderLineItem>
    <LineItemAttributeInfo>
    <LineItemAttribute>
    <AttributeID>5678</AttributeID>
    </LineItemAttribute>
    </LineItemAttributeInfo>
    </MainOrderLineItem>
    <MainOrderLineItem>
    <LineItemAttributeInfo>
    <LineItemAttribute>
    <AttributeID>abcd</AttributeID>
    </LineItemAttribute>
    </LineItemAttributeInfo>
    </MainOrderLineItem>
         </im:Order>
    </ord:CreateOrder>
    (sorry I don't know how to make the code shown formatted)
    There are 3 occurences of <MainOrderLineItem>'s but the output is only 1:
    <LineItemAttribute xmlns:im="http://m1.com.sg/bcc/osm/com/ordermain" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <AttributeID>1234</AttributeID>
    </LineItemAttribute>
    Why is it not looping?
    Thanks a lot for your replies.
    Edited by: 967122 on Oct 24, 2012 1:41 AM

    Hi,
    I just corrected two lines of your XQuery
    xquery version "1.0";
    declare namespace ord="http://xmlns.oracle.com/communications/ordermanagement";
    declare namespace im="http://m1.com.sg/bcc/osm/com/ordermain";
    declare namespace xs="http://www.w3.org/2001/XMLSchema";
    declare variable $ord :=  fn:root(.)/ord:CreateOrder/im:Order;
    <_root>
    <Order>
    for $moli in $ord/MainOrderLineItem
    return
    $moli/LineItemAttributeInfo/LineItemAttribute
    </Order>
    </_root>
    Thanks
    Naveen Jabade

  • Validate Data in Web Form

    we want to validate data in web form in planning through Java Script Code ?
    how we can do it and what is the location of that Java Script file ?
    One more thing ... if we make any changes in Java Script code then is it necessary to stop and start planning server or application ?
    Thanks in Advance ..... :-)

    Hi,
    you can resolve this problem, adding a JavaScript code in validateData.js.
    For example you can change and/or insert the code in validateForm function, that save the data only if the function return true.
    There are also another function and the code example in SampleValidateData.js that you can see.
    You find the ValidateData.js in the folder "custom" of your installation.
    For example:
    /default web application directory/deployments/your web server/HyperionPlanning/webapps/HyperionPlanning/custom
    I report an example for control the data before saving it:
    function validateForm(){
    if (equalsIgnoreCase(applicationName,"BDG"))
    if (equalsIgnoreCase(formName,"1.10A ECO"))
    var rowPrecVers = currentDataGrid.endRow;
    var colPrecVers = 2;
    var rowActVers = 3;
    var colActVers = 3;
    var valTotPrecVers = 0;
    var valTotActVers = 0;
    valTotPrecVers = currentDataGrid.fullPrecision[rowPrecVers][colPrecVers];
    for(rowActVers; rowActVers < currentDataGrid.endRow; rowActVers++){
    valTotActVers = valTotActVers + parseFloat(currentDataGrid.fullPrecision[rowActVers][colActVers]);
    if(valTotPrecVers < valTotActVers){
    alert("Ops!!!Don't match" + "\n"
    + "Previous Version: " + valTotPrecVers + "\n"
    + "Actual Version: " + valTotActVers);
    valid = false;
    return valid;
    else{
    return valid;
    Insert and modify this code in validateForm function.
    If in your installation use Tomcat web server, you must save the change on the ValidateData.js file each time. If you use the WebLogic web server tou must restart the service. For other web server I don't know.
    Take it easy and have fun!!!
    Flavio

  • Getting error while tring to Check in any document in Sharepoint 2007. Error - "Unable to validate data. System.Web.Configuration.MachineKey.GetDecodedData(Byte[] buf, Byte[] modifier, Int32 start, Int32 length, Int32& dataLength) ...

    Hi Team,
    I am getting error while tring to Check in any document in Sharepoint 2007. Error - "Unable to validate data. System.Web.Configuration.MachineKey.GetDecodedData(Byte[] buf, Byte[] modifier, Int32 start, Int32 length, Int32& dataLength).
    Anybody please let me know how to resolve the issue. It has affected our 9 site collection with almost 2000+ sites. Please email me your your suggestion or you can share your ideas here also.
    Tried to reset the IIS, checked the Internet connection speed (8MBps). Cleared the cache and all but no luck.
    Thanks,
    Pronob

    Hello,
    I have found this support window for you:
    http://support.microsoft.com/kb/556031
    http://technet.microsoft.com/en-in/library/cc298582%28v=office.12%29.aspx
    This may help you
    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

  • Adobe Reader XI did not save the form data (unlike previous versions). Any way to recover file?

    Adobe Reader XI did not save the form data (unlike previous versions). Any way to recover filled form with data from temp locations?
    I was not aware that ctrl+s no longer works in reader and closed the PDF after savign it(with ctrl+s). However ,the data is lost and there seems to be no way to recover it.
    I cannot find any temp files created by Reader on my system.
    Also to my surprize(and shock), the reader did not even show a warning before closing the PDF. Does anybody know if/where can I recover the file from?
    Guys, Please reply ASAP if you have got any sort of solution!

    Hi Pat,
    Are you using Adobe Reader XI? And not Acrobat. It does not ask me to save the form if there are unsaved changes.
    I have used previous versions of reader for saving this form data and it did allow me to save it with ctrl+s. And those versions did prompt me to save the changes before closing.
    I guess I should not have updated the reader.

  • Which driver to use for Satellite A300 - Latest one, by date or by version?

    For my laptop (A300-1HV) I am looking at the driver downloads available.
    There are many drivers which have a LATER modified date but LOWER version number.
    Or if you like, an EARLIER modified date and HIGHER version number.
    How do I decide which is the most up-to-date driver?
    Thanks.

    You can install your own operating system without problems. As you can see all necessary drivers, tools and utilities you can find on Toshiba support page.
    To be honest I do not understand what confuses you so much. Usually there is one driver for each hardware component and just one version for each tool or utility.
    If you have question about some specific driver or tool please let us know and we can try to help you.
    Please install all stuff following installations order. If you cannot find it let us know.
    Good luck!

  • How to validate Date

    Hi,
    We have a date field in the form. I am validating date format as YYYY-MM-DD, validation works fine. But If user enters invalid date, how to validate date? For examples:
    2006-02-31 It is an invalid date. How can i validate it.
    If anybody have sample code, it will help me a lot.
    thanks
    Neopal.

    Hi Neopal,
    You can use something like the following to test the date is valid, use the validation event on the <Field> which you want to validate to call a Rule something like this (not complete)..
      <Rule name='isDateValid'>
            <RuleArgument name='date'/>
            <block>
           <script>
              var dateToTest = env.get('date');
              var formatter = new java.text.SimpleDateFormat('YYYY-MM-DD');
              Date validDate = formatter.parse(dateToTest);

  • Function Module to validate date

    Hi,
    Is there a Function module to validate date in transfer rules or update rules. I checked the forum, couldn't find an answer. Any help is appreciated
    Thanks
    Bala

    You should be able to use this FM:
    CALL FUNCTION 'RSAR_DATE_CHECK_PLAUSIBILITY'
      EXPORTING
        i_date                          = yourdate
    EXCEPTIONS
       PLAUSIBILITY_CHECK_FAILED       = 1

  • How to validate date picker value

    Hi,
    When a date is entered manually in the date picker .ie 01/03/08 the year 08 is saved as 0008 in the database rather than 2008. How to validate the value in date picker to save the year as 2008 instead of 0008.
    Ven

    The date picker does not always "store" the value for you - you create it with a particular format such as DD-MON-YY and then like any character to date field you need to be careful to use a format mask and to_date. Alternatively, change the format to DD-MON-YYYY.
    Are you using this in a query or defined as a page item? Do you have the app on the APEX site?
    Phil

  • Validate Date Range in inputDate component

    Hi
    I am using JDev 11.1.1.2.0
    I have an inputDate component which on click i need to give dates from today to future dates not passed dates.
    So i have included 'validate date time range' component in the inputDate component and in the minimum property i have declared 'adf.currentDate' using expression builder and set the maximum as Jan 31,2099.
    But when i execute my application i am able to select passed dates using the inputDate component, please help how can i check the date using a validator in inputDate component.
    Thanks
    Sudeep

    ya i had tried with that property too....
    i have declared minValue as adf.currentDate and on that it changes the value of maxValue to current date in Jan 3,2012
    i have convertDatetime component in my inputDate to display the selected date in certain format.
    It gives error as the format doesnot matches with the convertDatetime and inputDate component.
    How can i use the minValue and maxValue of inputDate component?
    the component:-
    <af:inputDate
    label="Planned Termination Date"
    id="id2"
    value="#{modifyuser.pterminationdate}"
    valueChangeListener="#{modifyuserfields.plannedTermDate}"
    minValue="adf.currentDate" maxValue="2099-12-31">
    <af:convertDateTime pattern="dd-MMM-yyyy"/>
    </af:inputDate>

  • Validate date ?

    Dear All,
    May I enquire how to validate date for:
    textDateofLoss.getText()
    Is it:
    if isDate(textDateofLoss.getText()){
    //True date
    else{
    //False date}
    Please advise.

    Sorry, have to use the following:
    import java.util.*;
    import java.text.*;
    public class validateDate {
    public static void main(String args[]) {
    String dt = "10-10-1990";
    String format = "dd-mm-yyyy";
    // String dt = "1990-10/10" throws a ParseException
    // String dt = "1990-10-35" throws a IllegalArgumentException
    try {
    //DateFormat df =
    //DateFormat.getDateInstance(DateFormat.SHORT);
    SimpleDateFormat df = new SimpleDateFormat(format);
    df.setLenient(false); // this is important!
    Date dt2 = df.parse(dt);
    System.out.println("Date is ok = " + dt2);
    catch (ParseException e) {
    System.out.println(e.getMessage());
    catch (IllegalArgumentException e) {
    System.out.println("Invalid date");
    }

  • Validate date using RE

    Hey guys,
    Need to validate date using RE in format MM/DD/YYYY and optional HH:MM:SS
    I already have simple solution, but would like to add checks for leap year and dates like 02/30/2006 or 04/31/2006
    So far I have this:
    private static final String datePattern =
         "^(0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])[- /.](19|20)\\d\\d" +
         "(\\s(([0-1]?[0-9]|2[0-3]):([0-5]?[0-9]):([0-5]?[0-9]))){0,1}$";

    A much better way is to specify the format of the data and parse it using the SimpleDateFormat class method parse.

  • Validate date of Birth

    How I can validate date of birth?
    Month-Date-Year
    Example: 11-21-1960
    Thanks

    You could use a regular expression:
    E.g.
    var dateRegExp = "^(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])-(19|20)\d\d$"; // mm-dd-yyyy
    if (oField.rawValue.search(dateRegExp) === -1) {
         // error!
    Or you could use a date object as suggested in the previous post, but also stop the user from typing in a date so they will be forced to use the date selection box. This would ensure that the date is always in the correct format. To stop the user from typing in data, put the following code in the change event for the field:
    if (xfa.event.change.length == 1) {
    xfa.event.change = "";

  • Validate Date and block JavaScript page change

    how I can validate date acrobat, can block JavaScript page change, only change with a button? 

    If you use the "util.scand" method date validation is part of the process. It either returns the number of milliseconds from the Epoch date used by JavaScript for the date time object the null value.
    Date Arithmetic has some sample scripts, but you need to keep in mind that Date and Time are not independent and using "new Date()" returns the date and time at the time that line of code is executed and that can cause issues for the computing of dates only.
    Are you sure of day count, most differences include the start and end dates in the number of days for the calculation.
    Custom calculation for today's date field (format is None):
    // get today's date an time
    var oToday = new Date();
    // set to start of day
    oToday.setFullYear(oToday.getFullYear(), oToday.getMonth(), oToday.getDate(), 0, 0, 0, 0)
    // set field value
    event.value = util.printd("d/mm/yyyy", oToday);
    Custom calculation for the difference in days field (format None):
    var cEnteredDate = this.getField("EnteredDate").value;
    var cToday = this.getField("Today").value;
    event.value = "";
    if(cEnteredDate != "" && cToday != "") {
    // process only if date values not empty
    // convert date strings to date time objectat midnight
    var oEnteredDate = util.scand("d/mm/yyyy", cEnteredDate );
    if (oEnteredDate == null) {
    app.alert("Error in processing entered date", 2, 0);
    oEnteredDate.setFullYear(oEnteredDate.getFullYear(), oEnteredDate.getMonth(),oEnteredDate.getDate(), 0, 0, 0, 0) 
    var oToday = util.scand("d/mm/yyyy", cToday);
    if(oToday ==  null) {
    app.alert("Error converting today", 2,0);
    oToday.setFullYear(oToday.getFullYear(), oToday.getMonth(),oToday.getDate(), 0, 0, 0, 0) 
    // convert date objects to days
    var nEnteredDate = Math.floor(oEnteredDate.getTime() / (1000 * 60 * 60 * 24));
    var nToday = Math.floor(oToday.getTime() / (1000 * 60 * 60 * 24));
    // compute & format the difference
    event.value = util.printf("%,0 1.0f", (nToday - nEnteredDate));

Maybe you are looking for

  • Why can't I read any of my resources in a jar file?

    For an application I was developing, I wanted to create a Binary File using the following code: DataInputStream in = null;         try {             File file = new File(name);             in = new DataInputStream(                     new BufferedInp

  • External Cache Failure reported and computer won't boot

    I have a highly upgraded Digital Audio G4 (originally a single processor 533 Mhz, now a Dual 1.2 Mhz). The machine has been running through many ups and downs hangning in there for a while. Basically everything has been upgraded except the motherboar

  • Why does my voice effect change the way my music sounds too?

    I have an instrumental track that I was recording my voice over and I put my vocals in the Mouse Effect. When I played it back my music was in the mouse effect too. How can I just have my voice in Mouse effect and my music with no effect when I recor

  • Hiding based on responsibility

    This is probably an easy one to answer, however I am a bit new to the OA world. I have a custom page (11.5.10) and I want to hide an image based on a user's responsibility. I have a switcher region for the page working fine (with two images) based on

  • Iphoto 2014 won't open old photos

    I downloaded Mavericks 10.9.2 but my iPhoto when it opens says I will lose all my old photo's and I need to quit. I dragged the app to my trash and reintalled it from the App Store, and it still does the same thing. HOW do I recover my old photos whi