Loop through Query String in ASP

Hi,
I am new to ASP and am trying to loop through values in a
query string
separated by a comma, for example:
/site/search/results.asp?ids=19736a,20248a,14952a,19956a
I need to construct SQL from this something like
SELECT * FROM MyTable WHERE
ID = 19736a OR
ID = 20248a OR
ID = 14952a OR
ID = 19956a
I am just unsure on how to separate all the values from the
query string.
Thanks for your advice.

Oh, in the example below there is no space between the id
numbers in the
querystring.
eg. ids=1,23,456,2
If you do have spaces then you need to adjust the split
accordingly
eg. ids=1, 23, 456, 2
you would use myIdArray=split(idStr,", ")
note the space after the comma.
just make sure you always use the same format in your
querystring
Justin
"Justin Reid" <[email protected]>
wrote in message
news:e6osem$dfj$[email protected]..
> You need to create an array of ids and then add them to
your SQL.
> Something like:
> <%
> If Request.QueryString("ids") <> "" Then
> Dim idStr, cnt, varID
> 'get the string of id'
> idStr = Request.QueryString("ids")
> 'create the array
> myIdArray=split(idStr,",")
> cnt=0
> 'loop though the array and add to a new string
> for i=o to ubound(myIdArray)
> If cnt > 0 Then varID = (varID & " OR")
> varID = (varID & " id = " & cStr(myIdArray(i)))
> cnt=cnt+1
> next
> End If
> %>
>
> Then simply add you new SQL segment to your recordset.
> Something like
>
> SELECT * FROM MyTable WHERE" + Replace(varID, "'", "''")
+ "
>
> Hope that helps
>
> Justin
>
> "Shaun" <[email protected]> wrote in
message
> news:e6ole1$56v$[email protected]..
>> Hi,
>>
>> I am new to ASP and am trying to loop through values
in a query string
>> separated by a comma, for example:
>>
>>
/site/search/results.asp?ids=19736a,20248a,14952a,19956a
>>
>> I need to construct SQL from this something like
>>
>> SELECT * FROM MyTable WHERE
>> (
>> ID = 19736a OR
>> ID = 20248a OR
>> ID = 14952a OR
>> ID = 19956a
>> )
>>
>> I am just unsure on how to separate all the values
from the query string.
>>
>> Thanks for your advice.
>>
>
>

