Building up a String

Post Author: hummy
CA Forum: Formula
I'm trying to build up a string from string value. The string value is basically a delimited list of bug numbers in the format below:
[3] CR1234/CR4513/CR1241
The number in the square brackets indicate the number of bugs being declared and the number of bugs is then listed delimited by a "/" charachter. I'm tryin to extract out each bug number sperately so that i can pass the bug number to a subreport to report on the bug. I can extract out each entity seperately but one of the requirements i have is to display the list of CRs in a list. I came up with the following formula but it doesn't seem to be working. Any ideas? I've simplified it slighlty below
numbervar counter :=1;numbervar endCounter := 3 //This number is extracted from the square brackets;stringvar list := "";stringvar crList := "";
do(list := split("CR1234/CR4513/CR1241","/")&#91;counter&#93;;counter:= counter + 1;crList := list & CHRW(10) + List;)while counter < endCounter;crList;
I don't seem to get a list of all CRs seperated by the carriage return. I continually seem to get CR1241 3 times.
Can someone explain what i am doing wrong since i was expecting to see CR1234(CHRW(10))CR4513(CHRW(10))CR1241(CHRW(10)
Thanks

Post Author: SKodidine
CA Forum: Formula
do
list := split("CR1234/CR4513/CR1241","/")&#91;counter&#93;;
counter:= counter + 1;
if counter = 2 then crlist := list else  // this is to prevent a blank line at the top
crList := CRlist & CHRW(10) & List;)
while counter <= endCounter;
crList;

Similar Messages

  • BUG Version 10.1.2.1.0 Build(1913) Debug String Holds Less Than 101 Chars

    BUG Version 10.1.2.1.0 Build(1913) Debug String Holds Less Than 101 Chars.
    While In Debug Mode Any String Object Variable Can't Hold
    More Than 100 Chars.This Problem Only Takes Place While Using
    Step In To Debug Future And Not In Step Over Mode.
    Is This Bug Only Happens To Me.

    Right click the value and use "View Whole Value".
    Brian

  • Building an SQL string

    Hi, I have run into a problem where i'm not sure how to start. I'm generating reports based on what criteria a user chooses. Here is a list of variables that are possible criteria.
    String rep     
    String callType
    String action           String phone
    String name
    String startDate
    String endDate
    String endTime
    String startTime
    All the following variables are populated based on user input. The reports give information on calls taken by Internet HelpDesk staff. For example, lets say a manager wants to see "all calls that were created by a representative with the name of "ANDY" that was created on the date of 10/13/2001. This means that rep = "Andy"; and startDate = "10/13/2001;, and that all other variables are null or empty strings. After checking all variables, the SQL statment should look something like "SELECT (table fields) FROM (tables) WHERE Representative ='"+rep+"' and Date = '"+startDate+"'"
    My problem is building that sql string because it can be so many different things. If all variables are null, Then there should be no 'WHERE' and no quotes anywhere just "SELECT (table fields) FROM (tables)" you see what i mean
    I'm not sure what the best way to approch this is. I'm pretty sure i can do it with some crazy if statements but am also more sure that thats not the best way to do it.
    Any suggestions on how to approch this?
    Thanks in advance

    I don't think you/anybody could find a better way to
    do that because you have so many possible criteria.
    How do you know you are more sure there is the "best
    way" to do that? If you are sure, how to do that?
    Never mind if you are not sure. :-)Thanks jrodi

  • How to build a connection string if "Only variable names (i.e.: $variable) may be used as the target of an assignment statement."

    im looping through databases on a server & building  a connection string to each database.
    $SQLConn.ConnectionString = "Server=$SrvName; Database=$DBName; User ID =DBLogin; Password=myPassword;"
    The problem is i get this error:
    Only variable names (i.e.: $variable) may be used as the target of an assignment statement
    I can put the code into an Inlinescript, but then I lose the ability to perform paralellism. Is there any way to construct the connection string in PS Workflow without using an Inlinescript?

    Hi Winston,
    Why not just wrap the InlineScript blocks in a Parallel block, to cause them to execute in parallel?
    For example:
    workflow foo {
    parallel {
    inlinescript {
    start-sleep -Seconds (Get-Random -Minimum 1 -maximum 5)
    "a"
    inlinescript {
    start-sleep -Seconds (Get-Random -Minimum 1 -maximum 5)
    "b"
    Sometimes outputs "a b" and sometimes outputs "b a"

  • How to build dynamic query strings in the query using DB adapter 'Pure SQL'

    Dear Forum,
    I am building an application which will access DB to fetch some result set. The query involves retrieving data from multiple tables(nearly 10 tables). So I have created a DB adapter using 'execute pure sql' option. With this query works fine, but my inputs parameters will vary. So I need to make my query dynamic to append the query strings at runtime depending on the inputs.
    For example I have 3 input variables - input1,input2 and input3 (in my request xsd) which are used in the pure sql query. Now if I get a 4th input parameter input4 in the request, I need to append this to query string as 'AND input4=[some value]' at runtime. Otherwise my query should have only 3 parameters. Please suggest how this can be achieved.
    Regards,
    Satya.

    This is a strange requirement, depending on the columns you have and what are optional in them, one way is to have separate operations and each opeartion will have different inputs and for each operation , a different DB Adapter is called. But this way, it results in more number of operations for the service as well as more number of references in the composite. Even if you pass the column inputs to the SQL procedure, it will result in a large number of if-else cases..
    Thanks,
    N

  • Building the varchar string to return from a pl sql function

    i'm new with pl/sql and i'm having trouble trying to build the string that i want to return from a function that is inside a package. it seems my problem stems from the fact that i'm trying to incorporate a variable (varchar2) into the string to be returned. below are two attempts that i've made which do not work:
    function test_policy (p_schema_name IN varchar2, p_object_name IN varchar2) return varchar2 as
    predicate_value varchar2(2000);
    user_name varchar2(100);
    begin
    select first_name
    into user_name
    from employees
    where first_name = SYS_CONTEXT('hr_app_context', 'username');
    predicate_value := 'first_name = ' || user_name;
    predicate_value := 'first_name = ' || '' || user_name || '';
    return predicate_value;
    end test_policy;
    Can someone help me with the proper syntax to build my string for the return value? Thanks.

    this function implements the code for a policy i've created. basically, the policy says that when i do a select on the employees table, i should only see a record whose first_name = sys_context('hr_app_context', 'username'). so, when i perform a simple select * from employees, i get an error which says policy predicate has error. i'm pretty sure the error is caused by how i'm building the return value for that function. if i hard code some return value like:
    predicate_value := 'first_name = ''HR''' ;
    the select statement above works fine, and i only see the record from employees where first_name = 'HR'

  • Build path from string control

    Does anyone know why when I Use a string constant fed into a build path function my vi creates the file properly but when I change it to a control so that I can input a number to the file name I get error 1059 unexpected file type?
    Solved!
    Go to Solution.

    I'm trying to write to a file each time I update data. Everything was working fine until i realized that each time I stop excecution and start back up I lose all data if I replace it again so I wanted to be able to add a new number of my choosing each time to the file name but keep the full base name. I also wanted it to save in a base location while creating a new folder for each month and each day. If i a string control and concatenate it the error comes from the open/create/replace function but doesn't come up when I use a string constant.
    The first picture is my vi and the 2nd is the sub vi used to create the folder if it doesn't exist
    Attachments:
    File Saver 1.jpg ‏45 KB
    File Saver 2.jpg ‏58 KB

  • What does error message on opening project in iPlanet Application Builder indicate? "String index out of range:-1"

    Hello,
    After creating a project I am inserting existing jsp files into the project. When I try to reopen the project in iab I get this message. "Unable to load file c:\.....\projectname.iab. String index out of range: -1". Has anyone encountered this problem? OS is Windows 2000, iaBuilder 6 sp1.

    Hello,
    After creating a project I am inserting existing jsp files into the project. When I try to reopen the project in iab I get this message. "Unable to load file c:\.....\projectname.iab. String index out of range: -1". Has anyone encountered this problem? OS is Windows 2000, iaBuilder 6 sp1.

  • Building the SQL string

    Hi, i stumbled over the following while developing my application. As we all know, it's not a good idea to do the following
    String sql = "insert into mytable values ('";
    sql += object.getStringValue1() + "','";
    sql += object.getStringValue2() + "','";
    // more...instead we should do it like this
    StringBuffer sql = "insert into mytable values ('";
    sql.append(object.getStringValue1()).append("',");
    sql.append(object.getStringValue2()).append("',");
    // more...If you agree so far, my question now: on how many appends is it worth the effort? I mean, it's clear to me, that i would use StringBuffer when appending many strings. But should i use StringBuffer to append two strings? Three strings?
    Has anybody come up with some experience in this field?
    Thanks in advance for your comments.
    Markus

    For me it's not worth the effort to do either of those things. Instead, I use this:String sql = "insert into mytable values (?,?,?,?,?)";
    PreparedStatement ps = conn.prepareStatement(sql);and later in the program:ps.setString(1, object.getStringValue1());
    ps.setString(2, object.getStringValue2());
    // more...
    ps.executeQuery();You only have to create the PreparedStatement once and you can reuse it as often as you like. Don't close it until you don't need to use it any more.

  • Building Connection string in Crystal 10

    Hi,
    How to build a connection string in Crystal 10 using DSN as data source?
    I tried the following syntax, but failed to establish connection...
    Driver={SQL Server};Server=;Uid=<username>;Pwd=<pwd>;
    Help me to fix this out.
    Thanks
    Viswa

    Hey Prathamesh,
    I was asking the option available in the crystal client itself!
    In the data source selection, there is three options available:
    1. Data Source Name
    2. File name DSN
    3. Enter Connection String
    I asked about the 3rd option in that dialog; in which we can directly enter the connection string for the data source connection. I don't think this is related with SDK Application Development.
    Thanks
    Viswa
    Edited by: Viswanathan Madhavan on Nov 27, 2008 3:08 AM

  • Building SQL String ?

    I am trying to build a SQL String and send it to the database...
    this is how i am trying to form a query string
    StringBuffer sBuff = new StringBuffer(250);
    sBuff.append("old information")
    sBuff.append("new history added twice");
    String caseObjId = "2567034";
    StringBuffer queryBuff = new StringBuffer(250);
    queryBuff.append("UPDATE table_case ");
    queryBuff.append("SET case_history =" + sBuff);
    queryBuff.append("WHERE objid =" + caseObjId);
    i am getting SQL Exception saying
    com.sybase.jdbc2.jdbc.SybSQLException: Incorrect syntax near 'information'.
    let me know what where i am doing mistake
    thanks
    KM

    The previous posters are right on target for debugging your problem; if you printed out the query that's giving you problems, you would see:
    UPDATE table_case
    SET case_history =old informationnew history added twice
    WHERE objid =2567034 and the problem then becomes obvious that the string/varchar data needs to be quoted.
    That will fix your immediate problem.
    However, since you are obviously a newbie, I'll tell you how to fix 2 or 3 more problems; don't use Statement, use PreparedStatement and bind your parameter values.
    <rant>
    First, when a database executes a SQL statement for the first time, it has to "parse" it. "parsing" is an awful like compiling in that it often takes 100 times longer or more to compile a bit of code than it does to execute it. A good database will check a cache of parsed SQL to see if it doesn't need to parse again, but it often relies on an exact match of the SQL. If you use Statement and change the value of case_history or objid, it's not an exact match. However, if you use PreparedStatements, your values aren't part of the SQL; therefore you get a lot more matches in the parse cache and the database saves a huge amount of work.
    Second, when you build up SQL with embedded values like you're doing, you have to deal with any special characters appropriately; in particular the single quote character; for example, if you have a LAST_NAME column, you need to support the name "O'Conner"; the single-quote in the middle has to be recognized and properly escaped. This problem simply goes away with parameter bindings; the code and the data are widely seperated and there's no question where the boundary is.
    Third, building up SQL in the way you did is the technique that causes a major security hole an poorly coded applications. Let's say you're building an e-commerce site that will keep customer credit card numbers on file (risky) and want a function to display credit card numbers given an account number (not really a good idea, but it illustrates the technique). You have code like:
    StringBuffer queryBuff = new StringBuffer();
    queryBuff.append("SELECT CC_FIRST_NAME, CC_LAST_NAME, CC_NUMBER, CC_EXP ");
    queryBuff.append("FROM CARD_DATA);
    queryBuff.append("WHERE account_number  =" + acct_number);this will work just great when a user enters their account number of "1234567", and it will work just great (for the hacker) when the account number is entered as "1234567 or (CC_FIRST_NAME = 'Bill' and CC_LAST_NAME = 'Gates')"; the hacker's add-ons are treated as code, not data, and the e-commerce site spits up a customer's data to an authorized person. Again, parameter binding prevents this and add-ons get treated as part of the account number, probably generating a data-type error on the database. Obviously, you can validate the data to numerics in this example, but if you use PreparedStatement instead, you don't have to think, it takes care of itself.
    </rant>

  • Apple script to build text string

    quick question.. how do i go about building a text string from dialog box results?
    ie 1st question asks for a username second a unix path.
    the put that in a text string to run in a shell script

    Use a construct such as:
    set answer_1 to text returned of (display dialog "Question 1" default answer "")
    set answer_2 to text returned of (display dialog "Question 2" default answer "")
    do shell script answer_1 & answer_2
    (50002)

  • How can I get all the values of a String array profile property using javascript?

    I am trying to build functionality into our site that records all products added to the basket against a user's profile.
    I have so far been able to store the product codes against the profile as a property using Ajax:
           var dataString = ":formid=addProduct&:formstart=/apps/thread/templates/page_product/jcr:content/par/produc t/formstart&:redirect=/content/thread/en/user/cart.html&productId=151515:profile="+profile ;
                         $.ajax({ 
                type: "POST", 
                url: "/content/women/evening/dresses/l-k-bennett-davinadress.html", 
                data: dataString, 
                success: function(data) { 
    In this example I have hardcoded a product ID of 151515.
    In order to save the property as a multi string field you simply replace &productId=151515 with &productId=151515&productId=131313&productId=141414 or as many extra values as you want to build into that string. This stores a productId property against a user profile.
    The issue comes from calling that data back. Using var value = CQ_Analytics.ProfileDataMgr.getProperty("productId") I can get the first value of this array (or the single value if only one is stored).
    However there does not seem to be a way to get any of the other stored values in the array using getProperty. Does anyone know how I can achieve this?

    Hi,
    Don't think that's possible. Even if it were, you wouldn't be able to use/display BOOLEAN type in SQL.
    If you just aim to see what they are, you could do something like this
    select text
      from all_source
    where owner = 'SYS'
       and name = 'DBMS_DB_VERSION'
       and type = 'PACKAGE';Or even
    select dbms_metadata.get_ddl('PACKAGE', 'DBMS_DB_VERSION', 'SYS') from dual;My version is:
    SQL> select * from v$version where rownum = 1;
    BANNER                                                         
    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
    1 row selectedIn 11g you also have [PL/SCOPE|http://download.oracle.com/docs/cd/E11882_01/appdev.112/e10471/adfns_plscope.htm#ADFNS02203] which might help you even more.
    Regards
    Peter

  • How to specifiy the provider to be Oracle.ManagedDataAccess.Client when creating a dynamic connection string with EF Code First from Database?

    I am trying to use the relatively new Code First from Database with the newest EF (6.x) and on an Oracle database (11g, but I have installed the newest ODTwithODAC). First of all, it works fine as long as the connection string is inside the App.Config file. But when I try to build it dynamically in the C# code (or rather, statically at the moment) it fails. I have it working with a dynamically built connection string when doing Model from Database though, so I'm at a loss right now.
    First, I have created a second constructor for the context class that takes a string and does base(connectionString). Then I build the connection string via
    OracleConnectionStringBuilder oracleBuilder = new OracleConnectionStringBuilder();
    oracleBuilder.DataSource = "TEST.BLA.COM";
    oracleBuilder.UserID = "ABC";
    oracleBuilder.Password = "abc";
    oracleBuilder.PersistSecurityInfo = true;
    string connection = oracleBuilder.ToStrin();
    Now trying to open an EntityConnection by giving to it this provider-specific connection string (or even the static one from the App.Config) doesn't work; I get "keyword not supported: user id"). Trying it by creating a context and giving this connection string doesn't work either. I'm pretty sure that this is because I didn't specify the provider to use; after all, it should use the Oracle.ManagedDataAccess.Client provider and not an SQL Server based one.
    I then tried to get around this by using an EntityConnectionStringBuilder on top and specifying the provider keyword there, but then I get "keyword not supported: provider" when using it in the context constructor, and "the 'metadata' keyword is always required" when using it with the EntityConnection constructor.
    As I said above: I bet it's the provider that I have to specify somehow, but I don't know how. The code that does work is the following:
    using (var context = new Model())
    context.Database.Connection.Open();
    context.Database.Connection.Close();
    When I read context.Database.Connection.ConnectionString, it is exactly the provider-specific connection string I created above, but I don't know where to specify the provider again. Do you know of any way to do this? Certainly there must be one.
    PS: I have also posted this question on http://stackoverflow.com/questions/27979454/ef-code-first-from-database-with-managed-oracle-data-access-dynamic-connection because it is quite urgent and I'd like to use Code First from Database. Otherwise I'd have to go "back" to using Model from Database again, which is not ideal because we have updatable views where the .edmx-file has to be edited after every reload of the model, while with Code First from DB inserting into the view automatically works.

    I am trying to use the relatively new Code First from Database with the newest EF (6.x) and on an Oracle database (11g, but I have installed the newest ODTwithODAC). First of all, it works fine as long as the connection string is inside the App.Config file. But when I try to build it dynamically in the C# code (or rather, statically at the moment) it fails. I have it working with a dynamically built connection string when doing Model from Database though, so I'm at a loss right now.
    First, I have created a second constructor for the context class that takes a string and does base(connectionString). Then I build the connection string via
    OracleConnectionStringBuilder oracleBuilder = new OracleConnectionStringBuilder();
    oracleBuilder.DataSource = "TEST.BLA.COM";
    oracleBuilder.UserID = "ABC";
    oracleBuilder.Password = "abc";
    oracleBuilder.PersistSecurityInfo = true;
    string connection = oracleBuilder.ToStrin();
    Now trying to open an EntityConnection by giving to it this provider-specific connection string (or even the static one from the App.Config) doesn't work; I get "keyword not supported: user id"). Trying it by creating a context and giving this connection string doesn't work either. I'm pretty sure that this is because I didn't specify the provider to use; after all, it should use the Oracle.ManagedDataAccess.Client provider and not an SQL Server based one.
    I then tried to get around this by using an EntityConnectionStringBuilder on top and specifying the provider keyword there, but then I get "keyword not supported: provider" when using it in the context constructor, and "the 'metadata' keyword is always required" when using it with the EntityConnection constructor.
    As I said above: I bet it's the provider that I have to specify somehow, but I don't know how. The code that does work is the following:
    using (var context = new Model())
    context.Database.Connection.Open();
    context.Database.Connection.Close();
    When I read context.Database.Connection.ConnectionString, it is exactly the provider-specific connection string I created above, but I don't know where to specify the provider again. Do you know of any way to do this? Certainly there must be one.
    PS: I have also posted this question on http://stackoverflow.com/questions/27979454/ef-code-first-from-database-with-managed-oracle-data-access-dynamic-connection because it is quite urgent and I'd like to use Code First from Database. Otherwise I'd have to go "back" to using Model from Database again, which is not ideal because we have updatable views where the .edmx-file has to be edited after every reload of the model, while with Code First from DB inserting into the view automatically works.

  • Returning strings from OLE2 Word object (Forms 4.5)

    Below is an example of how to return string and numeric values from OLE2 objects. In this example the OLE2 object is a MS Word document, and I want to fetch all the bookmarks in the Document into a Forms 4.5 Varchar2. To do this I first need to get the count of bookmarks.
    Getting a string property from an OLE2 object is a common OLE2 requirement but is poorly documented. This is the ONLY way it can be done, as OLE2.INVOKE_CHAR returns a single character not a string. Use OLE2.INVOKE_OBJ, then OLE2.GET_CHAR_PROPERTY which does return a string, as shown below, to return a string from an OLE object (or OLE property).
    Also note how you can only get the child object from its parent, not the grandchild (etc) object, so multiple (cascading) GET_OBJ_PROPERTY calls are required.
    /* by: Marcus Anderson (Anderson Digital) (MarcusAnderson.info) */
    /* name: Get_Bookmarks */
    /* desc: Returns a double quoted CSV string containing the document*/
    /* bookmarks. CSV string will always contain a trailing comma*/
    /* EG: "Bookmark1","Bookmark2",Bookmark3",Bookmark4", */
    /*               NB: This requires that Bookmarks cannot contain " chr */
    PROCEDURE Get_Bookmarks (pout_text OUT VARCHAR2)
    IS
    v_text           VARCHAR2(80);
    v_num                         NUMBER(3);
         v_arglist OLE2.LIST_TYPE;
         v_Application     OLE2.OBJ_TYPE;
    v_ActiveDoc      OLE2.OBJ_TYPE;
    v_Bookmarks          OLE2.OBJ_TYPE;
    v_Item                    OLE2.OBJ_TYPE;
    v_i                              NUMBER(3);
    BEGIN
              v_Application     := LDWord.MyApplication; -- Word doc opened elsewhere
                   /* Set v_num = ActiveDocument.Bookmarks.Count */
    v_ActiveDoc := OLE2.GET_OBJ_PROPERTY (v_Application, 'ActiveDocument');
    v_Bookmarks := OLE2.GET_OBJ_PROPERTY (v_ActiveDoc , 'Bookmarks');
    v_num := OLE2.GET_NUM_PROPERTY (v_Bookmarks, 'Count'); -- NB: Returns numeric property
                   /* Build the output string, pout_text. */
    FOR v_i in 1..v_num LOOP
                        /* Set v_item = ActiveDocument.Bookmarks.Item(v_i) */
    v_arglist := OLE2.CREATE_ARGLIST;
    OLE2.ADD_ARG (v_arglist, v_i);
    v_Item := OLE2.INVOKE_OBJ (v_Bookmarks, 'Item', v_arglist); -- NB: returns parent object (array element)
    OLE2.DESTROY_ARGLIST (v_arglist);
                        /* Set v_text = ActiveDocument.Bookmarks.Item(v_i).Name */
    v_text := OLE2.GET_CHAR_PROPERTY (v_Item, 'Name');                    -- NB: Returns string/varchar2 property
    pout_text := pout_text || '"' || v_text || '",' ;
    END LOOP;
    END;

    Please repost in the Forms discussion forum.
    - OTN

Maybe you are looking for

  • What is this? -- unchecked call to put(K,V)

    unchecked call to put(K,V) as a member of the raw type java.util.HashMap m.put( args[0], new Double( args[1])); I have code that stores a string and a double value in a map like this: String args[]; m.put( args[0], new Double( args[1])); but I get th

  • Problem printing from Safari to hp printer

    I have been having trouble printing documents such as fedex shipping forms and epicurious recipes from safari to my hp officejet 6110. For example, a one-page document will kick out a blank page or two, then print the upper one-third of the document

  • Bigger Tiles Plugin CS2 and CS3 on XP

    How come the files is not located in the extensions folder in either versions. Isn't it supposed to be located here?: Program Files\Adobe\Adobe Photoshop CS3\Plug-Ins\\Extensions\Bigger Tiles folder I am on XP with both CS2 and CS3 installed. I can't

  • WLC Port Channel Host Flapping

    Hello, I have setup LAG for one of our 5508 controllers and have connected 4 of the 8 ethernet ports to a 4507 switch. After configuring 2 port channels on the switch we are receiving a host flapping error between the port channels and it seems to be

  • NW 7.01 SP5: chart frame style. 'Neutral' vs. 'Primary' - no difference??

    We had previously (pre-EhP1) developed some VC reports with column charts, nested iViews, lots of fun stuff. We used the 'neutral' frame style. Now we have upgraded to EhP1 SP5 and find (among other issues, hah hah groan ....), that the neutral frame