Age calculation in report builder query

I am using SQL reporting services 2008 and report builder I have setup a report where I want to calculate the age of each student. 
I have table called Students with a DOB field. 
I want to display the age of each student and also use the age field in a parameter. 
Any one have any ideas on best way of doing this.

Hi,
Below is my query and at the end I am trying to work out the age of student but when I run this I get an error "ORA-00933: SQL command not properly ended". Any one got any ideas.
SELECT  s.forename, s.surname, to_char(s.DOB,'dd-Mon-yyyy') DOB, s.gender,s.ethnic_or, s.post_code,p.prov_name,e.term_desc,e.fin_yr,e.age_calculation_date,lc.paid_amt,       lc.paid_hrs_term,lc.paid_status,lc.paid_hrs_wk,lc.yearlyentitlement,lc.act_hrs_term,lc.act_hrs_wk,lc.act_wks_term,lc.oth_settings,lc.unpaid_hrs
FROM     student s, provider p, ey_term e, la_service_provider lp, la_service_provider_detail ld, la_service_provider_service ls, la_serv_prov_child_hours lc, corresp_address c
WHERE   lc.term_id = e.term_id
AND             lc.stud_id=s.stud_id
AND             lc. LA_SERVICE_PROVIDER_DETAIL_ID =ld.LA_SERVICE_PROVIDER_DETAIL_ID
AND              LD.LA_SERVICE_PROVIDER_SERVICE_ID = LS.LA_SERVICE_PROVIDER_SERVICE_ID
AND      ls.LA_SERVICE_PROVIDER_ID = lp.LA_SERVICE_PROVIDER_ID
AND      lp.EARLY_YEARS_PROVIDER_ID = P.PROVIDER_ID
AND S.STUD_ID =C.entity_id (+)
select DATEDIFF(YEAR, '20121231', CURRENT_TIMESTAMP) as Age

