Conditionally assign a value to a parameter

I'm using this code to conditionally assign a value to a parameter p_data_type:
<?if:H_ACCOUNT_HIER_DESC='EST'?><xsl:param name="p_data_type" select="'number'" xdofo:ctx="begin"/> <?end if?>
<?if:H_ACCOUNT_HIER_DESC='PAR'?><xsl:param name="p_data_type" select="'text'" xdofo:ctx="begin"/> <?end if?>
However, I'm getting the following error.
Caused by: oracle.xdo.parser.v2.XMLParseException: Duplicate variable 'p_data_type' definition.
Once I get this working, I want to use it as follows:
<?sort:current-group()/ACCOUNT_SEQ;'ascending';data-type='{$p_data_type}'?>
Does anyone have any suggestions on how I might do this?
Thank you,
Tam

Thanks, Vetsrini. Works great. I do have one further question if you don't mind. In the <xsl:when test...>condition below, why is the '//' reference required for H_ACCOUNT_HIER_DESC. The code didn't work unless I used the '//'
Here is my template code:
<?import:xdo://XXFIN.XXFIN_PSB_NUMBER_FORMAT.en.CA PROVINCE?>
<?start:body?>
<?for-each:XXFIN_PSB_GOS_EXP_ANNUAL_ACT_SUM?>
<?for-each:G_HEADER_PAGE?>
<xsl:variable name="p_data_type">
<xsl:choose>*<xsl:when test="//H_ACCOUNT_HIER_DESC='EST'">*<xsl:value-of select="'number'"/></xsl:when><xsl:otherwise><xsl:value-of select="'text'"/></xsl:otherwise></xsl:choose>
</xsl:variable>
Here is my XML:
<?xml version="1.0" encoding="UTF-8"?>
<XXFIN_PSB_GOS_EXP_ANNUAL_ACT_SUM>
<P_OUTPUT>E17-1</P_OUTPUT>
<P_ACCOUNT2_HIGH>
<G_HEADER_PAGE>
<H_RECIPIENT_NAME/>
<H_PROG_SUM_LEVEL>SV/SP</H_PROG_SUM_LEVEL>
<H_ACCOUNT_HIER>AC0000</H_ACCOUNT_HIER>
<H_ACCOUNT_HIER_DESC>EST</H_ACCOUNT_HIER_DESC>
Thanks again for your help.
Tam

