Setting PMF parameters with JCA

Hi,
I am trying to use Kodo with JCA (in Jboss 3.2/WebSphere 5), but I don't
see how to communicate properties to the PMF. For instance, how do I tell
it which database driver to use? How do I ask for non-transactional reads
or set other options? I don't see this anywhere in the documentation, but
it seems like a pretty basic thing I'd need to know. Do I need to set all
the properties by hand after pulling the PMF out of JNDI? That would be
annoying.
Thanks,
Paul Jungwirth

Paul,
You should not specify a ConnectionFactoryName as that is the source of
the HSQL references.
Paul Jungwirth wrote:
Hi again,
So I figured out that each <config-property> element in the kodo-ds.xml
causes JBoss to call at setting method on the PMF. Now my kodo-ds.xml
looks like this:
<connection-factories>
<tx-connection-factory>
<jndi-name>kodo</jndi-name>
<adapter-display-name>KodoJDO</adapter-display-name>
<config-property name="LicenseKey"
type="java.lang.String">***</config-property>
<config-property name="ConnectionFactoryName"
type="java.lang.String">java:/DefaultDS</config-property>
<config-property name="ConnectionDriverName"
type="java.lang.String">oracle.jdbc.driver.OracleDriver</config-property>
<config-property name="ConnectionUserName"
type="java.lang.String">pjungwirth</config-property>
<config-property name="ConnectionPassword"
type="java.lang.String">***</config-property>
<config-property name="ConnectionURL"
type="java.lang.String">jdbc:oracle:thin:@hansen:1521:nfic9i</config-property>
<config-property name="Optimistic"
type="java.lang.Boolean">true</config-property>
<config-property name="RetainValues"
type="java.lang.Boolean">false</config-property>
<config-property name="NontransactionalRead"
type="java.lang.Boolean">true</config-property>
<config-property name="NontransactionalWrite"
type="java.lang.Boolean">false</config-property>
<config-property name="Multithreaded"
type="java.lang.Boolean">true</config-property>
<config-property name="TransactionMode"
type="java.lang.String">managed</config-property>
</tx-connection-factory>
</connection-factories>
But even though I've specified a ConnectionURL and ConnectionDriverName,
Kodo still wants to use hsqldb. I got a whole slew of stack traces that
basically originate in this:
Caused by: java.sql.SQLException: User not found: PJUNGWIRTH
at org.hsqldb.Trace.getError(Unknown Source)
at org.hsqldb.Result.<init>(Unknown Source)
at org.hsqldb.jdbcConnection.executeHSQL(Unknown Source)
at org.hsqldb.jdbcConnection.execute(Unknown Source)
at org.hsqldb.jdbcConnection.setAutoCommit(Unknown Source)
at
org.jboss.resource.adapter.jdbc.local.LocalManagedConnection.begin(LocalManagedConnection.java:147)
... 93 more
How can I make the JCA PMF use the correct database? Am I doing the wrong
thing to set these properties?
Thanks,
Paul Jungwirth
Steve Kim
[email protected]
SolarMetric Inc.
http://www.solarmetric.com