Similar Messages

  • How to pass a date parameter from report builder query designer to oracle database

    i'm using report builder 3.0 connected to oracle database. i'm trying to pass a date parameter in the query with no success, i don't
    know the exact syntax. I've tried :
    SELECT * FROM igeneral.GCL_CLAIMS where CREATED_BY IN (:CREATED_BY) AND CLAIM_YEAR IN(:UW_YEAR) AND (LOSS_DATE) >To_Date('01/01/2014','mm/dd/yyyy')
    it worked perfectly.
    However if i try to put a date parameter "From" instead of 01/01/2014 it will not work, a Define Query Parameter popup window appear and error occurred after i fill
    the values (usually i shouldnt get this popup i should enter the value when i run the report)
    SELECT * FROM igeneral.GCL_CLAIMS where CREATED_BY IN (:CREATED_BY) AND CLAIM_YEAR IN(:UW_YEAR) AND (LOSS_DATE) >To_Date(:From,'mm/dd/yyyy')
    appreciate your assistance

    Hi Gorgo,
    According to your description, you have problem when in passing a parameter for running a Oracle Query. Right?
    Based on my knowledge, it use "&" as synax for parameter in Oracle, like we use "@" in SQL Server. In this scenario, maybe you can try '01/01/2014' when inputing in "From". We are not sure if there's any limitation for To_Date()
    function. For your self-testing, you can try the query in sqlplus/sql delveloper. Since your issue is related to Oracle query, we suggest you post this thread onto Oracle forum.
    Best Regards,
    Simon Hou

  • How to add a dynamic table name in Report Builder Query ?

    I have some problem while creating a report in report builder 6i.
    My data is managed as in tables like this abc_012006, abc_022006 etc , so I want to query data according to the month user have selected from the parameter form. Let suppose if user entered 012006 as month year then data must be fetched from abc_012006.
    Can any one tell me the appropriate tip for this problem.
    Message was edited by:
    [email protected]

    Hello,
    Once you get the Data Set create save it as XML and then create a new report off the XML file. Then you can set the data set to the report and the XML is not required any more.
    First, to be able add fields to a report you need to use RAS. Report.Engine doesn't have the ability.
    If you search in this forum you will find lots of examples on how to...
    If you want to create the report then see these RAS samples:
    http://wiki.sdn.sap.com/wiki/display/BOBJ/NETRASSDK+Samples#NETRASSDKSamples-Exporting%2FPrinting
    Don

  • Report builder query

    Hi i have a field in report builder with
    query.FacilityName & " " & query.Address
    what i need is the first part (query.FacilityName) to be in
    bold
    how would i do this?

    Use the string concatenation character (ampersand) instead of the plus sign.

  • SQL Report Builder Query

    Hi
    I've just started using SQL Report Builder to try and design some reports for work but have come across an issue, basically the report focuses on 2014 by displaying sales items by debtor,
    qty and value, however when another year is added and the report re-run the report does not include all of the debtors sold to in both years, only the debtors sold to in 2014.
    We use SQL Server 2008
    Thanks in advance for your help

    Hi Paullo15,
    According to your description, you can't get all expected records after your add a year in your report. Right?
    In this scenario, we want to know how you add this year in your report. We suggest you re-execute your query in SSMS and Query Designer to see if they can return same proper records. Also we need to know how you design the report. We suggest you use table/matrix
    to render the data.
    Please share some screenshots about the report design, report preview and quert result if possible. Thank you.
    Best Regards,
    Simon Hou

  • Aging calculation in report

    Hi Friends,
    I have a field 'CREATION_DATE' in the data provider.
    I have to populate the 'Aging' field as follows...
    AGING = Days between Current Date and Creation date.
    can anyone please help me on this.
    Thanks in Advance.
    Regards,
    Ravish

    Hi Ravish,
    Refer following document for the process along with detailed screenshots of creating customer exit variables:
    [http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/f002c608-2533-2c10-25a1-d0e7f7b5b662?QuickLink=index&overridelayout=true|http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/f002c608-2533-2c10-25a1-d0e7f7b5b662?QuickLink=index&overridelayout=true]
    You can also refer following SAP help document for further details regarding Customer Exits:
    [http://help.sap.com/saphelp_nw04/helpdata/en/f1/0a56f5e09411d2acb90000e829fbfe/frameset.htm|http://help.sap.com/saphelp_nw04/helpdata/en/f1/0a56f5e09411d2acb90000e829fbfe/frameset.htm]
    Note:
    In the code you can use the code given in my earlier posts.
    Regards,
    Geetanjali

  • Report Builder 2.0 returning duplicate rows in query designer

    Hi,
    I have a query running off a model, when I explore the data in the model and in a standard sql table it returns one row for each record, which include a unique id for each which is correct.
    When I go into report builder query designer, it shows duplicate rows for each record. I have removed and added fields to try and pin point why and the only reason i can come up with is that it runs fine until I add in a field thats varchar(255) or
    varchar(max). This is when it starts to duplicate the records.
    Can anyone tell me why it does this or point me in the direction of how to stop this. I can't edit the query in text to add DISTINCT so thats not an option.
    Many thanks,
    JJSJ

    OK - I have found a partial answer.   By Googling Report Builder and VARCHAR, I found another post which reported problems with the semantic query builder when the underlying table/view was returning columns of type VARCHAR(MAX).   
    On looking at the length setting for the data column in the DSV,  this reported a length of 2,147,483,647 for this field.   This is very odd because on querying the underlying table the largest length that I can find for this column is 191,086
    (which is far larger than I would have expected - I am investigating this separately).
    However, why should the Report Model think that this field contains such a large value?
    Anyway,  the other post that I found reported that they had solved their problem by converting the field to a VARCHAR (255).    I tried this (by casting the column in my View to VARCHAR(255))  and this resolved the problem
    - no more duplicate rows when adding this field to the query!!!
    I also tried CASTING to TEXT and to VARCHAR(8000).  The former did not resolve the problem; the latter did.
    So I have a workaround but I don't understand why.  
    Can anybody explain why having a VARCHAR(max) column in my entity causes duplicate rows.    
    I suspect it is to do with the fact that for some reason the Report Model seems to think that there is an exceptionally long text string stored in this column in one of the rows but that again is a puzzle.
    Thanks
    Richard

  • Report Builder Count Column

    How can I build a count column with a where clause based on a query defined in the report builder query screen? From what I can tell the built in count column does not allow the addition or definition of a where clause.
    Thanks

    Hi Ruth,
    Not exactly sure if this will answer your question, but here goes. It sounds like you want to count values based on certain conditions? If the where clause is already in your query, you can use the count function that's available in SQL and allow the database to perform the count for you. Otherwise you can use a formula column in combination with a placeholder column or a summary column to get the conditional count. In the formula column you can use plsql to determine if you want to increment your count or not. Depending on how you do it, you can either just return '1' or '0' from your formula column and create a summary column based on your formula column. Or you can increment a placeholder column from your formula column. If you decide to go with placeholders, I'd suggest reading the online help examples for placeholders as there are a few rules you'll have to go by.
    Hope that helps,
    Toby

  • Report Builder Question - OA AR Aging - and a general question

    I'm sure this is the wrong forum for this question, but I thought there might be someone here who might be using Oracle Applications and Report Builder who'd be kind enough to help me out.
    We've recently implemented Oracle Applications 11.5.10 and I have to use report builder to change the Accounts Receiveable Aging (7 bucket) to a 5 bucket report. I've already made some changes to the seeded "ARXAGMW.rdf" report, but I'm not a big Oracle Reports guy. I've stumbled through making some changes in various other reports. But this one is just plain nasty! :)
    I was thinking that I could simply add buckets 6 & 7 to bucket 5, then just hide or delete the 6 & 7 buckets. But I'm not sure where to even start. Any help with this would GUARANTEE a Christmas or other holiday card this year! :)
    I really want to keep this simple as possible, so any help would be very....helpful. :)
    Oh, my general question is: Are there any resouces/books for Oracle Reports (Report Builder)? I feel so lost trying to modify existing reports, let alone creating new ones.
    Thanks again!
    Steve

    Hi Steve,
    I am working on the 7-bucket aging report and i want to add a new field in data model.
    As the query is build dynamically, i have modified the function BUILD_CUSTOMER_SELECT to meet my requirements.
    But the problem is that in the data model, the field is not present in my Grouping. and if I try to add the field in the Data Model query (Q_ Customer) section,
    i get the following error: ORA-01789: query block has incorrect number of result columns.
    The query is as shown below:
    select rpad('a',50,'-') short_cust_name,
    0 cust_id,
    rpad('a',30,'-') cust_no,
    rpad('a',500,'-') sort_field1,
    rpad('a',40,'-') sort_field2,
    0 payment_sched_id,
    rpad('a',32,'-') class,
    sysdate due_date,
    0 amt_due_remaining,
    0 days_past_due ,
    0 amount_adjusted,
    0 amount_applied,
    0 amount_credited,
    sysdate gl_date,
    'x' data_converted,
    0 ps_exchange_rate,
    0 b0,
    0 b1,
    0 b2,
    0 b3,
    0 b4,
    0 b5,
    0 b6,
    rpad('a',25,'-') bal_segment_value,
    rpad('a',500,'-') inv_tid,
    rpad('a',32,'-') invoice_type
    , 'y' parent_cust --I WANT A NEW FIELD HERE TO BE VIEWED ON THE REPORT LAYOUT LATER
    from dual
    where 1=2
    UNION ALL
    &common_query_cus
    Did i missed somthing 4 me to be able to add the field here?

  • AR Aging - Need to change 7 bucket to 5 bucket - Report Builder

    Is there anyone out there who might be able to help me? We've recently implemented Oracle Applications 11.5.10 and I have to use report builder to change the Accounts Receiveable Aging (7 bucket) to a 5 bucket report. I'm not a big Oracle Reports guy, but I've stumbled through making some changes in various other reports. But this one is just plain nasty! :)
    I was thinking that I could simply add buckets 6 & 7 to bucket 5, then just hide or delete the 6 & 7 buckets. But I'm not sure where to even start. Any help with this would GUARANTEE a Christmas or other holiday card this year! :)
    I really want to keep this simple as possible, so any help would be very....helpful. :)
    Thanks again!
    Steve

    Well, as an update, I was able to do 90% of what I needed to, but I still have one problem remaining. Hopefully someone will help, because this part is hurting my head. :)
    I was able to move things around, combine a couple of buckets, and convert this to a 5 bucket report. The only thing left to do is add two flex-fields (attribute11 and attribute12). The problem is, unless I'm looking in the wrong place, the SELECT statement is being built dynamically and I need these two fields from "ra_customer_trx_all_mrc_v" or "ra_customer_trx_all". Does ANYONE have any experience or knowledge about this? I've added fields to queries before and then been able to add them to a report, but this is the first I've come across that builds the query dynamically...
    Thanks to anyone who can help!
    Steve

  • ORACLE reports Build 10g - Data Model - query - If statement in Alias ?

    I have the following select statement. It has the alias Survivors, Deaths and "All
    With the ORACLE reports Build 10g - Data Model - I have the following query statement. I require the alias to change. Can the following be done.
    Cases". Is it posible to use :P_LANGUAGE variable to say that -- IF :P_LANGUAGE = FRENCH THEN alias are Survivants for survivors, Décès for Deaths, Tous_les_cas for All Cases. Please advise
    SELECT ALL T_NTR_MULTIBAR.CAT, T_NTR_MULTIBAR.NUM_CASES_LEFTBAR AS Survivors,
    T_NTR_MULTIBAR.NUM_CASES_MIDDLEBAR AS Deaths, T_NTR_MULTIBAR.NUM_CASES_RIGHTBAR AS "All Cases"
    FROM T_NTR_MULTIBAR
    WHERE INSTANCE_NUM = :P_INSTANCENUM
    order by ORDERS

    It is no problem, you can automatically change the complete query before the report is running, which delivers you different kind of values. But the alias names does not change in the group of the data-model, although two query are running with different alias names at different times. In the data model you see the alias names of the first implemented select statement, which are the column fields in the layout.

  • SCCM 2012 R2 CU2 Can't Edit WMI Query Code in Report Builder

    I first posted this in the SCCM but the issue is not solved so I thought I'd try here in the SQL Reporting forum. Original thread here: http://social.technet.microsoft.com/Forums/en-US/b0a6ca3d-7471-4b49-8447-7403a65c2ec0/sccm-2012-r2-cu2-cant-edit-wmi-query-code-in-sccm-reports?forum=configmanagergeneral
    I'll repost info here to make this easier.....
    I built a new SCCM 2012 R2 CU2 suite on Server 2012 R2. This also uses SQL 2012 SP1 CU6. This suite has 4 servers: site server, two for WSUS and secondary DPs, and SQL. This problem is true for the built in reports and my custom reports. Our SQL guy has
    been helping me a lot but we've gotten nowhere. I can run a report. I can open one in edit mode after it prompts me for credentials. It loads Report Builder 3.0. But when I go to a dataset/query, enter credentials, and try to open it, I get a popup that
    says "Unable to connect to data source. 'AutoGen_5C6358F2_yayak..." When I click on details it says "The target principal name is incorrect. A connection was succesfully established with the server, but then an error occurred during the login
    process.  (SSL Provider, error: 0 -The target principal name is incorrect.)" In SQL Reporting Services Config Manager the paths for Web Service URL is
    http://ip.ip.ip.ip:80/ReportServer_SC01 and for Report Manager URL:
    http://ip.ip.ip.ip:80/Reports_SC01. A domain account is used to login. This happens when you r-click a dataset and select query to edit the code of a dataset, ie, when query designer tries to open up. It happens
    in both Admin Console and when using the Report Manager URL within SQL SSRS. All other functions of using edit mode of a report work fine.
    Ben JohnsonWY

    When I do that, browse is dimmed out.
    But, if I deselect "create a data set" and click "choose an existing dataset in this report..." there is no data connection at the end.
    But if I don't use report builder and instead use IE to browse to my ConfigMgr_ABC, I do see the connection at the end: {123...}.
    This problem is on a network that is not on the 'net, so it's hard to do screen shots, so I'll reproduce this problem step by step:
    I pick a report to edit, it doesn't matter which one.
    If I try it in Admin Console, I right-click, Edit the report, it asks me for a login, I login, then I get a popup that says "Cannot continue. The application is improperly formatted. Contact the vendor for assistance. I click the Details button and
    get a long set of text but the key part is "Your web browser settings do not allow you to run signed applications." This msg didn't appear before, so something changed, so I will investigate. I think it used to give a SPN error.
    If I use IE within report builder and navigate to whatever report, click open, everything works, except, when I click on Dataset0 (the key one I normally need to edit), click query, it prompts me for a login and no matter which one I use, i get a popup that
    says "unable to connect to data source 'AutoGen_123...'". If I click details I get "the targe principal name is incorrect. A connection was successfully established with the server, but then an error occurred during the login process. (provider:
    SSL Provider 0-The target principal name is incorrect.)
    Ben JohnsonWY

  • Add subquery to main query in Report Builder 6i

    Usually, when you add a subquery to an existing query in a report, you'll see the query in data model marked by a paper clip icon with a forward slash across it (means "Subquery Inside"). All current field names in current query (except CF and CS) will have a '1' appended after it (CF and CS fields are not affected), but in your sql, the column names stay the same. So there is an out-of-sync situation with the column names.
    To fix this:
    1) before change anything, back up old report somewhere else
    2) copy the original query somewhere else as backup
    3) open the query in Report Builder
    4) wipe out the query, replace it by "select 1 from dual" to reset it and press ok.
    5) replace "select 1 from dual" with your new query with an embedded subquery.
    6) All field names will be without the '1' appendix.
    7) check all the CS fields, the source should be reset to null. Redefine the CS fields using backed up report as reference. CF fields are not affected.
    8) move the fields and restore the break orders according to backed up report.
    9) Recompile whole report.
    10) save report again and you're done.
    Maybe you don't need this in the latest version of Report Builder, but in 6i, this is what I do.

    If you use aliases for your item names in your original query you avoid this problem....
    eg
    Select field1 item1, field2 item2 from table.....
    item 1 and item2 will stay in your layout between query changes.
    D

  • In the report builder 6i when I choose the query  type as Express Query .....

    In the report builder 6i when I choose the query type as Express Query and go to next step where on pressing the connect button I am getting the following error.
    REP-6029 : Express error.
    How can I solve this problem ?
    Thanks
    Nanda Kishore

    DiId you download Oracle Reports Developer/Server Release 6i for Express, Files for Oracle8i for Windows NT from OTN?
    If so, could you provide me wih more information?
    Thanks
    Elaine

  • Dynamic queries in report builder 6i ( ref cursor query )

    Hi everyone,
    My requirement is that I want to create a report where the query is dynamic. The dynamic part will be known at runtime as it is being passed via a parameter. My query looks like this :
    select * from emp where sal :p1 :p2
    Possible values for :p1 are - '>', '<', '>=', '<=', '=', '!='
    Possible values for :p2 are - any value entered by the user
    I tried creating a query in report builder based on a ref cursor. But it does not allow me to create the query for the ref cursor dynamically. That means I have to hardcode the query in the program.
    I tried using place holder columns without success.
    Can someone please help me ?
    Regards,
    Al

    Hi,
    You can use lexical paramters in the sql query
    x - char - parameter
    select * from emp &x
    you need to pass the value for x in the parameter as
    'where sal < 1234'.
    Note : Lexical variable should be of char datatype.
    This is an alternative to the ref cursors.
    This works. Hope this is clear.

