Using a function in a report query

Why can't I call a function (basically a query) in a report query like I can from from SQL?
Consider the following:
Select MyFunctionName(arg) from dual;
From SQL, it works great! No problem:
In a report query, [Application/Shared Components/Report Queries] It doesn't work. I get an XML error:
XML Parsing Error: not well formed
<MyFunctionName('arg')>&lt;?xml version="1.0"?&gt;
----------------------^
Why?
Looks like APEX is not even executing the function...
See I have a table with a CLOB field that contains properly formatted HTML. I cannot simply query for that content, since Oracle escapes the tags in the conversion to XML. I have to (somehow) tell Oracle to keep it's grubby mitts off my CLOB content. As far as I can tell, using DBMS_XMLGEN.setConvertSpecialChars is the only way to keep Oracle from escaping the html stored in the table--in fact, the DBMS_XMLGEN documentation states that it why this functionality exists in the first place!
This is why I am trying to use a function. Simply queries don't work. The function I wrote works beautifully in SQL, but not in a report query...
Edited by: Vorlon on Aug 5, 2010 1:20 PM

Note from the first post:
"In a report query, [Application/Shared Components/Report Queries]" Let me clarify: This report query is used in a BI Publisher report. Getting the information to the screen isn't the problem. I have that working. :-) It's just when I try to get the report to print that I see APEX has escaped the output before reaching BI Publisher--so BI Publisher is not the issue. I have a xsl template that will process the embedded HTML, but APEX is escaping my data before I can act on it. In other words:
It seems Apex is not creating the XML properly, since it escapes everything. Even when the function passes back data correctly.
Has anyone else seen this? Ideas for a workaround?
Thanks!

