How can i validate(compare) two date type attribute in EO.

Hi All,
jdev version 11.1.2.1.0
i have created one EO where two date type attribute ToDate and FromDate now i want to add validation rule.
which validate that difference b/w ToDate and FromDate not more than 3 month.
How can i validate this?

You can create script expression
Something like
if((toDate.getTime()-fromDate.getTime())/(1000 * 60 * 60 * 24)>30)
  return true;
else
  return false;-Arun
P.S : Above example calculates based on number of Days (30). If you want 3 months, you need to put a logic - Simply 90 days? What about the months with 31 days and 28/29 days? etc.

Similar Messages

  • How to set default value to date type attribute.

    Hi,
    How to set default value to date type attribute.
    E.g I want to set u201C01/01/1999u201D to date attributes.
    First i want to set value and then i want to fetch the same & want to check equals.
    please suggest solution.
    Regards,
    Smita

    Hi,
    In wdinit() method u can set the date
    DateFormat df = new SimpleDateFormat("MM/dd/yyyy");
    Date today = Calendar.getInstance().getTime();
    String reportDate = df.format(today);
    wdContext.currentContextElement().setFromDate(reportDate);
    Another way you have set the this formate like that
    1. Create a Simple type under "Dictionaries->SimpleType" called DateFormat
    2. Select the type as "date"
    3. Go to the "Representation" tab and set the format as "dd/MM/yyyy" (or whatever u want, but month should be MM)
    4.Bind the context attribute to the type created now.
    Hope this helps u.
    Best Regards
    Vijay K

  • How can I upload text master data for attribute-only Charactertic?

    I can't create infosource for attribute-only Charactertic via direct update from Infoobject, because attribute-only Charactertics you can't choose from available infoobject.
    How can I upload text master data for attribute-only Charactertic?
    Thanks!

    Hi roberto,
    I soloved the problem. I can input the attribute-only char directly in the text box instead of choosing from list of infoobjects, but I still can't find the char in infoobject selection dialog even using search.

  • How can i modify SLT mapping data types ?

    I am modeling an Attribute view in HANA sp05 and i need to create a join betwwen two standard tables CRMD_ORDERADM_H and SRRELROLES using files GUID and OBJKEY.
    these two fields have two different types of data ( GUID = RAW and OBJKEY = CHAR).
    When SLT replicate these files in HANA the data types are (RAW = VARBINARY and CHAR = NVARCHAR). I can't create these join in HANA.
    So i have to change the transformation rule in in SLT for something like: In table SRRELROLES for field OBJKEY the tranformation rule will be (CHAR to VARBINARY).
    How can i do this in SLT?
    I have to use the transaction IUUC_REPL_CONTENT?
    OR
    Can I insert records in tables IUUC_REPL_TABSTG and IUUC_REPL_TAB_DV ?
    Thanks and best regards for all!

    HI,
    use IUUC_REPL_CONTENT. It will insert the relevant values to table IUUC_REPL_TABSTG and IUUC_REPL_TAB_DV .
    Best,
    Tobias

  • How can I retrieve a LONG data type using ADO

    In VB I am using an ADODB object to retrieve data from an Oracle table that has a LONG data type column...
    specifically: SELECT TRIGGER_BODY FROM USER_TRIGGERS WHERE TRIGGER_NAME = 'MYTRIGGER'
    I have tried using the GETCHUNK method but it only returns the first 150 or so characters no matter how
    many times I call it???? here is the sample code I'm using........
    Dim Cn As ADODB.Connection, Rs As ADODB.Recordset, SQL As String
    Dim sChunk() As Byte
    Set Cn = New ADODB.Connection
    Set Rs = New ADODB.Recordset
    Cn.CursorLocation = adUseServer
    Cn.Open "Provider=OraOLEDB.Oracle.1;Password=hrzadmin;Persist Security
    Info=True;UserID=hadmin;Data Source=xxx.local"
    SQL = "SELECT trigger_body from user_triggers where trigger_name = 'MYTRIGGER'"
    Rs.Open SQL, Cn, adOpenStatic, adLockReadOnly
    Debug.Print Rs!trigger_name
    Debug.Print Rs!trigger_body
    sChunk = rs.Fields("trigger_body").GetChunk(500)
    Debug.Print sChunk

    I have a similar code which works for chunk size >400,
    The image I am trying to retrieve is huge so the chunksize is also more.
    Did you try with any non meta table?
    For your reference I am pasting my application code below.
    Hope it helps.
    --Jagriti
    Private Sub cmdGetImage_Click()
    Dim bytchunk() As Byte 'variable to store binary data
    Dim destinationFileNum As Integer 'variable for filenumber
    'recordset for fetching Product Image for the product selected form the list
    Dim recProductImage As New ADODB.Recordset
    Dim offset As Long
    Dim totalsize As Long
    Dim roundTrips As Long
    'variables used in calculation of time taken to fetch the image
    Dim startTime As Currency, EndTime As Currency, time As Currency, Freq As Currency
    Dim i As Integer 'counter variable
    i = 0
    On Error GoTo ErrorText 'redirect to error handler
    '** Step 1 **'
    'validating if product is selected from the list
    If cboSelectProduct.Text = "" Then
    MsgBox "Select product from the list!"
    Exit Sub
    End If
    '** Step 2 **'
    'validating if "optChunk" optionbox is selected then
    '"txtChunksize" textbox should contain a value
    If optchunk.Value = True Then
    'validate if chunksize value is null
    If txtChunkSize.Text = "" Then
    MsgBox "Enter value for chunksize "
    Exit Sub
    End If
    'validating that the chunk size entered should be a positive value
    If CInt(txtChunkSize.Text) < 1 Then
    MsgBox "ChunkSize value should be positive!"
    Exit Sub
    End If
    End If
    '** Step 3 **'
    'open image column from product_information table using m_Oracon connection
    recProductImage.Open "SELECT product_image FROM product_information " & _
    " WHERE product_id =" & cboSelectProduct.ItemData(cboSelectProduct.ListIndex) _
    , m_Oracon, adOpenStatic _
    , adLockOptimistic, adCmdText
    'check if product image exists for the product selected
    If Not IsNull(recProductImage!product_image) Then
    'setting mouse pointer on the form "frmChunkSize" to wait state
    frmChunkSize.MousePointer = vbHourglass
    '** Step 4 **'
    'assigning "desitinationFileNum" variable to next file number
    'available for use
    destinationFileNum = FreeFile
    'allocates a buffer for I/O to the temporary file "tempImage.bmp"
    'at the current application path
    Open App.Path & "\tempImage.bmp" For Binary As destinationFileNum
    '** Step 5 **'
    'Get the frequency of internal timer in Freq variable
    QueryPerformanceFrequency Freq
    'start the timer
    QueryPerformanceCounter startTime
    'clear "imgProduct" imagebox
    imgProduct.Picture = LoadPicture("")
    '** Step 6 **
    If optValue.Value = True And optchunk.Value = False Then
    '** Step 7 **
    'using ADO Value property
    bytchunk = recProductImage("product_image").Value
    'appending byte arrary data to the temporary file
    Put destinationFileNum, , bytchunk
    'displaying "No. of Round Trips" in a label to 1
    lblRoundTrips = 1
    ElseIf optchunk.Value = True Then
    '** Step 8 **
    'converting the value entered "txtChunkSize" textbox to long
    'and assigning it to chunksize variable
    m_chunksize = CLng(txtChunkSize.Text)
    'assigning the actual size of the image retrieved to a variable
    totalsize = recProductImage("product_image").ActualSize
    'calculating and assigning the "No. of Round Trips" to a variable
    roundTrips = totalsize / m_chunksize
    'in case fragment of data left, incrementing roundtrips by 1
    If (totalsize Mod m_chunksize) > 0 Then
    roundTrips = roundTrips + 1
    End If
    'In this loop the image is retrieved in terms of chunksize
    'and appended to the temporary file
    Do While offset < totalsize
    '** Step 9 **
    'retrieving product_image from the recordset, in chunks of bytes
    bytchunk = recProductImage("product_image").GetChunk(m_chunksize)
    offset = offset + m_chunksize
    'appending byte arrary data to the temporary file
    Put destinationFileNum, , bytchunk
    Loop
    'displaying "No. of Round Trips" in a label
    lblRoundTrips = roundTrips
    End If
    '** Step 10 **'
    'stop the timer after image retrieval is done
    QueryPerformanceCounter EndTime
    'close the opened file handle
    Close destinationFileNum

  • How can I create a custom data type that is a 2D array of string by using TestStand API?

    Hi all,
    I'm new in TestStand:
    I'm able to create a custom data type that is a 1D array of string but I cannot find the way to create a 2D array of string.
    Can anyone help me?
    Thank you in advance.
    Federico

    I made it!!
    Indeed my 2D array is an item of a container:
    /*  Create a new container */
    RunState.Engine.NewPropertyObject(Locals.NewDataType,PropValType_Container,False,"",0)
    /*  Create an array of strings as item of the container */
    Locals.NewDataType.NewSubProperty("Array_2D",PropValType_String,True,"",0)
    /*  Reshape the array as an empty 2D array */
    Locals.NewDataType.GetPropertyObject("Array_2D",0).Type.ArrayDimensions.SetBoundsByStrings("[0][0]","[][]")
    being:
    NewDataType a local property (type Object)
    Attachments:
    AddCustomTypeAndCreateFileGlobals.seq ‏11 KB

  • How can I validate that start date occors on or before end date?

    I am using jDev 11.1.1.6.0
    I have a effectiveStartDate and and an effectiveEndDate and I want to validate that if both dates are specified, that the effectiveEndDate occurs on or after the effectiveStartDate.
    I have added validators in my backing bean as shown below, but there is still a problem
    Consider the following scenario:
    1) set effectiveStartDate to 1/1/2011
    2) set effectiveEndDate to 1/1/2010
    I get the validation, as expected. Now
    3) I change effectiveStartDate to 1/1/2010, but the validation message remains on effectiveEndDate because I did not update the effectiveEndDate.
    Can I remove the faces message somehow?
    Can I re-trigger the validation?
    My .jsff page contains
    <af:inputDate label="#{ZspBusinessRulesAttrBundle['ColAttr.StartDate.RuleFolderEffectiveStartDate.RuleFolderEO.EffectiveStartDate']}"
    id="id1"
    value="#{pageFlowScope.manageRuleFolder.effectiveStartDate}"
    autoSubmit="true" required="false"
    validator="#{pageFlowScope.manageRuleFolder.startDateValidator}"
    partialTriggers="id2">
    <af:convertDateTime pattern="#{applCorePrefs.dateFormatPattern}"/>
    </af:inputDate>
    <af:spacer width="10" height="10" id="s4"/>
    <af:inputDate label="#{ZspBusinessRulesAttrBundle['ColAttr.EndDate.RuleFolderEffectiveEndDate.RuleFolderEO.EffectiveEndDate']}"
    id="id2"
    value="#{pageFlowScope.manageRuleFolder.effectiveEndDate}"
    autoSubmit="true" required="false"
    validator="#{pageFlowScope.manageRuleFolder.endDateValidator}"
    partialTriggers="id1">
    <af:convertDateTime pattern="#{applCorePrefs.dateFormatPattern}"/>
    </af:inputDate>
    My backing bean contains
    public void startDateValidator(FacesContext facesContext,
    UIComponent uIComponent, Object object) {
    Date startDate = (Date)object;
    if (!Utility.validateStartDateAndEndDate(startDate,
    effectiveEndDate)) {
    throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR,
    Resource.getValidationEndDate(),
    null));
    public void endDateValidator(FacesContext facesContext,
    UIComponent uIComponent, Object object) {
    Date endDate = (Date)object;
    if (!Utility.validateStartDateAndEndDate(effectiveStartDate,
    endDate)) {
    throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR,
    Resource.getValidationEndDate(),
    null));
    }

    Although not ideal, I have worked around the problem. I'd prefer an approach that would retain the error messages on the component, but here is the best I could come up with. I changed the start and end date validators so that they do not throw a ValidatorException but rather add a faces error message that is not tied to any component. This causes the validation message to appear as a popup when changing the start or end date in such a way as to violate the constraint. Unfortunately, the message disappears when you click the ok button.
    The changes in the backing bean are as follows:
    public void startDateValidator(FacesContext facesContext,
    UIComponent uIComponent, Object object) {
    Date startDate = (Date)object;
    if (!Utility.validateStartDateAndEndDate(startDate,
    effectiveEndDate)) {
    AdfUtility.addFacesErrorMessage(facesContext, Resource.getValidationEndDate(),
    null);
    public void endDateValidator(FacesContext facesContext,
    UIComponent uIComponent, Object object) {
    Date endDate = (Date)object;
    if (!Utility.validateStartDateAndEndDate(effectiveStartDate,
    endDate)) {
    AdfUtility.addFacesErrorMessage(facesContext, Resource.getValidationEndDate(),
    null);
    }

  • How to use clob or blob data type in OWB

    how to use clob or blob data type in OWB?
    if OWB not surport these data type,how can i extract the large data type from data source

    The same question was asked just two days ago No Data Found: ORA-22992
    Nikolai Rochnik

  • How to compare two dates that should not exceed morethan 3 years

    hi all,
    can you please tell me how to compare two dates( basically dates are string type)
    that should not exceed more than 3 years? in JAVASCRIPT
    Thanks in Advance.

    This is not a JavaScript forum.
    [*Google* JavaScript Forum|http://www.google.co.uk/search?q=JavaScript+Forum&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-GB:official&client=firefox-a]
    Good luck.

  • How to compare two dates to know which one is greater than oher?

    how to compare two dates to know which one is greater than oher?
    Please search before asking basic questions.
    Edited by: Rob Burbank on Mar 27, 2009 9:26 AM

    Hi,
    If thse to date fields are of same type u can directly compare like this.
    regards,
    Bharat.

  • How can I get extract the data between two cursors on an XY graph

    How can I get extract the data between two cursors on an XY graph

    Well, you say xy graph, so this might be a more complicated problem.
    For a waveform graph it's trivial. Simply get the two cursor indices (property: cursor index) and apply them to array subset of the data. Is that all you need?
    Here's how the above code would look like. using cursor.index instead of cursor.x elimnates the need to include scaling information.
    For an xy graph, there could be multiple segments (e.g. imagine a spiral that passes the desired x range multiple times from both sides). This would neeed significantly more code for a general solution.
    Message Edited by altenbach on 11-24-2009 07:53 AM
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    cursorsubset.png ‏17 KB

  • How to Compare two Dates in java

    How to Compare two Date Field after getting the values from jTextField1.getText() and jTextField2.getText().

    Date d1=DateFormat.getDateInstance().parse(yourstring1);
    same for d2
    d1.compareTo(d2);
    could be that i misrememberd the exact naems of some functions or mixed up something in the equence of d1=

  • How to compare two date Objects

    Hi,
    I have two Calendar Objects, one is coming from client and one is my server time, I need to evaluate that incoming time with server time so that if it is sent before an hour back then i should not do anything on that request Object. I have converted the incoming String into Calendar Object and how can i evaluate these two Calendar Objects including their hours and minutes.
    Thanks in advance
    bajju

    bajjurireddy, ignore Mobiquity's post. It contains no useful information and will only serve to confuse and frustrate you.
    Mobiquity wrote:
    Also make sure that the two date objects are in the same date format..
    public static String DateToDateString(java.util.Date d, String dateFormat)
         throws ParseException {
              SimpleDateFormat sdf = new SimpleDateFormat(dateFormat);
              sdf.setLenient(false); // this is required else it will convert
              String dateString = sdf.format(d);
              return dateString;

  • How to compare two wage types?

    What is the best way to compare two wage types?
    For example, if I see the wage type attribute screen, I need to select M010 and M110 , one by one and
    compare visually only the wt attributes. It doesn't show the processing classes etc.
    Is there a report or tool to compare and list everything about two wage types?
    Thanks,

    Thanks Arun.
    RPDLGA40 is NOT doing what I was asking. But helps a lot to learn about a given wage type.
    RPDLGA20 has many uer interactions and I am yet to learn how to understand them
    Thanks,

  • How can I validate a date field in Portal Forms

    I have a date field in portal forms that I want to perform validation on to make sure it's in the proper format before being accepted (mm/dd/yyyy). How can I validate against that field?

    Hi Ben,
    I took the time to test and revise. This is code that will validate a date entry (format MM/DD/YYYY). Just paste this in the "Before the start of the form..." window of the Additional PL/SQL code section of the form. Then add validateDate(); into the onBlur event window of the field in question. Replace the CYCLE_END_DATE with the field name in question.
    HTP.P('
    <SCRIPT LANGUAGE=javascript>
    function validateDate() {
    var ddObj;
    var mmObj;
    var yyObj;
    var day;
    var mon;
    var year;
    var field_val;
    var field_name;
    for (var j=0; j < document.forms[0].elements.length; j++) {
    field_name = document.forms[0].elements[j].name;
    field_val = document.forms[0].elements[j].value;
    if (field_name.substring(field_name.indexOf(''DEFAULT.'') + 8, field_name.lastIndexOf(''.01'')) == ''CYCLE_END_DATE'') {
    var delimPos = field_val.search(/\//i);
    if (delimPos < 0)
    alert(''Invalid date entry! Please enter in MM/DD/YYYY format. '' +
    ''e.g, Dec 21, 2003 would be entered as 12/21/2003'');
    else
    if (field_val.length != 10)
    alert(''Invalid date entry! Please Please enter in MM/DD/YYYY format. '' +
    ''e.g, Jan 1, 2003 would be entered as 01/01/2003'');
    else {
    month = field_val.substring(0, field_val.indexOf(''/''));
    day = field_val.substring(field_val.indexOf(''/'') + 1, field_val.lastIndexOf(''/''));
    year = field_val.substring(field_val.lastIndexOf(''/'') + 1, 10);
    /* Need to subtract 1 from value because in Javascript, January begins with 0
    and ends with 11 for December */
    month = month - 1;
    ddObj = new Date(year, month, day);
    mmObj = new Date(year, month, day);
    yyObj = new Date(year, month, day);
    if (ddObj.getDate(ddObj.setDate(day)) != day)
    alert(''Invalid day!'');
    if (mmObj.getMonth(mmObj.setMonth(month)) != month)
    alert(''Invalid month!'');
    if (mmObj.getYear(mmObj.setYear(year)) != year)
    alert(''Invalid year!'');
    </SCRIPT>
    ');

Maybe you are looking for

  • Preparedstatement with two tables

    I try to use "preparedstatement" to insert two tables. Is there any posibility to control the constraint of the two tables? Assume that the two tables are master detail. Commit them both or rollback them both... An example would be very helpful.

  • Flash movie lagging after publishing

    Hello, I have a short animation in the beginning of my CP-projects, like an intro. When I publish the project and play it either in Flashplayer or via the htm-file, the "intro" flash movie is lagging a lot. It's like it's not fully loaded even though

  • File name extraction

    Hi, If have some data in the following form /n abc.doc /n def.txt /n hgi.doc /n If I want to display the file name between the newlines in the following way to the user: abc.doc def.doc hgi.doc How can I do it ??? A hint would be great. thanks @debug

  • CC manager won't update

    Running Mac 10.8.5  CC desktop manager says and update is available, but when I try to update I get this error:

  • Excel Macro Plotter

    Hello All, I am having a challenge in implementing a macro in excel that plots the waveform graph. I have made use of the LabVIEW Excel macro Example with modifications. The challenges are: 1.       In Excel, both x and y values do not start from zer