Calculate A Fixed Length Future Date Based On User Provided Date

Does anyone know how I would (using date field) have a user choose a date (call it Field1) and have it calculate 30 days from whatever date is chosen in Field1) and auto populate it in another filed (call it Field2). Ideally user would not have to 'click' in Field2 to have information populated...
So user picks January 1st in Field 1 + 30 days = January 30th in Field 2

Well for the life of me I can't figure this out. Given the code:
DateTimeField2.rawValue = Num2Date(Date2Num(xfa.event.newText, "M/D/YYYY")+30,"MM/DD/YYYY");
It should add 30 days to the chosen date. But some reason it's off by a day. If I choose 6-1-2010 it picks 7-1-2010, if I pick 7-1-2010 it picks 7-31-2010. I'm really stumped where it's picking up the extra day?

Similar Messages

  • How to determine Organizational Data based on User Login

    Dear all,
    How to determine organizational data based on user login in Activity transaction, currently org determination is happening after entering customer number in the transaction.
    We have used 'Responsibility' determination rule for this configuration. Now the requirement is to determine org data based on user login.
    In Org model we have assigned user to org data through a business partner. But still org data is not getting determined in the transaction.
    Please help me to trace out the problem.. your suggestions will be highly appreciated.
    Best regards
    Raghu ram

    You just have to use other organization determination rule. In your case this would be rule 10000194 (ORGMAN_12). This determination rule delivers the responsible organizational unit of the user
    User is defined as a business partner in the container attribute 'PARTNER'. If not, the system user (sy-uname) is used.
    So you have to do the following:
    - use this determination rule
    - in BP link username with employee
    - assign in PPOMA_CRM employee or user to organizational unit
    This should solve your problem.

  • Function module to give a date based on a particular date and interval.

    Hi there,
    I am writing a code where I need to to find another date
    based on a key date and and an interval.
    Is there any function module where I pass the date and the interval
    (say 30) and it gives me a new date after subtracting 30 from it.
    Or is there any piece of code which does it?
    Thanks in advance.
    Regards,
    Kate

    hi Kate,
    you can try ?
    data : date2 like sy-datum.
    date2 = yourdate - 30.
    hope this helps.

  • How to display filtered data based on user login

    We have a SSRS report (.rdlc) which gives the report about Online count of machines. Report is incoperayed in Asp.net.
    We have many filters in This report. Now we have to retrict the report based on user login to the application .
    For ex: report has a drop down for Regional Admin. Now if one person login to the application he has to view only his region online count.
    How can we do this in SSRS?. We have our application hosted in Microsoft Azure . Please suggest

    Hi csmbrnoc,
    In Reporting Services, if we want to filter data based on user login, then there must be some relationship between the UserID and the Region in the dataset. For example, there is a field named UserID in the dataset, and each ID map some region and the corresponding
    “Online count of machines”. In this scenario, just as Visakh suggested, we can use built-in field User!UserID to obtain UserID of the current user, then directly add a filter to the dataset as below:
    Expression: [UserID]
    Operator: =
    Value: [&UserID]
    If there are any other questions, please feel free to let me know.
    Thanks,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • User-Provided Data: Scrubbing & Displaying Thereof

    I'm in the middle of completely rebuilding an old application from the ground up and wanted to get some feedback on user-provided data and security, see what new methods people are using, and get some general feedback. With past applications I've always made use of CFQUERYPARAM on my database transactions, verified the proper length of all data provided by the user, and ran each form field through a custom tag that, rather harshly, checked for characters commonly used within SQL injection strings and cross-site scripting attacks. This time around I'd like to maintain, if not increase the security of my application when it comes to user-provided data, but at the same time not hinder or upset users by blocking just so many "suspect" characters.
    Of course about half of the user data I get can be scrubbed easily enough: E-Mail addresses, passwords, telephone numbers.
    Where I've run into problems in the past is the more free-form fields such as names, addresses, search criteria, and "comments" boxes, all which could easily have characters such as ', /, %, --, and the like. In the past I've judged these and many other characters harshly but I wonder if I've been too harsh?
    So, I'm curious to hear some opinions on the much-discussed topic of SQL injection and XSS and how it relates to user-provided data.
    What characters are you checking for in user data? How do you go about handling them? Escape them? Remove them? Generate an error to the user?
    Some things I've heard in the past that I'm curious if people do:
    01) htmleditformat() every piece of user data as it is outputted as text within a page.
    02) htmleditformat() every piece of user data as it is inserted into the database. An issue with this is that as htmleditformat() translates characters into lengthy ASCII strings and often extends user input beyond the MAXLENGTH of the given form/database field, and the customer won't understand why.

    Some reccomendations:
    1. Continue use of CFQUERYPARAM and data length/type verification.  This should keep you safe from SQL injection.
    2. Use HtmlEditFormat for output only.  Using HtmlEditFormat for input will cause a problem if the text is ever consumed by an application that doesn't understand HTML entities.
    3. Use a whitelist/blacklist specific to the data you are collecting.  For example, I think you can safely assume that a first name won't contain angle brackets. 
    4. Take a look at the Portcullis project.  From RIA Forge: "Portcullis is a CFC based url,form,cookie filter to help protect against SQL Injection and XSS (Cross Site Scripting) attacks."
    http://portcullis.riaforge.org/
    5. Tell the user when you're going to replace/escape their input with something else.  This will keep your site user friendly.

  • How to populate date & time when user enter data for custom table in sm30

    Can anyone tell me How to populate system date & time when user enter data for custom table in sm30..
      Req is
      i have custom table and using sm30 user can enter data.
    after saving date i want to update date & time in table
    Pls let me know where to write the code?
    Thanks in Advance

    You have to write the code in EVENT 01 in SE54 transaction. Go to SE54, enter your Ztable name and in the menu 'Environment-->Events'. Press 'ENTER' to go past the popup message. In the next screen, click on 'New Entries'. In the first column, enter 01 and in the next column give some name for your routine(say UPDATE_USER_DATE_TIME). Then click on the souce code icon that appears in blue at the end of the row. In the code, you need logic like below.
    FORM update_user_date_time.
      DATA: f_index LIKE sy-tabix.
      DATA: BEGIN OF l_total.
              INCLUDE STRUCTURE zztable.
      INCLUDE  STRUCTURE vimtbflags.
      DATA  END OF l_total.
      DATA: s_record TYPE zztable.
      LOOP AT total INTO l_total.
        IF l_total-vim_action = aendern OR
           l_total-vim_action = neuer_eintrag.
          MOVE-CORRESPONDING l_total TO s_record.
          s_record-zz_user = sy-uname.
          s_record-zz_date = sy-datum.
          s_record-zz_time = sy-uzeit.
          READ TABLE extract WITH KEY l_total.
          IF sy-subrc EQ 0.
            f_index = sy-tabix.
          ELSE.
            CLEAR f_index.
          ENDIF.
          MOVE-CORRESPONDING s_record TO l_total.
          MODIFY total FROM l_total.
          CHECK f_index GT 0.
          MODIFY extract INDEX f_index FROM l_total.
        ENDIF.
      ENDLOOP.
    ENDFORM.                    " UPDATE_USER_DATE_TIME
    Here ZZTABLE is the Z table and ZZ_USER, ZZ_DATE, and ZZ_TIME are the fields that are updated.

  • Calculate depreciation start date based on user defined field in asset

    Hi,
    I have a specific scenario where the start of depreciation date for asset needs to be calculated on user-specific logic.There is a additional field "installation date" in asset master screens.The requirement is that for depreciation areas 10 and 11 user wants that the depreciation start date to be calculated on the installation date rather than capitalization date.
    I tried using the exit AMAV0001 where we can change the asset value date which determines the depreciation date at the time of first acquistion to asset.But the problem is we can't change it as per depreciation area wise and thats why posting error was coming.
    Please suggest if any idea on this.
    Thanks in advance.

    Hi Adriano,
    in your example 2 issues influence the described behaviour:
    1) In your example the revaluation occurs in the capitalization year, in which all acquisitions (and revaluations) are managed under the period for the first acquisition. Only as of the year following the capitalization year the period control "pro rata" would really consider the revaluation or another acquistion as of period 4. In case you want the period control also being considered according to the posting period in the capitalization year, set the indicator XBZDAT with the correction report from note  92925.
    That should solve your issue.
    2) In case you use the new depreciation calculation engine you have the possibility to use individual period controls for revaluation also. This means you could specify period control for acquisitions as "pro rata" and for revaluations "next month". To realize this create a new transaction type for revalutions as described in note 1138166 . Unfortunately this feature is not possible with the old depreciation calculation engine.
    Regards,
    Markus

  • Filtering report data based on user login and Parameter fields

    Post Author: mronquillo
    CA Forum: General
    Hi,I am running a report that filters data based on the user login. To do this, I created a formula called @user that compares the login name (using the CurrentCEUserName field) and returns the user's name. If the user login is not a login specified in the if statements, it returns the parameter field "user_name":For example: if CurrentCEUserName = "loginname1" then "User's Name 1"else if CurrentCEUserName = "loginname2" then "User's Name 2" else if CurrentCEUserName = "loginname3" then "User's Name 3"  else if CurrentCEUserName = "loginname4" then "User's Name 4".. .else {?user_name}   In select expert, I have a condition which filters data based on the string returned from that formula:{Table.Name} = {@user}  This works fine and when the users run the report they only their own data. However, they are still prompted to choose a parameter field regardless if of the value returned by the @user formula. Oddly enough, regardless of what parameter field they choose, they will still only see their own data (i.e. if John chooses "Bob" from the parameter list, he will still only see John's data.)If I remove the "else {?user_name}" line from the @user formula, then the users are not prompted anymore. However, if they are not a "valid" user - that is, if any of the if statements in the formula are not true for their login name - then they will see no data. What I want to do is make the report ONLY prompt the user to choose a parameter field if their login name is not "valid". That is, if the @user formula is able to return a string value for their login name, then they will jump right into the report without being prompted to choose a parameter - otherwise, the user will be prompted to choose a name from the parameter list. I thought my formula would allow this (hence the "else" clause), but it seems that if a parameter field is present in any formula, then the report automatically prompts the user to choose a parameter. Is what I am trying to accomplish possible in CR (I'm using CR v10.0) or is there a better way to do what I am trying to do?Thanks in advance.

    Post Author: sharonmtowler
    CA Forum: General
    try, or something like that
    (if CurrentCEUserName ={?user_name} then true else ({Table.Name} = {@user}) )

  • Grouping of data based on user prompt having a list of dimensions

    Hi All,
    I have a requirement to be able to group data in OBIEE request or Dashboard based on user prompt selection.
    The prompt should list the Dimensions Available
    e.g.
    Dimensions: Product, Region, Employee
    Fact: Sales
    The report is to display sales total for the quarters of the current year.
    The user prompt should list the available dimensions (In this case - Location, Employee and Product).
    If I choose Product, the data is to be grouped by Products - Layout having a simple tabular grouping with Product names as Group headings.
    Similarly any other choice of Dimension from the prompt should group the data by that dimension and have the dimension values used in the group headings.
    How could we implement this? I understand this type of requirement (ability to choose dimension) is met in some OLAP reporting tools.
    I have used multiple views and the View Selector for similar requirements previously, but looking for a dynamic solution here.
    Any pointers or solution will be great.
    Thanks,
    Kiran
    Edited by: Kiran Kudumbur on Sep 8, 2009 5:43 PM
    Edited by: Kiran Kudumbur on Sep 9, 2009 12:42 PM
    Edited by: Kiran Kudumbur on Sep 10, 2009 2:26 PM

    Hi All,
    I used column view to address this requirement.
    Thanks,
    Kiran

  • Creating report based on user selected Date Range

    Hello.
    I am trying to display an Apex report that selects data for the report based on a user entered date range.
    It's a simple page with two date picker fields (p18_start and p18_end).
    The report region SQL looks like this:
    SELECT *
    FROM prj_items
    WHERE LM_DT BETWEEN :p18_start AND :P18_end
    One table, one field on the table to search and two Apex variables.
    I thought this would be fairly simple, but I am obviously missing something.
    I not even sure what other information is needed to help me figure this out.
    -Jody

    Hi,
    You can set defaults for the datepickers if you need to - this could be done in a computation on the page for each item and conditional on the item being null.
    When I've done something similar to this, I've created two hidden page items - eg, :P19_FIRST_DATE and :P19_LAST_DATE and populated these with the earliest/latest date that the user could reasonably select (perhaps, in your case, the MIN(LM_DT) and MAX(LM_DT) values).
    Then your SQL would be:
    select * from PRJ_ITEMS
    where LM_DT BETWEEN TO_DATE(NVL(:P19_START,:P19_FIRST_DATE), 'DD-MON-YY')
    AND TO_DATE(NVL(:P19_END,:P19_LAST_DATE), 'DD-MON-YY')If you don't want to set default dates, you could do something like:
    SELECT * FROM PRJ_ITEMS
    WHERE (:P19_START IS NULL AND :P19_END IS NULL)
    OR (:P19_START IS NOT NULL AND :P19_END IS NULL AND LM_DT >= TO_DATE(:P19_START,'DD-MON-YY'))
    OR (:P19_START IS NULL AND :P19_END IS NOT NULL AND LM_DT <= TO_DATE(:P19_END,'DD-MON-YY'))
    OR (LM_DT BETWEEN TO_DATE(:P19_START,'DD-MON-YY') AND TO_DATE(:P19_END,'DD-MON-YY'))There are various reasons why your two dates are being cleared when the page is reloaded. Firstly, you should check the branch that returns to the same page - make sure you are not clearing the cache for the page. Then, have a look to see if there is a "reset page" process (usually created for you when you create a form page). Then, check the Source settings for the items. Typically, these would be "Only when current value in session state is null" and a Source Type of "Static Assignment" with the "Source Value or Expression" left empty.
    Andy

  • Number of occurences between two dates based on a starting date + frequence

    I have a starting date in cell A1 and a frequency (in days) in cell B1. In cell C1 I have a date (begin) and in cell C4 I have a later date (end). I need to know how often the event occurs during the time between begin and end dates (inclusive).
    For instance, the starting date is january 25th, the frequency is 5. The first date is januari 25th, the second date is februari 12th. The result should be 2 (because given the starting date and frequency of the event, it will occur in februari on day 4 and 9).
    I have been looking at some of the statistical functions, but I don't think there is a function for this. Right now I have about 5 formulas to calculate intermediate results, but I'm stuck trying to combine them.
    I would be happy with just a pointer in the right direction. For instance, is there a specific name for this kind of calculation?

    michielvoo wrote:
    I have a starting date in cell A1 and a frequency (in days) in cell B1. In cell C1 I have a date (begin) and in cell C4 I have a later date (end). I need to know how often the event occurs during the time between begin and end dates (inclusive).
    For instance, the starting date is january 25th, the frequency is 5. The first date is januari 25th, the second date is februari 12th. The result should be 2 (because given the starting date and frequency of the event, it will occur in februari on day 4 and 9).
    If the event occurs every five days, the second date will be January 30, and the event will occur four times " during the time between begin and end dates (inclusive)"
    I have been looking at some of the statistical functions, but I don't think there is a function for this. Right now I have about 5 formulas to calculate intermediate results, but I'm stuck trying to combine them.
    It's not really a statistical calculation, but a simple division to find "How many whole sets of five (days) are there in the days between two dates."
    I would be happy with just a pointer in the right direction. For instance, is there a specific name for this kind of calculation?
    Two functions and one operation are needed:
    DATEDIF() to calculate the number of days between the start and end dates.
    Division to determine how many sets of five days there are in that period.
    INT() to discard the fractional part of the result.
    With the values located as described, this formula (placed in a cell on the same table) will return the number of occurrences not including the first one.
    =INT(DATEDIF(C1,C4,"D")/B1)
    To include the Start date as one of the occurrences, make this modification:
    =INT(DATEDIF(C1,C4,"D")/B1)+1
    Regards,
    Barry

  • Select Data based on User Permissions

    Post Author: nomore
    CA Forum: General
    I've got a Crystal Infoview server which is becoming quite cluttered with reports.In a lot of instances, I will have 4 or 5 copies of the same report which are tailored to specifc users. For example a sales report which will show data based on a specific customer. I could create on report with a parameter where the user could just select the customer - but i dont want some people to be able to see specific customers. So at present i have a seperate report for each customer - and then set the report permissions to only allow specific users to run it.I attended a course a while back where they showed us how, hiding particular fields/data to certain users if they should
    not be allowed to view it - but for the life in me i cannot remember at
    all how they did it.  Any tips greatly appreciated.

    Post Author: V361
    CA Forum: General
    In the special fields section is CurrentCEUserName, not sure if this would work for you, because I have CR XI
    You could surpress based on the id logged in, but that would be a lot of work, 
    Perhaps you could create a "permissions" list in excel or in the database if possible, with a list of the reports that each ID can run, then based on the id, you populate the list....
    CurrentCEUserName inserts (in a formula) the name that was used to log on to the current session when using the Log On to BusinessObjects Enterprise dialog box.

  • Updating product revenue close date based off opportunity close date

    We do not use the product revenue close date, only the opportunity close date. We need to get the fiscal month of the opportunity close date but we have several reports the need to use the opportunity product history area and that does not contain the fiscal month for the opportunity. If we did a combined report, we cannot offer the user any prompts.
    Does anyone know how to get the opportunity close date fiscal month from the opportunity products area? Is there a way to update the product revenue close date when the opportunity close date it updated?
    Thanks

    Hi David,
    In the universe you describe you have the opportunity 'Close Date'. Use a 'case-when' expression to create the 'Fiscal Month' you need.
    Other than that you can use the JoinFieldValue function in the application to retrieve the opty close date, but that will require you to update product revenue for it to trigger which probably won't work for you.
    Good luck.

  • Output different data based on user select

    Hi everyone,
    Quick question, I would like to output different report columns based on user select, eg., users would be presented with two choices in a radiobutton list, eg., 1 and 2.
    I have query results that contain columns A, B, C, D, E, F, G.
    If user selects 1 then the output should be columns A, B, C, D, E.
    If user selects 2 then the output should be columns A, B, C, F, G.
    I am sure this is possible and easy? If so, what topic should I be reading/searching internet on?
    Please advise.
    Thanks!

    I would say that this is most often something that your user interface should be dealing with (i.e. which columns should be shown).
    There is no way to do that in SQL.
    In PL/SQL it is a simple situation of creating two cursors and simply deciding which one to open.
    <pre>declare
    l_cur sys_refcursor;
    begin
    if :user_selection = 1 then
    open l_cur for select A, B, C, D, E from tbl;
    else
    open l_cur for select A, B, C, F, G from tbl;
    end if;
    -- use the cursor
    close l_cur; -- or return to user interface
    end;
    /</pre>
    Hope this helps.

  • How to get field values in ALV based on user provided input

    Hi,
    In my ALV grid, I have 2 fields:
    1. Material ID
    2. Material Description
    When user provides input to Material ID field, the material Description field should get populated immediately.
    Note: Curretly I am able to do it based on the sy-ucomm = 'Enter', i.e. when the user presses "Enter" outside the ALV grid, I retrieve Description from Mat Table and populate this in Mat_Desc in ALV grid.
    I want to do the same operation whenever tab is pressed (not when user presses enter outside the ALV grid).
    Please provide your inputs for this.
    Thanks & regards,
    Ravish

    Hi Ravish,
    Check <b>BCALV_TEST_GRID_F4_HELP</b> program for F4 help on ALV Grid.
    Thanks
    Venkat.O

Maybe you are looking for