Similar Messages

  • Using a function module in ABAP Query

    Hi All,
    I want to use a function module in ABAp query in the Record Processing Section.
    In the report program we click on Pattern button to inser the function module so that all the Importing and exporting parameter automatically appears.
    Similarly is there any particular method of inserting a function module in ABAp Query.
    Regards
    Manipal Parkala

    When you are doing the infoset for the query (SQ02) you can add coding by clicking the coding tab. You can chose in wich event you want your coding and there is Pattern Button for  you to easy use.
    If you don't want to put the code in the infoset just in the query then is not posible.
    Nevertheless, I higly descourage the use of coding in queryies. If you need to insert some coding make an ALV its easier, clearer and much easier to mantain.
    Hope it helps.

  • How to use oracle functions in Crystal Reports XI using Oracle Server

    Hi all,
    Is it possible  to use oracle functions in Crystal Reports XI using Oracle Server as Data Source.
    If i try to use a procedure,i am getting error with message "Invalid Arguement Provided".
    Functions are not visible objects like tables,views and stored procedures.
    The  jdbs driver i m using is oracle.jdbc.driver.OracleDriver.

    I think it is not possible to add functions in crystal directly for any database. You need to use those functions in a stored procedure and add that storedprocedure as a datasource.
    [https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/oss_notes_boj/sdn_oss_boj_erq/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/scn_bosap/notes%7B6163636573733d36393736354636443646363436353344333933393338323636393736354637333631373036453646373436353733354636453735364436323635373233443330333033303331333233353335333833323333%7D.do]
    regards,
    Raghavendra

  • Use of writeChanges() / conformResultsInUnitOfWork in report query

    I have a usecase where i am saving data in different tables in same transaction
    I want to use ReportQuery so as to use functions likeaddAverage.
    ReportQuery query = new ReportQuery(res);
    query.setReferenceClass(Subject.class);
    query.addAverage("average-score", res.get("score"));
    But since data is still not commited, I wanted to use conformResultsInUnitOfWork.
    1.But I assume conformResultsInUnitOfWork can't be used with ReportQuery.
    Am I correct?
    2. According to toplink docs, we can use writeChanges() method on uow.
    But after you call the unit of work writeChanges method , we can'r egister objects or execute object-level queries.
    But after executing report query, I need to register obj /read objects to perform other use case operation.
    So how can we use Report query to perform query on uncommited changes & still be able to other UOW operations or read object queries
    Thanks for your help.

    Hi Jayesh,
    Please have a look at the below attachment.
    [http://help.sap.com/saphelp_470/helpdata/en/5b/d22e3843c611d182b30000e829fbfe/content.htm]
    Warm regards,
    Murukan Arunachalam

  • Using Match function in FR Reports

    Hi,
    Can anyone pls. let me know how i can use Match function in FR ? I've a Report where i'm using 2 Grids. In one Grid1 i'm using Entity under page and ICP dimension as Column. In Grid2, i'm using ICP under page and would like to use Match function where the condition is, if i select ICP member from Page, it should show the corresponding Entities in Grid1
    Thanks,
    PVR

    I don't think what your trying to do is available "out of the box", we have used a workaround to do what you want:
    - include idescendants for the member but apply suppression on the member names that ended in rollup.
    (we were lucky in that the parent members were standardized to contain rollup as the description name).
    Cheers, Iain

  • How to use email function in crystal report ?

    Post Author: kudo
    CA Forum: .NET
    Hi I'm a novice by touching .net not more than 2 months. Can somebody guide me how to use email function provided in crystal report components?(Better put a sample code so that I can understand well.)  ps: I'm using VS2005 VB.net.Thanks.

    Post Author: mewdied
    CA Forum: .NET
    'EXPORT to EMAIL        ''' Code for exporting the report to Mapi (.Net Windows application)        ''' *For a Web application you must export to disk as a PDF file first.
            crReportDocument.Load(Application.StartupPath + "\World Sales Report.rpt")        crMicrosoftMailDestinationOptions = New MicrosoftMailDestinationOptions        With crMicrosoftMailDestinationOptions            .MailCCList = "[email protected]"            .MailToList = "[email protected]"            .MailSubject = "Attached exported report"            .UserName = "admin"            .Password = "password"        End With
            crExportOptions = crReportDocument.ExportOptions        With crExportOptions            .DestinationOptions = crMicrosoftMailDestinationOptions            .ExportDestinationType = ExportDestinationType.MicrosoftMail            .ExportFormatType = ExportFormatType.PortableDocFormat        End With
            'Add some error handling        Try            crReportDocument.Export()            MsgBox("Report exported successfully.")        Catch err As Exception            MessageBox.Show(err.ToString())        End Try
    Hope this helps

  • How to use MAX function in SSAS MDX Query

    I want to run this Query with MAX Condition on LAST_DATA_UPDATE Column .

    Hi Ashishsingh,
    According to your description, you want to know how to use MAX function in SQL Server Analysis Services MDX Query, right? In this case, please refer to the link below which describe the syntax and sample of MDX function.
    http://technet.microsoft.com/en-us/library/ms145601.aspx
    http://www.mdxpert.com/Functions/MDXFunction.aspx?f=64
    Hope this helps.
    Regards,
    Charlie Liao
    TechNet Community Support

  • Using substr function loses index. Query tune help

    Hi
    when i use substr function in the join condition it loses index and the query is slow. How to fix this problem or tune this query. These are the lines in the query.
    and substr(a.invoice_num,1,9) = l.invoice_num
    and substr(c.invoice_num,1,9) = mgr_apprv_lst.user_key
    and substr(c.invoice_num,1,9) = pbl_apprv_lst.user_key
    select
    pap.full_name employe_name,
         k.SEGMENT1 ||'.' ||k.segment2 Cost_Center,
         a.invoice_num Invoice_Number,
         b.item_description Line_Item,
         b.amount Amount,
         cc.trx_id Corporate_Card_Transaction_Id,
         cc.transaction_date Date_Charge_Incurred,
         cc.posted_date Date_Charge_Posted_To_USBank,
         cc.creation_date Date_Posted_To_IExpense,
         a.creation_date Expense_Report_Creation_Date,
         l.report_submitted_date Expense_Report_Submitted_Date,
         mgr_apprv_lst.activity_begin_date Managers_Approval_Begin_Date,
         mgr_apprv_lst.activity_end_date Managers_Approval_End_Date,
         pbl_apprv_lst.activity_begin_date AP_Approval_Begin_Date,
         pbl_apprv_lst.activity_end_date AP_Approval_End_Date,
         e.check_date Payment_Date_To_USBank,
         e.check_number Payment_Number,
         mgr_apprv_lst.activity_result_display_name Managers_Process_Result,
         pbl_apprv_lst.activity_result_display_name AP_Process_Result
    from
         ap_checks_all e,
         ap_invoice_payments_all d,
         ap_invoices_all c,
    ap_expense_report_headers_all a,
         ap_credit_card_trxns_all cc,
         per_all_people_f pap,
         ap_expense_report_headers_all l,
         ap_expense_report_lines_all b,
         gl_code_combinations k,
         (select ias1.user_key,
         ias1.activity_result_display_name,
         ias1.activity_begin_date,
         ias1.activity_end_date
    from wf_item_activity_statuses_v ias1,
    (select c1.invoice_num
         from ap_checks_all e1,
         ap_invoice_payments_all d1,
         ap_invoices_all c1
         where trunc(e1.check_date) between nvl(:From_Date, trunc(e1.check_date))
         and nvl(:To_Date, trunc(e1.check_date))
    and e1.org_id = 141
    and e1.void_date IS null
    and d1.check_id = e1.check_id
         and c1.invoice_id = d1.invoice_id) inv_lst1
    where ias1.item_type = 'APEXP'
    and ias1.user_key = inv_lst1.invoice_num
    and ias1.activity_name = 'AP_MANAGER_APPROVAL_PROCESS') mgr_apprv_lst,
    (select ias2.user_key,
         ias2.activity_result_display_name,
         ias2.activity_begin_date,
         ias2.activity_end_date
    from wf_item_activity_statuses_v ias2,
    (select c2.invoice_num
         from ap_checks_all e2,
         ap_invoice_payments_all d2,
         ap_invoices_all c2
         where trunc(e2.check_date) between nvl(:From_Date, trunc(e2.check_date))
         and nvl(:To_Date, trunc(e2.check_date))
    and e2.org_id = 141
    and e2.void_date IS null
    and d2.check_id = e2.check_id
         and c2.invoice_id = d2.invoice_id) inv_lst2
    where ias2.item_type = 'APEXP'
    and ias2.user_key = inv_lst2.invoice_num
    and ias2.activity_name = 'AP_PAYABLES_APPROVAL_PROCESS') pbl_apprv_lst
    where
    trunc(e.check_date) between nvl(:From_Date, trunc(e.check_date))
    and nvl(:To_Date, trunc(e.check_date))
    and e.org_id = 141
    and e.void_date IS null
    and d.check_id = e.check_id
    and c.invoice_id = d.invoice_id
    and a.invoice_num = c.invoice_num
    and a.source = 'CREDIT CARD'
    and a.employee_id = nvl(:Emp_id,a.employee_id)
    and a.report_header_id = b.report_header_id
    and cc.trx_id = b.credit_card_trx_id
    and pap.person_id = a.employee_id
    and pap.effective_start_date <= trunc(sysdate)
    and pap.effective_end_date >= trunc(sysdate)
    and k.code_combination_id = b.code_combination_id
    and k.segment2 between nvl(:From_Cost_Center,k.segment2)
    and nvl(:To_Cost_Center,k.segment2)
    and substr(a.invoice_num,1,9) = l.invoice_num
    and substr(c.invoice_num,1,9) = mgr_apprv_lst.user_key
    and substr(c.invoice_num,1,9) = pbl_apprv_lst.user_key

    Hi
    If I understood correctly your logic, and if the columns involved are of type varchar2, you can use the like operator:
    and a.invoice_num like l.invoice_num || '%'
    and c.invoice_num like mgr_apprv_lst.user_key  || '%'
    and c.invoice_num like pbl_apprv_lst.user_key  || '%'In this case, Oracle will be able to use the indexes. If they are numeric, you need to do something like:
    and a.invoice_num between l.invoice_num * 1000000
                                and l.invoice_num * 1000000 + 999999I hope this makes sense...
    Luis

  • Using Sql Functions in Crystal Reports

    Can SQL table-valued functions be used in Crystal Reports?  The only options I see in the Database Expert are Tables, Views, and Stored Procedures.

    Hi Dan,
    Are you referring to user-defined SQL functions? If yes, then these are not accessible in Crystal Reports.
    You would need to create a stored procedure which calls the function and does the processing and use this procedure in CR.
    - Abhilash

  • ORA-03113 when using connect by in a report query ?

    Hi,
    Oracle 10g r2, ApEx 4.0.2.
    I have a classic report on page zero, I need the following query to display my data :
    select
         distinct '<input class="radio_report_search_photos" name="radio_selected_photo" type="radio" />' as "Sel",
         phot_id,
         phot_description,
         '<img alt="" id="thumb_'||phot_id||'" class="clickable_thumb" src="#OWNER#.show_photo?v_id_photo='||phot_id||'" />' as "Thumb",
         substr(SYS_CONNECT_BY_PATH(kw_text, ', '),3) keyword_list
    from
         select
              phot_id,
              phot_description,
              kw_id,
              kw_text,
              pkw_kw_id,
              pkw_phot_id,
              count(*) OVER(partition by phot_id ) cnt,
              ROW_NUMBER() OVER(partition by phot_id order by kw_text) seq
         from
              photos,
              photos_keywords,
              keywords
         where
              phot_id = pkw_phot_id
              and pkw_kw_id = kw_id
              and contains(kw_text,nvl(:P0_SEARCH_PHOTO_KW,'%')) > 0
    where
         seq = cnt
    start with
         seq = 1
    connect by prior
         seq+1 = seq
    and prior
         phot_id = phot_idIt works great when executing from any software. I get the expected results.
    But yhen I try to put it in the report region source, I get an ORA-03113 when I apply changes...
    It works if I remove CONNECT BY PRIOR and SYS_CONNECT_BY_PATH from the query.
    Why ?
    Thanks.
    Details :
    url : https://my_host.ch/pls/htmldb_dev/wwv_flow.accept
    Error :
    Fri, 22 Jul 2011 09:25:38 GMT
    ORA-03113: end-of-file on communication channel

    OK I now use xmlagg & xmlelement instead of connect by.
    Sorry for not providing any solution.
    Yann.

  • Is it possible to use aggregation function in SQ Sap query?

    I need to create a sap query like using SELECT MAX(begda) statement.
    Please teach me how...
    Thank u in advance..

    Hi Ella,
    You can very well use the aggregate functions in sql which is usually a performance tuning technique.
    A calculation that is made on several records or cells of data. SUM, AVG, MAX, MIN and COUNT are examples of aggregate functions that are used in spreadsheets and database programs.
    SELECT ( ( ] ...
    MAX: returns the maximum value of the column
    MIN: returns the minimum value of the column
    AVG: returns the average value of the column
    SUM: returns the sum value of the column
    COUNT: counts values or lines as follows:
    · COUNT( DISTINCT ) returns the number of different values in the column.
    · COUNT( * ) returns the total number of lines in the selection.
    Ex:    DATA: fldate LIKE sbook-fldate,
          count  TYPE i,
          avg    TYPE p DECIMALS 2,
          max    TYPE p DECIMALS 2.
    SELECT fldate COUNT( * ) AVG( luggweight ) MAX( luggweight )
           FROM sbook
           INTO (fldate, count, avg, max)
           WHERE carrid = 'LH' AND
                 connid = '0400'
           GROUP BY fldate.
      WRITE: / fldate, count, avg, max.
    ENDSELECT.
    For further info:
    http://help.sap.com/saphelp_nw04/helpdata/EN/fc/eb3990358411d1829f0000e829fbfe/content.htm
    http://help.sap.com/abapdocu/en/ABAPSELECT_AGGREGATE.htm
    Thanks and Regards
    Srikant.P
    Edited by: SRIKANTH P on May 27, 2009 9:41 AM

  • Using stored function in the Report Trigger

    I have faced this problem in Reports6.0.
    When a stored function is called in the after form trigger as
    below
    val := func1(abc,def);
    the report is hanging
    If I write like this i.e.,
    select func1(abc,def) into val
    from dual;
    it is working fine . Is this a bug ? Or Is there any reason
    behind it . Please Clarify !
    ThanX in Advance !
    Rajesh Mudiganti
    null

    Hi,
    You can define your own PF-STATUS and in that assign the function code for BACK button anything except 'BACK'.
    The code would somewhat look like this:
    SET PF-STATUS 'TEST'.
    write : itab-col1,
               itab-col2.
    in the PF-STATUS 'TEST', assign the function code to BACK button as 'BCK'.
    Now in your program you can use the event AT USER-COMMAND.
    In this you can handle the functionality of BACK button.
    Hope this helps.
    Regards,
    Himanshu

  • Using concatenate function to write report comments

    Hi am a high school teacher and have just got my first iPad - lovinging it!!! and am using Numbers and Pages on both my Mac at home and my iPad, but have hit a bit of a snage with using the concatenate funtion in my report generating spreadsheet.
    We use a 5 grade descriptor at our school for student outcomes (A-E for simplicities sack here) which I use as the basis for generating comments to explain the students performance at each outcome - this actually saves me hours and gives me more original reports across a whole class - the problem that I am having is that when I use the traditional bracketed IF queries to return the various strings matched to the outcomes Numbers will only let me address the outcome source cell in the first case, whenever i hit the cell again the orignal reference just "highlights"
    Any clues as to what I am doing wrong?
    Here is the start of the equation:
    =CONCATENATE(B1, " ",IF(Ranks and Grades :: Effort 'Nada '="O", Comment Phrases :: B9,(if when i get to here i go to hit Ranks and Grades :: Effort 'Nada' and it just highlights the original entry
    Help!!!!! these need to be in yesterday!!!!
    Ta
    Steve

    Thanks for the help Barry - don't try and author stuff like this on the iPad, just use it for record keeping, viewing and editing, author in the Mac, unfortunately your reply came just a little too late for me no not have laready resorted to using Excel (grumble grumble) but I will be doing the rest of my junior classes on Numbers - is just a nicer environment ot work with, especially with the descriptor cell addresses!!!!
    And yes they were typos, working on reports while not beina able to breath (asthma) and writing questions while brain tired from low O2 (yes I'm a science teacher) not a good combo
    Thanks again for the help
    Steve
    PS can you shed any light as to why numbers operates in this manner, it seems a little Byzentine...

  • Using arcsine function on WebI reports

    Hi All,
    I could not find the arcsine function to be included in the WebI report.
    Is there a way I can enforce WebI to return arcsine values.
    Can I create a formula?
    Please suggest.
    Regards,
    Faisal Vakil
    Edited by: Faisal Vakil on Nov 5, 2010 11:12 PM

    Try:
    =MonthNumberOfYear([Order Date])+"/"+DayNumberOfMonth([Order Date])+"/"+FormatNumber(Year(CurrentDate());"####")
    Or,
    =FormatDate([Order Date];"M/d/")+FormatNumber(Year(CurrentDate());"####")

  • Using BOUSER or CurrentUser() in Report Query Filter

    Post Author: Sandiegouser
    CA Forum: WebIntelligence Reporting
    We are using LDAP for Authentication.
    I was to be able to use the LDAP user id to filter what the user sees in a report..using either @variable('BOUSER') or CurrentUser()
    Thank you

    It's more that there is no disadvantage in your case. The usual objection to CGI (and indeed one reason why we have servlet containers at all) is that you have to start a new process per request, but you have that problem anyway because of your hundreds of C programs.

Maybe you are looking for

  • Making the bar move

    hi all... im in the midst of creating a rectangle that acts like a firing mechanism in the pinball... the idea is upon pressing the keyboard button the rectangle will move downwards.....once released the rectangle will go back to its original length.

  • Unable to read Cookies from Browser

    Hi All, The following is the scenario: Portal 1 We have intranet portal which is developed using ASP.NET and upon successful authentication a cookie(logged-in user) is created in the browser. Portal 2 We have another portal(running on Apache tomcat)

  • What will I learn at the Hour of Code lesson next week at Apple retail stores? Also, what age group will be attending?

    What will I learn at the Hour of Code lesson next week at Apple retail stores? Also, what age group will be attending?

  • Why Change Request of a Project has changed by itself ?

    it was reported that no one is able to change the status of SDHF documents in two of the projects which we have which are linked to our SAP ECC6 P01 Production system. when investigated found that the "Task List" "Service Disk Transaction" are blank.

  • CS6 suddenly shows black spots?

    Since today i've gotten some problems with CS6 When i import an NEF file into photoshop some photo's suddenly get some black area's On bridge or Gimp the photo's are how they should be... but in photoshop i'm getting this: If i change the channel mod