Similar Messages

  • Looping through a string to search for a number?

    I've been trying to use substr to loop through some text in a textfield I have cast as number.  Although there is a problem with this, substr only goes through strings so if I type something as a number, it wont loop through t.  Is there a similar function to loop through numbers?

    use the string methods to find what you're looking for.  you can cast as a number when you've finished using the string methods.
    or, you can use the regular expression class.

  • Passing Flash Vars Through Query Strings and JS

    I'm trying to get a particular video to play in a flash ad
    when a particular query string is clicked. I can't get it to work
    and would appreciate any help that you can provide. The ad plays
    but the movies don't show when the query string is clicked or when
    you click on objects in the movie that are supposed to populate a
    movie. Here's the code I've been trying to use:

    Thanks for the advice, I have tried Javascript to resolve the
    problem. In response to the <object> tag missing, There is
    one I just included a snippet of the html code sorry for the
    confusion. Due to deadlines I abandoned the functionality of the
    script and "dumbed" down the script. Thank you again for the help

  • Pass Variables into AS3 through Query String?

    Man! I've been searching ferociously and can't seem to find a solution that works for me. I am trying to pass variables via query string on a PHP page to Flash, and then have the swf add movie clips to the stage depending on the information it receives.
    Here is what the PHP outputs:
    swfobject.embedSWF("flash/detailScore.swf?a=0-0&b=0-0&c=30-54&d=30-20&e=42-18", ...
    And here is my AS3 code:
    function loaderInfoSh(e:Event):void{
    var myQueryStrings=this.loaderInfo.parameters;
    a = myQueryStrings.a;
    b = myQueryStrings.b;
      c = myQueryStrings.c;
    d = myQueryStrings.d;
    e = myQueryStrings.e;
    addTheResults(a,1);
    addTheResults(b,2);
    addTheResults(c,3);
    addTheResults(d,4);
    addTheResults(e,5);
    this.loaderInfo.addEventListener(Event.COMPLETE, loaderInfoSh);
    The addTheResults function takes the coordinates, adds a MC instance to the stage and positions it accordingly.
    var colorMCArray:Array = new Array();
    function addTheResults(val,colnum:Number){
    if(val == null){val = "52-46";} // so I can test it locally
    var daColor:String;
    switch (colnum){
    case 1:
    daColor = "f3951c";
    break;
    case 2:
    daColor = "74b47d";
    break;
    case 3:
    daColor = "436494";
    break;
    case 4:
    daColor = "9b74ac";
    break;
    case 5:
    daColor = "b43d44";
    break;
    var dash:int = val.indexOf("-");
    var lateral = val.slice(0,dash);
    var vertical = val.slice(dash+1);
    lateral --;
    vertical --;
    // adding the MC instance
    var comm:tileB = new tileB();
    comm.name = "comm"+colnum;
    addChild(comm);
    colorMCArray[colnum] = comm;
    //Change the color
    var colorTransform:ColorTransform = colorMCArray[colnum].transform.colorTransform;
    var thiscolor = "0x"+daColor;
    colorTransform.color = thiscolor;
    colorMCArray[colnum].transform.colorTransform = colorTransform;
    colorMCArray[colnum].x = 5;
    colorMCArray[colnum].y = 536;
    colorMCArray[colnum].x += (lateral * 9);
    colorMCArray[colnum].y += (vertical * 9)*-1;
    colorMCArray[colnum].addEventListener(MouseEvent.MOUSE_OVER, btnro);
    colorMCArray[colnum].addEventListener(MouseEvent.MOUSE_OUT, btnrout);
    I don't know what I'm doing wrong here.

    Was this the "e" in the code below you were pertaining to as the culprit? "e" is not a keyword. It's just the shortcut for the word "event" for the variable name of type Event which is the Event object that triggered the call of function loaderInfoSh. In your code you assigned e = myQueryString.e which should have given you a type mismatch error.
    function loaderInfoSh(e:Event):void{
    var myQueryStrings=this.loaderInfo.parameters;
    a = myQueryStrings.a;
    b = myQueryStrings.b;
      c = myQueryStrings.c;
    d = myQueryStrings.d;
    e = myQueryStrings.e;
    addTheResults(a,1);
    addTheResults(b,2);
    addTheResults(c,3);
    addTheResults(d,4);
    addTheResults(e,5);
    this.loaderInfo.addEventListener(Event.COMPLETE, loaderInfoSh);

  • Unable to loop through a ResultSet (Classic ASP, ADO)

    All,
    I have inherited a legacy web site and have encountered a problem that I can't get figure out:
    The program structure is as follows:
     1. Execute a SQL Server Stored proc and create XML from the result set 
     2. If a condition is met, exceute a second stored proc and hydrate the XML from step one with some more tags
     3. return the XML is the response
    Step 1 happens without problems, but when the condition is met the execution halts as soon as I try to do anything with the Result Set. For instance set
    RS.ActiveConnection = nothing or do until CustodianRS.EOF both halt execution. and I end up with an empty Response.
    Here is the offending code:
    if len(trim(strTradingArea)) = 4 then
    dim CustodianCN
    dim CustodianCMD
    dim CustodianRS
    dim node
    set CustodianCN = server.CreateObject("ADODB.Connection")
    CustodianCN.CursorLocation = adUseClient
    CustodianCN.Open Application("PANORAMA_SACDETAILS")
    set CustodianCMD = server.CreateObject("ADODB.Command")
    with CustodianCMD
    set .ActiveConnection = CustodianCN
    .CommandType = adCmdStoredProc
    .CommandTimeout = 300
    .CommandText = "p_SACGetAccountCustodiansByTradingArea"
    .Parameters("@TradingArea").Value = strTradingArea
    set CustodianRS = .Execute
    end with
    'set CustodianRS.ActiveConnection = nothing
    CustodianRS.Sort = "Custodian"
    do until CustodianRS.EOF
    set node = responseXML.createElement("custodian")
    node.setAttribute "id",trim(CustodianRS.Collect("Custodian") & "")
    node.setAttribute "parent",trim(CustodianRS.Collect("Parent") & "")
    responseXML.firstChild.appendChild(node)
    CustodianRS.MoveNext
    loop
    end if
    Does anyone have any suggestions? Any help would be much appreciated, I have already spent a considerable amount of time on this.
    Thanks!

    I had a minute or two.  Here are some things to think about:
    I removed all unnecessary lines of code and indented correctly.  What I immediately see is that you have no error management.  There is also no way to detect an empty recordset.
    set CustodianCN = server.CreateObject("ADODB.Connection")
    CustodianCN.Open Application("PANORAMA_SACDETAILS")
    set CustodianCMD = server.CreateObject("ADODB.Command")
    with CustodianCMD
    set .ActiveConnection = CustodianCN
    .CommandType = adCmdStoredProc
    .CommandTimeout = 300
    .CommandText = "p_SACGetAccountCustodiansByTradingArea"
    .Parameters("@TradingArea").Value = strTradingArea
    set CustodianRS = .Execute
    end With
    CustodianRS.Sort = "Custodian"
    do until CustodianRS.EOF
    set node = responseXML.createElement("custodian")
    node.setAttribute "id",trim(CustodianRS.Collect("Custodian"))
    node.setAttribute "parent",trim(CustodianRS.Collect("Parent"))
    responseXML.firstChild.appendChild(node)
    CustodianRS.MoveNext
    loop
    My suspicion is that you did not write this.  If you are just trying to change or migrate a web page then I recommend contacting a consultant.  Using a database from a web page is a very tricky task.  If you are not a developer it is highly
    unlikely that you will be able to get it to work.
    ¯\_(ツ)_/¯

  • Fastest way to loop through a group of strings

    I am trying to optimize a small class that loops through an array of strings and compares to see if another string equals one of the values, for example:
    String test = "this is test5";
    String array[] = {"test1","test2","test3, test4,test5,test6,test7,test8"};
    for(int i = 0;i < array.length; i++)
    if (test.endsWith(array))
    return array[i];
    }The array that I am using holds closer to 15 values, but this loop can be hit thousands of times a day.  My  question is, are there any faster ways to loop through multiple strings than using arrays?  How do array lists or maps compare?                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    sarcasteak wrote:
    The array that I am using holds closer to 15 values, but this loop can be hit thousands of times a day. 15,000 comparisons a day is nothing. The following code does 15 million String compares in 188 ms.
    public class StrCmp {
      public static void main(String... args) {
        String[] arr = {"abc", "sdfasdlfkjasldfjalsdkfj", "234l2kjala34kh", "slkfjal3490u saf",
                        "234lkjasldfhk23k4jhasf", "23l4kjsf", "alsflsdjkf", "aslkdfajsdf3h", "zzzzz",
                        "uhuhuhuhuh", "uhu2huh234234", "n234aoiuf", "234lasdhvoaih3", "zoziucvoiu", "asdflsjfl"};
        long start = System.currentTimeMillis ();
        for (int i = 0; i < 1000000; i++) {
          String str = "qqq";
          for (String str2 : arr) {
            if (str2.endsWith (str)) {
              System.out.println ("match");
        long end = System.currentTimeMillis ();
        System.out.println((end - start) + " millis");
    My question is, are there any faster ways to loop through multiple strings than using arrays? How do array lists or maps compare?Before you worry about taking something simple that works and complicating it to make it faster, make sure there's a reason to do so.
    If you do in fact need to make it faster, there are several different things you could do, but which one is best depends on a number of factors specific to your particular requirements and use cases.

  • Question to Proxy in Reading Query String

    Hi, our team have a problem, and let me state below:
    We use reverse proxy in machine A to redirect to machine B.
    Machine A is SJWS 6.1, and it has customized SAF.
    The SAF has one mission, which is to retrieve query string from each requests.
    The question is:
    When the SAF read the query string in body data( with netbuf_getc() ), the application in AP SRV cannot read anything about query string.
    In the contract way, if we let AP SRV to process data through query string first, and then we try to get body data( with netbuf_getc() ), NSAPI gets nothing.
    Any suggestion?!
    thanx.
    environment:
    ================
    machine A:
    Windows 2003 Server Enterprise (32 bits)
    Sun Java System Web Server 6.1 SP5 with Reverse Pxory Plug-in
    machine B:
    Windows 2003 Server Enterprise (32 bits)
    Sun Java System Application Server 8.1 (Enterprise, Platform both have been tried.)
    ================
    Message was edited by:
    potai.tsou

    The query string is part of the request URI. It is never part of the request body.
    I assume you mean that your SAF reads the request body to extract form data. If your SAF consumes the request body, that request body will not be available to other SAFs.
    It sounds like you should consider writing an input filter, not a SAF, that will process the request body. There's information on input filters in the NSAPI Programmer's Guide at http://docs.sun.com/source/817-1835-10/npgcfltr.html.

  • How do you iterate through a string?

    Hi! How do I loop through a string of characters. My program needs to iterate through a string in order to do some calculations. Here is an example:
    <item>1</item>
    <description>This is an example.</description>
    How I iterate through description one character at a time.
    Thanks for your help!

    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" version="1.0">
    <xsl:template name="add-X">
    <xsl:param name="string" select="." />
    <xsl:if test="$string">
    <xsl:text>X</xsl:text>
    <xsl:value-of select="substring($string, 1,1)"/>
    <xsl:call-template name="add-X">
    <xsl:with-param name="string"
    select="substring($string, 2)" />
    </xsl:call-template>
    </xsl:if>
    </xsl:template>
    </xsl:stylesheet>
    Create an file named TEST.xsl with the above code.
    <aaaa>ABCDE</aaaa>
    Create an file named TEST.XML with the above code.
    Create an RTF template with form field valus as
    <?import: file:///C:\Desktop\Sample RTF\TEST.xsl?>
    Note : here you have to point the xsl path where your TEST.xsl is located.
    Then create another form field with value
    <xsl:call-template name="add-X"> <xsl:value-of select="." /> </xsl:call-template>
    When you merge the xml and RTF , you will find the no of "X" equivalent to length of the string in <aaaa> tag in xml

  • Looping through an array to insert contents into an HTML table

    Im trying to loop through a String array and insert the contents into an html table, unfortunately my coding is only filling in the first row in the table and ignores any additional info. Im using webservices that is connecting to a table in the database.
    Info = ID + ";" + played + ";" + won + ";" + lost + ";" is the String im pulling into my client.
    <table border = "1">
    <tr>
    <td><b>ID</b></td>
    <td><b>played</b></td>
    <td><b>won</b></td>
    <td><b>lost</b></td>
    </tr>
    <%
    try {
         leglessclient.LegendServiceService service = new leglessclient.LegendServiceService();
         leglessclient.LegendService port = service.getLegendServicePort();
    String Info = port.displayLog();
    String[] log = Info.split(";");
    out.println("<tr>");
    for (int a = 0 ; a < log.length; a++) {
    for (int b = 0 ; b < 4; b++){
    out.println("<td>" + (log[a]) +"</td>");
    a++;
    out.println("<td>" + (log[a]) +"</td>");
    a++;
    out.println("<td>" + (log[a]) +"</td>");
    a++;
    out.println("<td>" + (log[a]) +"</td>");
    a++;
    b++;
    out.println("</tr>");
    out.println("</table>");
    } catch (Exception ex) {
         // TODO handle custom exceptions here
    %>
    Any help would be greatly appreciated
    thanks!

    firstly, if you have multiple rows.. you need to start each row with <tr> and end with a </tr>. You just have one in the beginning and end,which will obivously give data in one row.
    out.println("<tr>");
    for (int a = 0 ; a < log.length; a++) {
    for (int b = 0 ; b < 4; b++){
    out.println("<td>" + (log[a]) +"</td>");
    a++;
    out.println("<td>" + (log[a]) +"</td>");
    a++;
    out.println("<td>" + (log[a]) +"</td>");
    a++;
    out.println("<td>" + (log[a]) +"</td>");
    a++;
    b++;
    out.println("</tr>");

  • Looping through json object in a query string

    Hi
    I have a json object in my query string and would like to loop through it, do i convert it to an array, or a map, so that i can loop through it?
    I get the object from the url which looks like this:
    {"CREATEDBYNAME":"TEST_ADMIN","FIRSTNAME":"John","TYPEID":"1900000000"}
    I would then like to loop through it so that i can make a string that would look like:
    "CREATEDBYNAME" = "TEST_ADMIN" AND "FIRSTNAME" = "John" AND "TYPEID"="1900000000"
    I want to use a loop because there can be up to 15 options in the json object. and the if statement would just not do.
    Plz help.

    What you can do with that object, I can't tell you because I don't know what it can or can't do. What's its API? Where does it come from?

  • Upload XLS File, Loop through rows query a DB

    What I would like to do is enable the user to upload an excel
    spreadsheet with one column and many row of IP's. Then put the ips
    in a list or array and loop through the list and query a table to
    get the IPs that match the list.
    Any help would be greatly appreciated.

    We have some similar apps except that, instead of uploading a
    file, the users copy and paste the column into a text area. Then we
    do this:
    <!--- First, replace carraige returns (chr(13)) and line
    feeds (char(10)) with commas --->
    <cfset
    hscnumbers=Replace(form.hscnumbers,chr(13)&chr(10),",","ALL")>
    <!--- remove last comma, if commas exist (there may be
    only one hsc number) --->
    <cfif find(",", hscnumbers) gt 0 and right(hscnumbers, 1)
    is ",">
    <cfset hscnumbers = left(hscnumbers, len(hscnumbers) -
    1)>
    </cfif>
    And then we have a list to send to the db.

  • GeoRaster- loop through each cell and execute spatial query?

    Hi,
    So what I want to do is, to loop through each cell in a raster and get the ground x,y coordinates. Then based on the x,y value I want to execute a query on a vector layer.
    My question is, how do I find each cell coordinate? That I will then use with SDO_GEOR.getModelCoordinate to get the ground coordinates, query vector, etc...
    Thanks.

    I am not sure what you want to do. Why not just use the spatial extent of the GeoRaster object?
    Anyway, say sdo_geor.getULTCoordinate returns (r0, c0, b0), and sdo_geor.getSpatialDimSizes returns (rows, cols). The range of the cell coordinates (at the original image level) are:
    row: r0 -- r0+rows-1
    column: c0 -- c0+cols-1
    Regards,
    Terry

  • How to invoke PL/SQL Table parameter in the query string?

    Hello,
    I've met a problem invoking PL/SQL Table parameter in the query string, in OWS 3.0.
    What I'm going to do is, to invoke a stored procedure to generate a web page using PL/SQL Web Toolkit 2.0, like: "http://.../owa/test_proc".
    But there is a IN parameter for this procedure, and it's a PL/SQL Table variable. So I can't invoke the procedure sucessfully just using "http://.../owa/test_proc?v_plsql=i_plsql".
    Did someone have met this kind of problem or have the answer to it? Thanks so much for your help.

    When using procedures with pl/sql-tables as parameter they should be overloaded, e.g.:
    procedure my_procedure (my_var in varchar2)...
    and
    procedure my_procedure (my_var in owa_util.ident_arr)
    the procedure then can be called with:
    http://..../my_procedure?my_var=Scott, which invokes the version with the varchar2 parameter, or
    http://..../my_procedure?my_var=Scott&my_var=Miller......
    which invokes the version with the pl/sql-Table
    Another solution might be the use of flexible parameters, passing pairs of parameter_name, parameter_value to your procedure. Your procedure looks like:
    procedure my_procedure (name_array IN owa.vc_arr, value_array IN owa.vc_arr)..
    and is invoked (note the ! )
    http://..../!my_procedure?ename=Scott&sal=200&job=clerk.....
    looping through the pl/sql tables will retrieve values of ename, sal and job for name_array and Scott, 200 and clerk for value_array
    Hth
    null

  • How to loop through xmldom.getNextSibling?

    Hello,
    I have been working with an example that Steve provided me with that uses xpath to pull the value of a specific node from an xml doc. This works fine as long as there is only one node, I would like to use getNextSibling to loop through all the values that exist for that node in the document. I am pasting in the code I am working with. I know I need to use the getNextSibling but am unsure of where I should loop. I left some commented stuff in there to illustrate some of the directions that I wanted to go, I will be writing the results to a nested table. Any assistance greatly appreciated.
    Thanks,
    Travis
    PROCEDURE testit (dummy in varchar2 default null) IS
    -- dummy will be xml doc passed in when this goes live
    xml varchar2(32000) := '<?xml version="1.0"?>
    <Pip3A2PriceAndAvailabilityQuery>
    <ProductPriceAndAvailabilityQuery>
    <ProductPriceAndAvailability>
    <ProductLineItem>
    <ProductQuantity>0</ProductQuantity>
    <productUnit>
    <ProductPackageDescription>
    <ProductDescription>
    <GlobalProductIdentifier>A00012</GlobalProductIdentifier>
    </ProductDescription>
    </ProductPackageDescription>
    </productUnit>
    <requestedPrice>
    <FinancialAmount>
    <GlobalCurrencyCode>USD</GlobalCurrencyCode>
    </FinancialAmount>
    </requestedPrice>
    </ProductLineItem>
    <ProductLineItem>
    <ProductQuantity>0</ProductQuantity>
    <productUnit>
    <ProductPackageDescription>
    <ProductDescription>
    <GlobalProductIdentifier>A00018</GlobalProductIdentifier>
    </ProductDescription>
    </ProductPackageDescription>
    </productUnit>
    <requestedPrice>
    <FinancialAmount>
    <GlobalCurrencyCode>USD</GlobalCurrencyCode>
    </FinancialAmount>
    </requestedPrice>
    </ProductLineItem>
    </ProductPriceAndAvailability>
    </ProductPriceAndAvailabilityQuery>
    <fromRole>
    <PartnerRoleDescription>
    <GlobalPartnerRoleClassificationCode>Customer</GlobalPartnerRoleClassificationCode>
    <PartnerDescription>
    <GlobalPartnerClassificationCode>End User</GlobalPartnerClassificationCode>
    <BusinessDescription>
    <GlobalBusinessIdentifier>00031583</GlobalBusinessIdentifier>
    <GlobalSupplyChainCode>Information Technology</GlobalSupplyChainCode>
    </BusinessDescription>
    </PartnerDescription>
    </PartnerRoleDescription>
    </fromRole>
    <toRole>
    <PartnerRoleDescription>
    <GlobalPartnerRoleClassificationCode>Customer</GlobalPartnerRoleClassificationCode>
    <PartnerDescription>
    <GlobalPartnerClassificationCode>End User</GlobalPartnerClassificationCode>
    <BusinessDescription>
    <GlobalBusinessIdentifier/>
    <GlobalSupplyChainCode>Information Technology</GlobalSupplyChainCode>
    </BusinessDescription>
    </PartnerDescription>
    </PartnerRoleDescription>
    </toRole>
    <thisDocumentGenerationDateTime>
    <DateTimeStamp>20000229T140102.333Z</DateTimeStamp>
    </thisDocumentGenerationDateTime>
    <thisDocumentIdentifier>
    <ProprietaryDocumentIdentifier>Panda20000229T140102.333Z</ProprietaryDocumentIdentifier>
    </thisDocumentIdentifier>
    <GlobalDocumentFunctionCode>request</GlobalDocumentFunctionCode>
    </Pip3A2PriceAndAvailabilityQuery>
    v_counter number := 1;
    partno varchar2(25) := 'IM NOT NULL';
    quantity varchar2(10);
    custid varchar2(25);
    conpart varchar2(50);
    p xmlparser.parser;
    xd xmldom.DOMDocument;
    -- Variables for the pricing call
    in_caller_name varchar2(50) := 'xsourcer';
    in_commit_allow_flag varchar2(50) := NULL;
    in_customer_no number;
    in_part_no_arg varchar2(50);
    in_mfg_arg varchar2(50) := NULL;
    in_cat_arg varchar2(50) := NULL;
    in_sub_arg varchar2(50) := NULL;
    in_opt_arg varchar2(50) := NULL;
    out_price n umber;
    out_prior_var number;
    out_ret_val varchar2(50);
    out_success_code number;
    out_error_code number;
    out_error_message varchar2(500);
    v_partlist partlist;
    -- This function converts the GlobalProductIdentifier (Manufacturer Part Number)
    -- to an elcom part number by performing a query against the dfp_parts table
    -- I created a local table with a few manufacturer part no's and elcom part no's
    function valueOf(xd xmldom.DOMDocument, xpath VARCHAR2) return varchar2 is
    n xmldom.DOMNode;
    nl xmldom.DOMNodeList;
    e xmldom.DOMElement;
    begin
    -- Cast the document to a node
    n := xmldom.makenode(xd);
    -- Select Nodes Matching XPath Pattern
    nl := xslprocessor.selectNodes(n,xpath);
    IF xmldom.getLength(nl) > 0
    THEN
    e := xmldom.makeElement(xmldom.item(nl,0));
    xmldom.normalize(e);
    RETURN ltrim(rtrim(xmldom.getNodeValue(xmldom.getFirstChild(xmldom.item(nl,1)))));
    END IF;
    end;
    begin
    -- New Parser
    p := xmlparser.newparser;
    -- Parse the XML document
    xmlparser.parseBuffer(p,xml);
    -- Get the XML document that's been parsed
    xd := xmlparser.getdocument(p);
    custid := valueof(xd,'//GlobalBusinessIdentifier');
    insert into xrequest values (44, custid,null,sysdate);
    in_customer_no := to_number(custid);
    -- Calls to the xpath function to get the tags we want the value of
    /* FOR v_count IN 1..
    xd.length LOOP
    getNextSibling() RETURN DOMNode;
    WHILE (PARTNO IS NOT NULL) LOOP
    partno := valueof(xd,'//GlobalProductIdentifier');
    in_part_no_arg := partno;
    v_counter := v_counter + 1;
    -- call pricing here pass in custid, partno
    -- assign outprice_var to price of nested table
    corp_get_price_sp(in_caller_name, in_commit_allow_flag, in_customer_no,
    in_part_no_arg, in_mfg_arg, in_cat_arg, in_sub_arg,
    in_opt_arg, out_price, out_prior_var, out_ret_val,
    out_success_code, out_error_code, out_error_message);
    IF V_COUNTER = 100 THEN
    HTP.P('EXIT OUT');
    EXIT;
    END IF;
    --XREQUEST.PART_NO := PARTNO;
    --XREQUEST.PRICE := OUT_PRICE_VAR;
    htp.p(out_price);
    htp.br;
    -- insert into xrequest values (44, custid,(Partlist(PartObj(partno, out_price, null, null, null, null)))sysdate);
    END LOOP;
    quantity := valueof(xd,'//ProductQuantity');
    end;
    null

    You can first create a databank with the Input values and associated navigation. For eg. Navigation,csv will have
    Input, Navigation
    Hardware, window(index=0).link(text="Hardware" | href="http://..." | index=28)
    Monitors,
    Record the script by selecting from the dropdown box and then going to the resulting page. Attach the databank to the script and use the databank to select the Input value for the dropdown on the page. On the Resulting Page add code to the PageBeforePlay method -
    dim strNav as string
    'get the navigation value from the databank
    RSWApp.GetDataBankValue "Navigation", strNav
    rswapp.ChangeNavigation "", strNav, , , False
    The resulting page will then be the page that the navigation is changed to.
    You can loop through all the records in the databank to check the navigation for all of them.
    You will also have to look at how the value is set in the dropdown, as an Index or the actual value. If it is by Index, then in the databank file, change the Input to be the number of the selection like 1 or 2.
    Hope the above is what you are looking for.
    Question - The resulting page for each navigation will be different. How are you going to verfiy the different pages or continue on in the script?
    Message was edited by: mpalivela

  • Loop through Array structure - using xpath

    Hello,
    My BPEL process logic is as follows:
    a. Extract data into variable - receiveMessageInputVariable
    The variable 'receiveMessageInputVariable' in turn has data in array structure. (set of items)
    b. Transform the data to target structure
    c. Call target partner link to store extracted data into varaible 'ServiceInputVariable'
    The variable 'ServiceInputVariable' structure is similar to 'receiveMessageInputVariable'
    In the BPEL process 'at process' level - I have catch-all exception handler - which must send the list of 'items' which failed during a BPEL instance.
    i. If my email body has the following code as below:
    <%bpws:getVariableData('receiveMessageInputVariable','XXINV_ITEM_PAY_ROW_TYPE','/ns4:XXINV_ITEM_PAY_ROW_TYPE/ITEMLINE/ITEMLINE_ITEM/ITEM_NUMBER')%>
    It successfully fetches only the first item_number record of the array structure. But does not fetch the other records in the array.
    ii. Similarly, I wish to print all the items (as received) to be available in the email body in the following pattern:
    <%"Record One-"%>
    <%bpws:getVariableData('receiveMessageInputVariable','XXINV_ITEM_PAY_ROW_TYPE','/ns4:XXINV_ITEM_PAY_ROW_TYPE/ITEMLINE/ITEMLINE_ITEM[1]/ITEM_NUMBER')%>
    <%"<br/>"%>
    <%"Record Two-"%>
    <%bpws:getVariableData('receiveMessageInputVariable','XXINV_ITEM_PAY_ROW_TYPE','/ns4:XXINV_ITEM_PAY_ROW_TYPE/ITEMLINE/ITEMLINE_ITEM[2]/ITEM_NUMBER')%>
    <%"Record Nth-"%>
    <%bpws:getVariableData('receiveMessageInputVariable','XXINV_ITEM_PAY_ROW_TYPE','/ns4:XXINV_ITEM_PAY_ROW_TYPE/ITEMLINE/ITEMLINE_ITEM[N]/ITEM_NUMBER')%>
    Please suggest a suitable syntax in my email body - which can loop through all itemline_item array and print all the item_numbers.
    (pseudo code below)
    for i in 1 .. ora:countNodes(bpws:getVariableData('receiveMessageInputVariable','XXINV_ITEM_PAY_ROW_TYPE','/ns4:XXINV_ITEM_PAY_ROW_TYPE/ITEMLINE/ITEMLINE_ITEM/ITEM_NUMBER'))
    loop
    <%"Item Number-"%><%bpws:getVariableData('i')%>
    <%bpws:getVariableData('receiveMessageInputVariable','XXINV_ITEM_PAY_ROW_TYPE','/ns4:XXINV_ITEM_PAY_ROW_TYPE/ITEMLINE/ITEMLINE_ITEM/ITEM_NUMBER')%>
    end loop;
    Thanks,
    Santhosh

    Hi Santhosh
    Try with the following approach. It may work for you
    1. Create one XSD, for the HTML content
    <xsd:element name="HTML">
    <xsd:complexType>
    <xsd:sequence>
    <xsd:element name="C1" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy="${eol}">
    </xsd:element>
    </xsd:sequence>
    </xsd:complexType>
    </xsd:element>
    </xsd:schema>
    2. Create one XSL, may be you have to do this manually, as JDev will not support HTML transformations. This XSL will map your input XML to an HTML format.
    3. Create one variable in BPEL of type in the above XSD
    4. Use assign activity to assign the XSL transformation to the variable defined in Step#3
    <from expression="ora:processXSLT('HTMLTransformation.xsl',bpws:getVariableData('Variable_Input',INPUT_TYPE'))"/>
    <to variable="invokeWriteHTMLService_Input" part="HTML" query="/ns6:HTML/ns6:C1"/>
    5. Copy the variable to the email body variable
    <copy>
    <from expression="bpws:getVariableData('invokeWriteHTMLService_Input','HTML','/ns6:HTML/ns6:C1')"/>
    <to variable="varNotificationReq" part="EmailPayload"
    query="/EmailPayload/ns8:Content/ns8:ContentBody"/>
    </copy>
    Basically, the above approach converts your input to a string value whose content is a complete HTML, and you will use only one value to assign to the email body.
    Note: Please change the Variable names/XPATH Expressions/XSL file name/element names etc according to your BPEL
    Hope this helps you
    Regards
    Ayon

Maybe you are looking for

  • How to install IE8 on Windows Server 2008 R2 Datacenter?

    Hello. Can anybody tell me, how to install IE8 on 2008 R2 Datacenter? I've downloaded this http://www.microsoft.com/en-us/download/internet-explorer-8-details.aspx for "Windows Server 2008 64-bit and more..", removed IE11, IE10, IE9 from installed up

  • Facebook photo's

    Once I am sent a notification of a photo posted on facbook.  it says receiving photo comments but does not load the photo.  Can someone help with this??

  • Email notifications when an eQ is sent back to original sender not firing

    this is directly from a user "It's not a big deal, but I use to get an email notification when I had a new eQ Action Item ." Was this feature depricated in 6.1? or do we need to put an SR in? thanks, David

  • FM to get first date of the month

    hi, any FM to get first day of the month ,  lets say based on input 24.11.2008 , the FM would return 01.11.2008

  • Headset problem with hub phone

    I followed somebody's advice on here and purchased an adapter (3.5mm to 2.5mm) so that I could use my mobile headphones on my hub phone. Unfortunately it didn't work - I can hear the other person but they can't hear me. Can anybody suggest a cheapish