How to get Year from Date Report Parameter-Birt Report

vivekpv10
edited February 11, 2022 in Analytics #1
I created one birt report.It contains one report parameter with name "FromDate".User will insert it in a fromat like "dd/MM/yyyy". I want to get year(if date is 11/01/2013.i want to extract 2013 from this varaible) from this input parameter and want to pass this value to one stored procedure(ie data set).How can i do that.Can anyone pls share sample code

Comments

  • wwilliams
    edited December 31, 1969 #2
    use a date parameter and this
    BirtDateTime.year(params["FromDate"].value)

    or use text e.g. like you have above.
    01/01/2013

    Something like this will work
    myYear = params["FromDate"].value.substr(params["FromDate"].value.lastIndexOf("/")+1) ;
  • Lesbea
    edited December 31, 1969 #3
    I had a similar problem in the past, however i looked at from a different angle in driving the date selection from the dates stored in the datasource as a dynamic parameter. Normally then a date from the dataset is in a format which can be formatted/extracted by functions to give the year month day etc.
    Warning No formatter is installed for the format ipb
  • which parameter lookup name in maximo (like 'datelookup') use for month or year

  • There isn't one. You'll have to create it.
    http://www-01.ibm.com/support/docview.wss?uid=swg21605970&aid=1 keep in mind
    7.5.10
    Requirements for using lookups with Parameters
    To enable a parameter lookup, the parameter must have an equivalent attribute. This makes the
    parameter bound as noted in the beginning portion of the parameter secti
    on.
    Additionally, as noted above, unbound parameter values which have no attributes, cannot have a lookup.
    Domain lookups can only be used when bound to a field that has the domain assigned to it. The only two
    exceptions to this are the datelookup a
    nd yornlookuplist which can be associated to unbound parameter
    values.