Similar Messages

  • Setting date parameters with yesterdays date

    Hi everyone.
    I have a very basic report where I have two date fields as parameters, 'From Date' and 'To Date'.
    I want the From date to default to yesterday, and the To date to default to today.
    I can set todays date simply by adding DEFAULT sy-datum to the parameter.
    But I've been unable to figure out how to set yesterdays date.
    I tried adding some code before the parameters eg:
    lv_yesterday = sy-datum - 1.
    and then add DEFAULT lv_yesterday to the parameter but it doesn't do anything.
    Anybody able to help here? Seems rather trivial but no luck so far!
    Moderator message - You're right, this is a pretty basic question. Please search before asking - post locked
    Edited by: Rob Burbank on Jun 23, 2009 5:21 PM
    Moderator message - OK - I'm going to unlock it long enough so that you can mark David's solution as - solved your problem (I'd use INITIALIZATION rather than LOAD-OF-PROGRAM though
    Edited by: Rob Burbank on Jun 23, 2009 5:23 PM

    Hello Kieran,
    I think you need to calculate the date in the LOAD-OF-PROGRAM event block:
    REPORT z_test.
    DATA: gv_yesterday TYPE d.
    PARAMETERS:
      pa_date TYPE d DEFAULT gv_yesterday.
    LOAD-OF-PROGRAM.
      gv_yesterday = sy-datum - 1.
    Best regards
    David

  • Problem with SET GET parameters

    Hi all,
    I am facing a problem using SET and GET parameters.
    There is a Z transaction(Dialog program) where some fields of screen are having parameter ID's. That transaction is designed to diaplay/change status of only one inspection lot at a time.
    Now I need to call that transaction in a loop using BDC. I mean i need to update the status of multiple inspection lots(one after the other). Before calling the transaction I am using
    SET PARAMETER ID 'QLS' FIELD lv_prueflos.
    Unfortunately the transaction is only changing the first inspection lot. When I debugged I found that the screen field is changing in PAI. Even though in PBO it shows the next value, when it goes to PAI it is automatically changing to the first value(inspection lot).
    Example: Inspection Lots : 4100000234
                                               4100000235
                                              4100000236
    Now first time when the call transaction is being made the status of insp lot 4100000234 is changed. For the second time when insp lot 4100000235 is being passed in PBO ican see this. But the moment it enters PAI the screen field changes to 4100000234.
    Could you pls help me in solving this issue.
    Thanks,
    Aravind

    Hi,
    Problem with SET GET parameters
    Regarding on your query. Follow this below link.
    It will help you.
    Re: Problem with Set parameter ID
    Re: Problem in Set parameter ID
    I Hope it will helps to you.
    Regards,
    Sekhar

  • The type Set is not generic; it cannot be parameterized with arguments K ?

    When I use Hashtable or HashMap to get the keySet, it shows the error of "The type Set is not generic; it cannot be parameterized with arguments <K>".
    The following is my code:
    Hashtable table = new Hashtable();
    table.put("A", new Integer(1));
    table.put("B", new Integer(2));
    Iterator its = table.keySet().iterator(); // <<<<<<<<<<<<<< this line shows the error "The type Set is not generic; it cannot be parameterized with arguments <K>"
    How can I solve it? Please help me! I have no idea on it. It works fine in 1.4.
    Best regards,
    Eric

    The original is my codes, please help!
    public static List findDlicApp(Date startDate, Date endDate, Connection con) {
              String SQL = getSQL("app.sql");
              String where = getSQL("app.sql.where");
              boolean hasWhere = false;
              if (startDate != null) {
                   SQL = SQL + " where d.create_date >= to_date('" + DMSUtil.convertDateToString(startDate) + "', 'yyyy-MM-dd')";
                   hasWhere = true;
              if (endDate != null) {
                   if (hasWhere) {
                        SQL = SQL + " and to_date(to_char(d.create_date, 'yyyy-mm-dd'), 'yyyy-mm-dd') <= to_date('" + DMSUtil.convertDateToString(endDate) + "', 'yyyy-MM-dd')";
                   } else {
                        SQL = SQL + " where to_date(to_char(d.create_date, 'yyyy-mm-dd'), 'yyyy-mm-dd') <= to_date('" + DMSUtil.convertDateToString(endDate) + "', 'yyyy-MM-dd')";
                   hasWhere = true;
              if (hasWhere) {          
                   SQL = SQL + " and " + where;
              } else {
                   SQL = SQL + " where " + where;
              SQL = SQL + " " + getSQL("app.sql.order");
              //System.out.println(SQL);
              //Connection con =  getParaDMConnection("findDlicApp");
              HashMap<String, DlicApp> dlicDocs = new HashMap<String, DlicApp>();
              List result = new ArrayList();
              try {
                   Statement stmt = con.createStatement();
                   ResultSet rs = stmt.executeQuery(SQL);
                   long lastDocID = 0;
                   boolean hasStartDate = false;
                   while(rs.next()) {
                        long docID = rs.getLong("docID");
                        String docName = rs.getString("docName");
                        String refNo = rs.getString("refNo");
                        java.util.Date createDate = rs.getDate("createDate");
                        String creator = rs.getString("creator");
                        String profileType = rs.getString("profileType");
                        String assunto = rs.getString("assunto");
                        String fromEntity = rs.getString("fromEntity");     
                        String location = getLocation(docID, con);
                        long fieldID = rs.getLong("fieldID");
                        String fieldValue = rs.getString("fValue");
                        DlicApp doc = null;
                        if (dlicDocs.containsKey(String.valueOf(docID))) {
                             doc = (DlicApp)dlicDocs.get(String.valueOf(docID));
                        } else {
                             doc = new DlicApp();
                        doc.setId(docID);
                        doc.setDocName(docName);
                        doc.setReferenceNo(refNo);
                        doc.setCreateDate(createDate);
                        doc.setCreator(creator);
                        doc.setProfileType(profileType);
                        doc.setAssunto(assunto);
                        doc.setFrom(fromEntity);
                        //if (doc.getStartDate() == null) {                    
                        //     doc.setStartDate(createDate);
                        doc.setLocation(location);
                        if (fieldValue != null) {                    
                             if (fieldID == 1114) {
                                  doc.setChineseName(fieldValue);
                             if (fieldID == 1115) {
                                  doc.setPortugueseName(fieldValue);
                             if (fieldID == 1116) {
                                  doc.setApplicationCategory(fieldValue);
                             if (fieldID == 1118) {
                                  doc.setStatus(fieldValue);
                             if (fieldID == 1119) {
                                  Date d = DMSUtil.parseDate(fieldValue, "yyyy-MM-dd");
                                  doc.setStartDate(d);
                                  hasStartDate = true;
                             if (fieldID == 1120) {
                                  Date d = DMSUtil.parseDate(fieldValue, "yyyy-MM-dd");
                                  if (!StringUtils.isEmpty(fieldValue)) {
                                       //System.out.println(docName + ":" + fieldValue + ">>>>>>>>>findDlicApp>>>>>>>>>>>>>>>>>>APP END DATE: " + d);
                                       doc.setEndDate(d);
                        if (docID != lastDocID) {                    
                             doc.setRelatedDocs(findRelatedDoc(docID, con));
                             lastDocID = docID;
                        dlicDocs.put(String.valueOf(docID), doc);
                   stmt.close();
                   rs.close();
                   Iterator<String> its = dlicDocs.keySet().iterator();
                   while(its.hasNext()) {
                        String id = (String)its.next();
                        DlicApp a = (DlicApp)dlicDocs.get(id);
                        a.setRelatedDocs(findRelatedDoc(a.getId(), con));
                        dlicDocs.put(id, a);
                   result.addAll(dlicDocs.values());
                   // take out start date is not in the given period
                   int n = 0;
                   while(true) {
                        if (n < result.size()) {
                             DlicApp a = (DlicApp)result.get(n);               
                             Date sd = a.getStartDate();
                             if (!isWithin(sd, startDate, endDate)) {
                                  result.remove(n);
                             } else {
                                  n++;
                        } else {
                             break;
              } catch(Exception e) {
                   e.printStackTrace();
              if (result.size() > 0) {
                   Collections.sort(result, new DmsDocComparator());
              return result;
         }Edited by: EJP on 13/01/2011 14:41: added code tags for you. Please use them next time.

  • Can I re-use a parameterized manual test case with different set of parameters in a different test plan?

    Can I re-use a parameterized manual test case with different set of parameters in a different test plan without impacting the parameters in the first test plan?

    Hi ssteele_1,
    Thank you for posting in MSDN forum.
    Generally, I know that if you want to re-use a parameterized manual test case and without impacting the parameters in the first test plan.
    I suggest you could try to right click this parameterized manual test case ->Select the Create copy and add to suite option like the following screen shot.
    Then the parameterized manual test case can be re-used as a new test case in this MTM and it will did not impact the original parameterized manual test case.
    Best Regards,
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • : "Invalid object name '#Temp'.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.

     Hi   .
        I was creating the  pass the values t in temp tables  though s sis package vs2012 .
      First I was taken on executive SQL TASK.
     IN EXCUTIVE SQL TASK  . I was write the stored proce:
    Sp;
    reate  procedure  USP_GETEMP2333
    AS
    begin
    Select  eid,ename,dept,salary from emp
    end;
    create table #temp(eid int,ename varchar(20),dept varchar(20),salary int)
      insert into #temp
       exec USP_GETMP02333
       go.
     It was executive correctly.
     I was taken another sequence container. In the sequence container iam creating one   executive  sql
    In 2<sup>nd</sup> excutive sql task: sql statements is
    if object_id('emp_fact_sal') is not null
     drop table emp_fact_sal
    select eid,ename as emp_name,sal_bar=
    case when salary<=5000 then 'l'
    when salary >5000 and salary<=7000 then 'm'
    else
    'h'
    end
    into emp_fact_sal from #temp.
     and one falt flies  it was taken to designation .
     iam changing  all  connection properties:
     in oldeb connection:
    in excutive sal task properties .
    delay validation is true,
    and retain connection maner is also true,
    and package mode is 64 bit is false.
     But iwas excutive in 2<sup>nd</sup> excutive ql task .
    Iam getting this type of errors,
                    [Execute SQL Task] Error: Executing the query " if object_id('emp_fact_sal') is not null
     drop ta..." failed with the following error: "Invalid object name '#Temp'.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established
    correctly.
     Please help me

    Arthur suggestion works but you shouldnt even be doing this on a SQL Task.
    Use a data flow task. You'll have better control over the data that is being transfered and get better performance because no staging table will be used.
    Just because there are clouds in the sky it doesn't mean it isn't blue. But someone will come and argue that in addition to clouds, birds, airplanes, pollution, sunsets, daltonism and nuclear bombs, all adding different colours to the sky, this
    is an undocumented behavior and should not be relied upon.

  • How To Set Server Start Parameters With WLST?

    I have WLST scripts that create my WebLogic 10.0 domain(s), managed servers, resources, etc. I'd like to add code to set the server start parameters but I can't seem to find the properties related to server start like root directory, java home, arguments, classpath, etc.
    The relevant piece of the script here that I have so far is:
    def createManagedServer(d,noManagedServers,managed_server_port):
    dhome = DOMAINHOME + "/" + d
    readDomain(DOMAINHOME + "/" + d)
    x = 0
    while x < noManagedServers:
    ms = d + "Man" + str(x+1)
    create(ms,'Server')
    cd("Servers/" + ms)
    lp = managed_server_port + (x * 10)
    set('ListenPort',lp)
    set('AutoRestart','true')
    set('AutoKillIfFailed','true')
    set('AutoRestart','true')
    set('IgnoreSessionsDuringShutdown','true')
    set('GracefulShutdownTimeout',30)
    cd('/')
    x = x + 1
    updateDomain()
    closeDomain()

    From WLST you can find these parameters in
    wls:/DOMAIN_NAME/serverConfig/Servers/SERVER_NAME/ServerStart/SERVER_NAME
    Of course, from your scripts you can set these parameters once you have created the managed server and getting its MBean.
    I hope this helps

  • Calling stored procedures with parameters with the Database Connectivi​ty Toolkit

    Hi all,
    I am new to the forum and am having difficulty finding a solution to a particular problem I am having regarding using the LabVIEW Database Connectivity Toolkit on a project I am currently working on at my job.  I have a database in which I have tables and stored procedures with parameters.  Some of these stored procedures have input, output, and return parameters.
    I have been trying to follow this example but to no avail:  http://digital.ni.com/public.nsf/allkb/07FD1307460​83E0686257300006326C4?OpenDocument
    One such stored procedure I am working on implementing is named "dbo.getAllowablePNs", which executes "SELECT * from DeviceType" (DeviceType is the table).  In this case, it does not require an input parameter, it has an output parameter that generates the table [cluster], and has a return parameter which returns an integer value (execution status code) to show if an error occurred.  The DeviceType table has 3 columns; ID (PK, int, not null), PN (nvarchar(15), null), and NumMACAddresses (int, null).  I have gone over many examples and have talking to NI support to try to implement this and similar stored procedures in LabVIEW but have not been successful.  I am able to connect to the database with the Open Connection VI without error, but am running into some confusion following this step.  I am then trying to use the Create Parameterized Query VI to call the stored procedure and set the parameters.  I assume I would then use the Set Parameter Value VI for each parameter that is wired into the parameters input on the previous Parameterized Query VI?  I am also having some confusion during and following these steps as well.  I would greatly appreciate any advice or suggestions anyone might have in regards to this situation as I am not a SQL expert.  Also, I would be happy to provide any more information that would be helpful.
    Regards,
    Jon
    Solved!
    Go to Solution.

    Also, I don't know if this would be helpful but here is the actual stored procedure in SQL:
    CREATEPROCEDURE [dbo].[getLastSequenceNumber]
    @p1 nvarchar(10)='WO-00000'
    AS
    BEGIN
    -- SET NOCOUNT ON added to prevent extra result sets from
    -- interfering with SELECT statements.
    SETNOCOUNTON;
    -- Insert statements for procedure here
    selectmax(SequenceNumber)from Devices where WorkOrderNumber= @p1
    END
    GO

  • Query parameters with the same name and different values

    According to HTTP, multiple query or post parameters with the
    same name and different values are permitted. They are transfered
    over the wire in the following format -
    name1=val1&name1=val2&name1=val3
    The problem is that I can't see anyway of assigning multiple
    parameters with the same name and different values to the request
    object of mx.rpc.http.HTTPService. I have tried using the
    flash.utils.Dictionary object as it does strict key comparison but
    that doesn't work too. I have tried setting an array of values to a
    property of the request object but that sends the request to the
    server in the following format -
    name1=val1,val2,val3
    The java servlet engines throw exceptions when they see this.
    Any help would be greatly appreciated.

    If you're not on 8.1.4 move there. 8.1.3 had limitations in the wsrp
    release.
    wrote:
    I have an html select box that contains several values, and multiple
    selection is enabled. When my code runs as a remote portlet, the
    following is showing up in the soap monitor when I select multiple
    values and submit the form:
    <urn:interactionParams>
    <urn:portletStateChange>cloneBeforeWrite</urn:portletStateChange>
    <urn:interactionState>_action=addEmployeesToGroup</urn:interactionState>
    <urn:formParameters
    name="P62005wlw-select_key:{actionForm.selectedEmployees}OldValue">
    <urn:value>true</urn:value>
    </urn:formParameters>
    <urn:formParameters
    name="P62005wlw-select_key:{actionForm.selectedEmployees}">
    <urn:value>beatest1</urn:value>
    </urn:formParameters>
    In this case, I selected beatest1 and beatest2, but only beatest1 comes
    through to the remote portlet. Is this a known bug, and, if so, is
    there a patch or workaround available?
    Thanks in advance,
    Andy

  • Passing multiple URL parameters with same name

    Hi,
    I have a question which is not entirely related to Java. But although its related HTTP calls, so I thought I might get some ideas here.
    Background:
    I am making HTTP URL call from SAP ABAP code. Its pretty much similar to Java (creating URL connection, setting HTTP headers, connecting, receiving response and everything)
    For example,
    http://service_server:8080/a7/extension.services.SearchRequirements.a7x?RequestStatus=CR&RequestStatus=RR
    Now, this service_server runs a query to database where it uses both these values of "RequestStatus" to form 'OR' condition for a field.
    Issue:
    When I run this URL from browser, it shows XML response containing results for both values. In short, this is the ideal response.
    (I am using getParameterValues(string) at service_server to read multiple values for same parameter)
    But when I see response in SAP system, I see that it is returning data for only one value of 'RequestStatus'.
    I checked the logs of service_server, and I see that it has received only one parameter, not two.
    Question:
    It seems like SAP systems web server is truncating both parameters with same name and passing just one of them to outside server(??)
    Is there any configuration at Web Server side or any HTTP headers to be set so as to avoid this?
    Can anybody suggest something on this?

    I managed to resolve this issue by using HTTP 'Post' method to send the data.
    CALL METHOD CL_HTTP_CLIENT=>CREATE_BY_URL
        EXPORTING
          URL                = L_URL
        IMPORTING
          CLIENT             = L_HTTP_CLIENT
        EXCEPTIONS
          ARGUMENT_NOT_FOUND = 1
          PLUGIN_NOT_ACTIVE  = 2
          INTERNAL_ERROR     = 3
          OTHERS             = 4 .
    "STEP-2 :  AUTHENTICATE HTTP CLIENT
    CALL METHOD L_HTTP_CLIENT->AUTHENTICATE
      EXPORTING
        USERNAME             = 'name'
        PASSWORD             = 'password'.
    "STEP-3 :  SET HTTP HEADERS
    CALL METHOD L_HTTP_CLIENT->REQUEST->SET_HEADER_FIELD
          EXPORTING NAME  = 'Accept'
                    VALUE = 'text/xml'.
    CALL METHOD L_HTTP_CLIENT->REQUEST->SET_HEADER_FIELD
        EXPORTING NAME  = '~request_method'
                   VALUE = 'POST' .
    CALL METHOD L_HTTP_CLIENT->REQUEST->SET_CONTENT_TYPE
        EXPORTING CONTENT_TYPE  = 'application/x-www-form-urlencoded' .
    "SETTING REQUEST DATA FOR 'POST' METHOD
    IF L_PARAMS_STRING IS NOT INITIAL.
       CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
         EXPORTING
             TEXT   = L_PARAMS_STRING
         IMPORTING
               BUFFER = L_PARAMS_XSTRING
         EXCEPTIONS
            FAILED = 1
            OTHERS = 2.
    CALL METHOD L_HTTP_CLIENT->REQUEST->SET_DATA
        EXPORTING DATA  = L_PARAMS_XSTRING  .
    ENDIF.
    "STEP-4 :  SEND HTTP REQUEST
      CALL METHOD L_HTTP_CLIENT->SEND
        EXCEPTIONS
          HTTP_COMMUNICATION_FAILURE = 1
          HTTP_INVALID_STATE         = 2.
    "STEP-5 :  GET HTTP RESPONSE
        CALL METHOD L_HTTP_CLIENT->RECEIVE
          EXCEPTIONS
            HTTP_COMMUNICATION_FAILURE = 1
            HTTP_INVALID_STATE         = 2
            HTTP_PROCESSING_FAILED     = 3.
    "STEP-6 :  READ RESPONSE DATA
    CALL METHOD L_HTTP_CLIENT->RESPONSE->GET_CDATA
            RECEIVING DATA = L_RESULT .
    "STEP-7 : CLOSE CONNECTION
    CALL METHOD L_HTTP_CLIENT->CLOSE
      EXCEPTIONS
        HTTP_INVALID_STATE = 1
        OTHERS             = 2   .
    {code}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Deprecated system parameters with specified values:

    Hi ,
    I am getting below in alert log:
    Deprecated system parameters with specified values:
    remote_os_authent
    IS this parameter is suppotable in 11G and also how can i remove it from SP file with out bouncing the instance.
    thanks..

    1) It is deprecated in 11g as er your alert log message. http://docs.oracle.com/cd/B28359_01/server.111/b28320/initparams199.htm
    2) Set it in your spfile to FALSE which will reset this back to the default. This can't be changed dynamically and you will have to reboot your instance.
    alter system set remote_os_authent=false scope=spfile;

  • How to set query parameters to i5Grid

    Hello Everyone,
    I am working on creating i5Charts.
    I mapped query template and display template to i5Chart template but I need to pass the query parameters dynamically.
    How to set query parameters to i5Grid?
    Pls help with syntax.
    Thanks.
    Regards,
    Minakshi

    Hi Minakshi,
    Yes you can try the first 2 options listed by Rohit, the 3rd one however is not supported.
    The below syntax should work for you:
      1.  gridObject.getQueryObject().setRowCount(<Value>);
      2.  gridObject.getQueryObject().setParameter("RowCount", <Value>);
    You can check the documentation at the following link:
    http|s://<host>:<port>/XMII/JSDOC/i5ChartAllClasses.html
    You could also use the script assistant to check for the JS methods.
    Regards,
    Ria

  • Build string.Format parameters with a loop

    I need to dynamically build the parameters for the string.Format function dynamically in a loop.
    So rather than coding it like this:
    string result = string.Format(formatString, crits[0], crits[1], crits[2], crits[3], crits[4]);
    I need to add the parameters dynamically in a loop like this:
    StringBuilder sb = new StringBuilder();
    formatString = "T{0}{1}-R{2}{3}-{4}";
    sb.Append(formatString);
    foreach (var item in crits)
    // some logic here to determine if this param should be passed in
    sb.Append(", " + item);
    string result = string.Format(formatString);
    Any idea how to do this?
    Thanks.

    No, what you said the other day was to add a column to the table, but the parameters must come from one source and the where clause must come from another source and I have to dynamically mash them together.  the same set of parameters might be used
    with many different syntax in the where clause.
    The output for a where clause might look like this:
    (LINE_NO = 'TG-P1269') AND (GEO_LOCATION = 'T155N R96W, Sec. 10')
    OR
    (LINE_NO = 'TG-G1183') AND (GEO_LOCATION = 'T157N R94W, Sec. 20')
    OR
    (LINE_NO = 'TG-G1182') AND (GEO_LOCATION = 'T157N R94W, Sec. 20')
    OR... etc x 1000
    but to simplify it lets just work with:
    (GEO_LOCATION = 'T157N R94W, Sec. 20')
    which I achieved like this:
    string formatString = "T{0}{1} R{2}{3}, Sec. {4}";
    string result = string.Format(formatString, crits[0], crits[1], crits[2], crits[3], crits[4]);
    However, at run time I don't know how many params to pass in or which ones.  I might have to do this:
    string result = string.Format(formatString,  crits[2], crits[3], crits[4]);
    or this:
    string result = string.Format(formatString,   crits[3]);
    or something else.
    I would be able to determin which params to pass in in the loop, but of course, that's not how the string function works.

  • Set Application Parameters link not activate under Web Admin Tasks of Admin

    In the " How to do currency translation..." paper, there is a statement as following:
    "The currency conversion business rules tables can also be activated by going through the web
    admin parameters where the following parameter is set to u201C1u201D.
    FXTRANS                                              1
    However after I login to BPC Admin consol, I notice that Set Application Parameters link not activate under Web Admin Tasks of Admin Consol.
    Where should do this? Should I do it under Set AppSet Parameters?

    DFW,
    In the non-web Admin Console, you should also be able to accomplish the same thing by going to the application, clicking "Modify application", then "Change application type", then "Modify Application", then choosing the "Currency Conversion" application option.
    In general, this is how business rules can be turned on without messing around in the application parameters, and should really be the preferred method unless you have done some kind of customization that an application modification will interfere with.
    Ethan

  • Setting iView Parameters

    Hello,
    I have an issue with setting iView Parameters. I do the following:
    response.write("Converting...<br/>");
                                  iiv.putAttribute("ApplicationParameter","queryid="+request.getParameter("queryid"));
                                  try
                                       iiv.save();
                                       iiv.notifyAll();
                                  }catch (ValidationException ve)
                                       response.write(ve.toString());
                                  catch (IOException ie)
                                       response.write(ie.toString());
    However, when I see the iView properties in the portal the value is not changed. When reading the value programatically, it is changed. Are there two of them or do I have a caching issue here?
    I already tried clearing browser cache and so forth, but problem remains.
    My code is supposed to change iView-ApplicationParameters..

    Hi,
    I found all information I needed in help.sap.com.
    So I wrote a little portal component to update a custom iview parameter and it is working fine for me.
    Here's my code:
    Sharing References:
    <property name="SharingReference" value="com.sap.portal.ivs.api_iview,com.sap.portal.pcd.glservice,com.sap.portal.pcm.admin.apiservice"/>
    Custom Parameter in portalapp.xml
    <component-profile>
    <property name="AuthScheme" value="anonymous"/>
    <property name="MTAGCustom" value="Test"/>
    </component-profile>
    and my Java Code to update(change the value:
    Imports:
    import java.io.IOException;
    import java.util.Hashtable;
    import javax.naming.Context;
    import javax.naming.InitialContext;
    import javax.naming.NamingException;
    import com.inqmy.lib.xml.parser.dtd.ValidationException;
    import com.sap.portal.directory.Constants;
    import com.sap.portal.pcm.admin.PcmConstants;
    import com.sap.portal.pcm.iview.IiView;
    import com.sapportals.portal.pcd.gl.IPcdContext;
    Code Snippet:
    Hashtable env = new Hashtable();
    env.put(Context.INITIAL_CONTEXT_FACTORY,IPcdContext.PCD_INITIAL_CONTEXT_FACTORY);
    env.put(Context.SECURITY_PRINCIPAL, request.getUser());
    env.put(Constants.REQUESTED_ASPECT, PcmConstants.ASPECT_SEMANTICS);
    InitialContext iCtx = null;
    try
      String iViewID = "pcd:portal_content/com.mtag.test/com.mtag.testcomponent";
      iCtx = new InitialContext(env);
      IiView myIView =(IiView)iCtx.lookup(iViewID);
      myIView.putAttribute("MTAGCustom","newValue");
      myIView.save();
      myIView.notifyAll();
    } catch(Exception Ex) {
      Ex.printStackTrace();
    I deployed the component and create an IView from PAR. I started the iView in Preview Mode and the Custom Parameter "MTAGCustom" now has the new Value "newValue"
    Let me know if it helps (Reward Points are appreciated if helpful
    Cheers

Maybe you are looking for