Maybe you are looking for

  • Bqlog File Oracle EPM 11.1.1.3

    Dear Experts, How to suppress Bqlog file which is generated with the other job outputs of any bqy job. In the old version I used to add BP_FLAGS variables in the startCommonservice.bat or startJobservcie.bat file . But in EPM 11.1.1.3 these batch fil

  • Cannot open Mail or Safari after having updated to 10.6.8

    I have a Macbook (late 2008 silver version). I formatted my drive and re-installed OS X Snow Leopard 10.6.3 from the installation disc (Mail version was 4.2). I then downloaded and installed the MAC OS X Update Combo 10.6.8 (Mail version became 4.6).

  • When importing my Tournament PDF I get a error

    Is there a limit on how many fields that can be imported as I am getting a error message when importing and detail of problems don't tell me anything. I have about 100 date fields on my Tournament sign up entry form.

  • Business content / extractor query for PM/PS Dates

    Gurus, in my bw implementation for PM module, working with "Network Order Activities" i have the need for these 4 objects: early start date early finish date late start date late finish date can anyoen tell me how can i know if there is a business co

  • Premiere CC - Merge Clips repeatable bug crash!

    I have been editing a feature film since the start of this week and have found a huge bug and proble with Premiere CC. This has been repeatable for me every time. I am working on a brand new install of windows 8, all updated, and 64GB of RAM. I am wo