Similar Messages

  • Assigning a value to a parameter.

    Hi all,
    I am using CR XI, developping a report built upon a query in BW (using SAP Kit). The query in BW has a parameter PARAM1 of type string that comes automatically into my report but the type or the parameter is greyed. I can't change it.
    In reality, I am expecting a date to be entered. It would be more user friendly to offer the user the calendar interface to select a value rather than the textbox for a string.
    I can create a second parameter PARAM2 of type Date in CR, transform the input value to string but I do not know how to assign the result to PARAM1.
    I have tried an assignment in a formula using beforereadingreports but no luck.
    Does anybody know how to do this or if this is even possible ?
    Thanks.

    Thanks Graham - sorry it took me so long.
    That is an interesting suggestion that I did not think of. I tried but for some reason the parameter for the report against BW does not show up in the link part of the subreport definition. I created a "fake" main report with a date type parameter, a formula to translate it to a string but no way to "assign" its value to the parameter in the original report.
    Queries against SAP seem to have "specificities"...
    In other words, i am still stuck !

  • How to assign a value to a parameter {?MyParam} dynamically?

    How to assign a value to a parameter {?MyParam} dynamically?
    Example:
      {?One_Or_Two}  <- my first parameter
      {?MyParam}       <- My second parameter
    The Code:
    If ( {?One_Or_Two} = 'One'  then
        {?MyParam}  = 'One' ;
    else 
        {?MyParam}  = 'Two' ; 
    (THIS IS NOT WORKING FOR ME!  ANYONE KNOW WHY?)
      IT NEVER ASSIGN THE VALUE?
    My Command query looks like:
    SELECT * FROM MyTable
        WHERE MyTable.MyColumn = {?MyParam}
    THANKS

    Hi Joseph,
    I'm a bit unclear as to what you are doing and from what I see you're running in circles. 
    Your Command query is looking for a field that is equal to {?MyParam}. 
    Now you want to take {?MyParam} in the report and change the value after you've set it. 
    Parameters cannot be set from the Command, you can format it and manipulate it but they cannot be set except from the parameters window or from a front-end. 
    Thanks,
    Brian

  • CASE Statement in Where Condition with Multi Valued parameter in SSRS

    Hi All,
    I am little confused while using CASE statement in Where condition in SSRS. Below is my scenario:
    SELECT
    Logic here
    WHERE
    Date IN (@Date)AND
    (CASE
    WHEN NAME LIKE 'ABC%' THEN 'GROUP1'
    WHEN ID IN ('123456', '823423','74233784') THEN 'GROUP2'
    WHEN ABC_ID IS NULL THEN 'GROUP3'
    ELSE 'GROUP4'
    END ) IN (@GROUP)
    So above query uses WHERE condition with CASE statement from @GROUP parameter. I want to pass this parameter as multi- valued parameter and hence I have used CASE statement IN (@GROUP).
    For @Date one dataset will pass the available and default values and
    for @GROUP parameters, another dataset will pass the available and default values.
    But this is not working as expected. Please suggest me where I am making mistake in the query.
    Maruthu | http://sharepoint-works.blogspot.com

    Hi Maruthu,
    According to your description, I create a sample report in my local environment. It works as I expected. In your scenario, if the selected values from the Date parameter contains some of the Date field values, the selected values from the GROUP parameter
    contains some of GROUPS (‘GROUP1’,’GROUP2’,’GROUP3’,’GROUP4’) and the corresponding when statement is executed , then the dataset returns the corresponding values.
    In order to trouble shoot this issue, could you tell us what results are you get and what’s your desired results? If possible, you can post the sample data with sample dataset, then we can make further analysis and help you out.
    Thanks,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • Can we assign two values to the same parameter? If yes how? For details ple

    Can we assign two values to the same parameter? If yes how? For details please go through the following SAP related program.
    Here I need to print 2 queries using the same parameter "QUERY" the value assigned to this parameter(query) is REPORT_TEST1. I want to assign one more value to this Parameter. Is is possible? This question may sound stupid if it is not possible please kindly reply.
    I want to do this to print two documents(values) with a single command (parameter)
    Anybody please help quickly,
    Now, I have 2 tables from different queries. I have a print (HTML written) option in my WEB Template
    JAVA PROGRAM:
    <param name="QUERY" value="REPORT_TEST1"/>
    function PrintReport(typePaper) {
    document.title ='Report';
    if (typePaper == "0")
    {var CurrentReportName = '&?mp=U&ptot=1&rtot=0&psize=' + escape(typePaper) + '&fsize=' + escape('39') + '&qtitle=' + escape(document.title);};
    if (typePaper == "1")
    {var CurrentReportName = '&?mp=U&ptot=1&rtot=0&psize=' + escape(typePaper) + '&fsize=' + escape('52') + '&qtitle=' + escape(document.title);};
    CurrentReportName += '&ASOFDATE=' + escape(AsOfLabel.innerText);
    var openCMD='<SAP_BW_URL>';
    openCMD += '&DATA_PROVIDER=REPORT_TEST1&TEMPLATE_ID=DPW_PRINT_PAGE&CMD=RELEASE_DATA_PROVIDER';
    openCMD += CurrentReportName;
    openWindow(openCMD,'MainTitleNow',800,600);
    The data provider here is REPORT_TEST1. Now it only prints the corresponding data for the data proviedr 1 i.e., REPORT_TEST1. I have a second table whose data comes from the data provider 2 when i use this HTML to print I want the second table contents from the data provider 2 (REPORT_TEST2)also to be printed simlutaneously.
    Please help.
    THANX A LOT,
    SRINI

    Hi,
    Try assigning two values seperated by a delimiter ( say '|') to the same parameter.
    In the function get the parameter value and seperate the values using the same delimiter.
    <param name="QUERY" value="REPORT_TEST1|REPORT_TEST2"/>
    Regards,
    Uma

  • Can we assign two values to the same parameter? If yes how?

    Can we assign two values to the same parameter? If yes how? For details please go through the following SAP related program.
    Here I need to print 2 queries using the same parameter "QUERY" the value assigned to this parameter(query) is REPORT_TEST1. I want to assign one more value to this Parameter. Is is possible? This question may sound stupid if it is not possible please kindly reply.
    I want to do this to print two documents(values) with a single command (parameter)
    Anybody please help quickly,
    Now, I have 2 tables from different queries. I have a print (HTML written) option in my WEB Template
    JAVA PROGRAM:
    <param name="QUERY" value="REPORT_TEST1"/>
    function PrintReport(typePaper) {
    document.title ='Report';
    if (typePaper == "0")
    {var CurrentReportName = '&?mp=U&ptot=1&rtot=0&psize=' + escape(typePaper) + '&fsize=' + escape('39') + '&qtitle=' + escape(document.title);};
    if (typePaper == "1")
    {var CurrentReportName = '&?mp=U&ptot=1&rtot=0&psize=' + escape(typePaper) + '&fsize=' + escape('52') + '&qtitle=' + escape(document.title);};
    CurrentReportName += '&ASOFDATE=' + escape(AsOfLabel.innerText);
    var openCMD='<SAP_BW_URL>';
    openCMD += '&DATA_PROVIDER=REPORT_TEST1&TEMPLATE_ID=DPW_PRINT_PAGE&CMD=RELEASE_DATA_PROVIDER';
    openCMD += CurrentReportName;
    openWindow(openCMD,'MainTitleNow',800,600);
    The data provider here is REPORT_TEST1. Now it only prints the corresponding data for the data proviedr 1 i.e., REPORT_TEST1. I have a second table whose data comes from the data provider 2 when i use this HTML to print I want the second table contents from the data provider 2 (REPORT_TEST2)also to be printed simlutaneously.
    Please help.
    THANX A LOT,
    SRINI

    Hi,
    Try assigning two values seperated by a delimiter ( say '|') to the same parameter.
    In the function get the parameter value and seperate the values using the same delimiter.
    <param name="QUERY" value="REPORT_TEST1|REPORT_TEST2"/>
    Regards,
    Uma

  • Can I assign a default value to a parameter like C++ ?

    My question is whether I can assign a default value to a parameter in Java? Let's say : public void myMethod(int p1, int p2=3){...} Is this syntax acceptable ?
    Regards,
    WenBin

    I don't think so (the easiest way to find out is to try), but if you want something like that, most people do it like so:
    private static final int DEFAULT_P2 = 3;
    public void myMethod(int p1)
        myMethod(p1, DEFAULT_P2);
    public void myMethod(int p1, int p2){...}Hope this helps,
    Radish21

  • Oracle how to assign a date value in a parameter declaration

    How can I assign a date value to a parameter declaration in SQL?
    Here's my existing script.
    CURRENT:
    select distinct summary as "iCash EAD Error Summary",count(*)
    from AAA.BKS_ICASH_EAD_ERRORS
    where creation_date > to_date('5/26/12 8:50','mm/dd/yy HH24:MI')
    group by summary
    I'd like to assign the date I'm searching for into a parameter and use the parameter in my query.
    GOAL:
    DECLARE
    pCreateDate DATE;
    exec :pCreateDate := '5/26/12 8:50';
    select distinct summary as "iCash EAD Error Summary",count(*)
    from AAA.BKS_ICASH_EAD_ERRORS
    where creation_date > to_date(:pCreateDate,'mm/dd/yy HH24:MI')
    group by summary

    Hi,
    In SQL*Plus, you can do this:
    VARIABLE     pcreatdate     VARCHAR2 (20)
    EXEC           :pcreatedate := '5/26/12 8:50';
    SELECT    summary          AS "iCash EAD Error Summary"
    ,       COUNT (*)          AS "Total Count"
    FROM        aaa.bks_icash_ead_errors
    WHERE       creation_date  > TO_DATE (:pcreatedate, 'MM/DD/RRRR HH24:MI')
    GROUP BY  summary
    ;"GROUP BY summary" means you'll get one output row for each distinct value of summary. There's no need to SELECT DISTINCT since the GROUP BY is already making sure the rows are distinct.
    There are no DATE bind variables in SQL*Plus, so you have to use a VARCHAR2.
    If you do something similar in PL/SQL, then you can use a DATE variable. Make sure you don't call TO_DATE on something that's already a DATE.
    Edited by: Frank Kulash on Jun 26, 2012 2:01 PM

  • Using :$FLEX$ to create a mutually exclusive parameter condition without poplist values

    Gurus,
    I've been unsuccessfully searching for an example of utilizing the $FLEX$ to mutually exclude one of two parameters.  Most of the examples I've seen are based on poplist value presented in parameter B for a value provided in parameter A.
    Here's what I need:
    Parameter A is initially editable
    Parameter B is initially editable
    If a value is entered for either B or A, then the other parameter will become greyed out.
    Pretty simple.   I need a straight forward answer.  I would prefer not having to create a custom value and use the "sql statement" option, but if there is no other way then that will be fine.
    Thanks in advance!

    Anyone got anything on this?

  • How to check for null value of output parameter?

    Hi guys, I get a test procedure with 2 output parameters and do nothing:
    CREATE OR REPLACE PACKAGE BODY p_parameters_test AS
      PROCEDURE p_null_output_basetype(p1 OUT NUMBER,p2 OUT VARCHAR2)
      AS
      BEGIN
        DBMS_OUTPUT.PUT_LINE('DO NOTHING');
      END p_null_output_basetype;
    END;And I have below C# code:
    cmd.CommandText = "p_parameters_test.p_null_output_basetype";
    OracleParameter p1 = new OracleParameter("p1", OracleDbType.Decimal, System.Data.ParameterDirection.Output);
    OracleParameter p2 = new OracleParameter("p2", OracleDbType.Varchar2, System.Data.ParameterDirection.Output);
    cmd.Parameters.Add(p1);
    cmd.Parameters.Add(p2);
    try
        conn.Open();
        cmd.ExecuteNonQuery();
        if (p1.Value==null)
            Console.WriteLine("p1.Value==null");
        else if (Convert.IsDBNull(p1.Value))
            Console.WriteLine("Convert.IsDBNull(p1.Value)");
        else
            Console.WriteLine("p1 else "+p1.Value);
        if (p2.Value==null)
            Console.WriteLine("p2.Value==null");
        else if (Convert.IsDBNull(p2.Value))
            Console.WriteLine("Convert.IsDBNull(p2.Value)");
        else
            Console.WriteLine("p2 else "+p2.Value);
        Console.WriteLine("finished");
    catch......The output of it is:
    p1 else null
    p2 else null
    Does anyone have any idea why it always goes to the 'else' of the condition-branching, and how can I check if the output parameter is null?
    Thanks in advance.

    Morven... I ran into similar problems. Maybe you've found a solution of your own by now, but here's what I've learned...
    The Value property of output parameters, like p1 and p2 in your code, actually varies, according to (I think) the OracleDbType of the parameter. You've got OracleDbType.Decimal for p1 and OracleDbType.Varchar2 for p2. These look about right, since they match the parameter types in your actual stored procedure.
    After cmd.ExecuteNonQuery() executes, the respective Value properties of p1 and p2 are actually of different types. For p1, it's going to be "OracleDecimal" and for p2 it's "OracleString". Keep in miind that these are the types of the Value property of the OracleParameter objects, not the OracleParameter objects themselves.
    OracleDecimal and OracleString (and some other types like OracleDate, etc.) have an "IsNull" property you can use if you cast the Value property to its runtime type...
    if ((OracleDecimal)cmd.Parameters["p1"].Value).IsNull) { …do something… }
    else { …do something else… }
    Or maybe something like this...
    Decimal p1val = ((OracleDecimal)cmd.Parameters["p1"].Value).IsNull ? 0 : ((OracleDecimal)cmd.Parameters["AVG_SALARY"].Value).Value;
    I'll admit that expressions like this: ((OracleDecimal)cmd.Parameters["AVG_SALARY"].Value).Value look a little weird. But the "Value" of the "OracleDecimal" property is a regular .NET decimal type (System.Decimal). So, it's a "Value" of the "Value" property of the OracleParameter class.
    Even when the stored procedure returns a null, the Value property is still populated. In the case of p1, it's populated with an OracleDecimal object (actually a struct) where IsNull is true. That's why "p1.Value==null" tests false.
    From what I can see, OracleDecimal, OracleString, etc. will never be typed as DbNull, or DBNull.Value. So, that would be why Convert.IsDBNull(p1.Value)) always returns false. btw, it appears that these are Value types. That would suggest that coding something like like this, should be avoided…
    OracleString p2val = ((OracleString)cmd.Parameters["p2"].Value;
    if (p2val.IsNull) { …do something… }
    else { …do something else… }
    By assigning the value to another variable, you’d be actually creating an entire copy of the OracleString structure, which is pointless.
    I hope that helps
    Edited by: 897674 on Jan 3, 2012 10:44 AM
    Edited by: 897674 on Jan 3, 2012 10:46 AM

  • Error: Missing initial value for session parameter

    Hi,
    I'm facing a problem while running the ETL process for Complete 11.5.10 Execution Plan in DAC Client. Some tasks are getting failed beacuse of the following error:-
    ERROR : TM_6292 : (5080|4064) Session task instance [SDE_ORA_Product_Category_Derive_Full]: VAR_27026 [Error: Missing initial value for session parameter:[$DBConnection_OLAP].].
    ERROR : TM_6292 : (5080|4064) Session task instance [SDE_ORA_Product_Category_Derive_Full]: CMN_1761 [Timestamp Event: [Mon Nov 19 21:01:52 2007]].
    ERROR : TM_6292 : (5080|4064) Session task instance [SDE_ORA_Product_Category_Derive_Full]: TM_6270 [Error: Variable parameter expansion error.].
    ERROR : TM_6292 : (5080|4064) Session task instance [SDE_ORA_Product_Category_Derive_Full]: CMN_1761 [Timestamp Event: [Mon Nov 19 21:01:52 2007]].
    ERROR : TM_6292 : (5080|4064) Session task instance [SDE_ORA_Product_Category_Derive_Full]: TM_6163 [Error initializing variables and parameters for the paritition.].
    ERROR : TM_6292 : (5080|4064) Session task instance [SDE_ORA_Product_Category_Derive_Full]: CMN_1761 [Timestamp Event: [Mon Nov 19 21:01:52 2007]].
    ERROR : TM_6292 : (5080|4064) Session task instance [SDE_ORA_Product_Category_Derive_Full]: TM_6226 [ERROR:  Failed to initialize session [SDE_ORA_Product_Category_Derive_Full]].
    ERROR : LM_36320 [Mon Nov 19 21:02:08 2007] : (2108|2632) Session task instance [SDE_ORA_Product_Category_Derive_Full]: Execution failed.
    When i checked the parameter file i can see the value assigned to the $DBConnection_OLAP. The same tasks ran successfully when i ran the ETL process for Complete 11.5.10 for the first time. I did not change anything after that and also all these are came built-in with the installation of Oracle BI Applications.
    Please anyone give me an idea what is causing the problem.
    Thanks,

    in DAC > Run History > Task Details, query
    Name = SDE_ORA_Product_Category_Temporary
    Open Status Description, look for string -lpf, the file after it is the actual parameter file DAC send to INFA server. E.g
    -lpf D:\DACTOPUS\Informatica\parameters\SDE_ORAR12_Adaptor.SDE_ORA_Product_Category_Temporary.txt
    Open the parameter file, most likely the [session_name] does not match with SDE_ORA_Product_Category_Derive_Full or some parameters are missing.

  • Passing a value to a Parameter Field From a VB Form

    Post Author: as1971
    CA Forum: General
    Hello everyone
    I'm using Visual Basic 6.0 and Crystal Report 9.0
    I built a report using Crystal Report and named it Player_Statement.rpt. I then included it to my VB project and named it Player_Statement.Dsr
    In this report I have a Parameter Field called P_Player_ID which I'm using in Record Selection Formula.
    I'm using the following code to pass a value to the parameter:
    Dim Report As CRAXDRT.ReportSet Report = New Player_StatementReport.ParameterFields.GetItemByName("P_Player_ID").AddCurrentValue CLng(cmbPlayerNB.BoundText)
    When I execute the application I get the error message "The value or range you are adding has already existed" at the last line of code (Where I'm assigning the parameter a value)
    Could anybody help me please

    Post Author: VinoTinto
    CA Forum: General
    Dim Report As CRAXDRT.ReportSet Report = New Player_StatementReport.GetItemByName("P_Player_ID").ClearCurrentValueAndRange                                               Report.ParameterFields.GetItemByName("P_Player_ID").AddCurrentValue = CLng(cmbPlayerNB.Boundtext)

  • How to assign a value to a member with computed name ?

    Is there a way to assign a value to a member whose name is built dynamically in a calculation script ?For instance, my calculation script needs to do this :In the ACCOUNT dimension, the values of some (source) accounts must be added to their associated (destination) account and cleared from the source account.I can't use shared members.Each source account has a DESTINATION attribute, whose value is the associated destination account nameIs there a way to add the source value to the destination account? or some kind of dynamic solution without attribute ?Any help or suggestion greatly appreciated. ThanksPhilippe

    I forgot to mention that the assignation is conditional (if the value to assign is < 0).I tried this part of script with Essbase 6.5.1 (server and client):VAR var_dynamic_name;VAR var_value; ...FIX (...) ... var_dynamic_name = @MEMBER (@SUBSTRING( @ATTRIBUTESVAL( bilan ), 3 )); var_value = some formula; ... /*#### 2 Errors on next line : "This function must be a macro" and then"A variable can be only be used in a calcmember block or the rigth side of an assignement" ####*/ FIX (@MEMBER(var_dynamic_name)) cyg_bilan( IF ( var_value < 0 ) cyg_bilan = var_value; ENDIF );...ENDFIX ...

  • Assign Javascript Value to JSP

    I have a dynamic link that links to a Javascript function:
    test
    The javascript function:
    function frames(testing)
    <%=testHere%> = testing
    <%
    HttpSession testSession = request.getSession(true);
    testSession.putValue("tested", testHere);
    %>
    I want to assign the javascript value, testing, into JSP value,testHere, which will be place in the session, which is :~
    .......putValue("tested", testHere).
    Does anyone know how to solve it? =)
    Thanks in advance...

    You can't. As is stated here about 3 times a day, Java, the JSP code, and servlets run on the Server, while javascript runs on the client (in the browser). By the time javascript begins to run, the JSP is compiled, run, the response generated and sent to the browser as HTML.
    The only means to do this is to send the variable back to the browser by requesting the same or another page and including the javascript value as a parameter to that page.

  • Assigning Javascript value to ABAP variables

    Hi Experts,
    I have written the HTML code mixed with Javascripts to create a table in the 'View' of a BSP Component.
    I was able to set the value of assign the value of ABAP parameters into HTML fields.
    This table has some input fields. I need to fetch the value of input parameters which has been entered by screen on an event which is present in Overview Page.
    I can calulate the value mentioned in input field but i am not able to assign the same value to ABAP parameter for further processing.
    I have already referred the following link but it did not work.
    Assign Javascript variable to Abap variable
    Please help me how i should i acheive it.
    Thanks In Advance,
    Rajeev Singh

    Hi,
    I am not understanding your problem and what you want due to description, but it seems to be very similar to a post which I answered very recently [here|How to return values from a BSP page to Javascript;.

Maybe you are looking for

  • Installing Adobe Reader and got Error 1303

    I was trying to install Adobe Reader and I got this error 1303. "Error 1303, The installer has insufficient privileges to access this directory: C:\Program Files (x86)\Adobe\Reader 9.0\Resource\Font\PFM. The installation cannot continue. Log on as an

  • Why does my photo linger on?

    Hi group;   I've been working on a documentary for about a year and am close to wrapping it up.  I've encountered a really frustrating issue though.  I have a lot of photos, most run thru Photoshop to size them appropriately and so forth.  In the mai

  • Crossdomain woes

    I have an http app that is making a webservice call via https to a remote server. I have (i think) defined the appropriate domains and ports in the crossdomain.xml place at apache's web server root. I get an error that says "security error accessing

  • Saved a page from Internet- where did it go??

    I was on a webpage & trying to save a page (actually a photos).  I clicked on "SAVE" and a message pops up that sayd "saved in your saved pages folder".  Where the heck is that???  I have looked all over my phone thru pics, doc, folder, etc.  Where i

  • Swf-fla question

    i made a fla a while back with a little animated navigational aid, which because my scripting skills are so poor, was quite tedious to program. now i need to edit it but i've lost the fla. can flash convert the swf back into a fla? any suggestions? t