Looping through a list...

Hi all

In ColdFusion, we have what we call 'a loop on a list '. We do this by using the following syntax:

< CFLOOP INDEX = 'index_name' = 'list_items"DELIMITERS LIST ="item_delimiter">
< / CFLOOP >

MS SQL Server, basically in SQL, do we have something like that? I used the WHILE loop, for example,

While (SELECT somethingFROM Table) = 'something'
BEGIN
-Do something here
END

The question is: in SQL, how can browse through us a list of values, like for example '12, 35, 47, 102, 55, 87', and for each value in a loop, I want to do something?

I thank very you much in advance!



OK, see the attachment.

Race listing 2 times to install two UDF.

Then, you can use a query like listing 1.

Tags: ColdFusion

Similar Questions

  • Loop through the list in flex 4 conclusion d buttons

    Anyone know how to completely recursively loops through the list in flex 4 by pulling the bodies of buttons.  This way I can apply my effects for buttons on the screen at the same time?

    You just create a subclass of button that has the desired effect and use it throughout your application.

    Gordon Smith

    Adobe Flex SDK team

  • loop through the list in flex 4

    I want to loop through the list and apply the following code to each button, the checkbox and the descent down in my application

    mouseOver = "animateHover ('theComponentID').

    How is that possible?

    Hello

    This should do what you want, you must add the eventlistener now your animated can be run from the th event handler.

    protected function button1_clickHandler(event:MouseEvent):void

    {

    for (var i: Number = 0; i<>

    {

    var obj:Object = this.getElementAt (i);

    If (flash.utils.getQualifiedClassName (obj) is 'spark.components::Button')

    {

    (obj as Button) .addEventListener (MouseEvent.MOUSE_OVER, onMouseOver);

    }

    If (flash.utils.getQualifiedClassName (obj) is 'spark.components::CheckBox')

    {

    (obj as CheckBox) .addEventListener (MouseEvent.MOUSE_OVER, onMouseOver);

    }

    }

    }

    private void onMouseOver(event:MouseEvent):void

    {

    animateHover (event.currentTarget);

    }

  • Looping through a list to create a url string

    Hi all

    This should be easy for someone with a little experience, but for some reason I have problems with it.  I need to create a url string based on the results of the query.  The results of the query are essentially:

    agenda Prix
    125542.00
    238853.50
    125545.00
    885442.47

    I need to create a url like www.something.com/index.cfm string? item1 = 122554 & item1price = 2 & item2 = 23885 & item2price = 3.50 etc etc (I'm actually trying to create the channel and then add it to a url.)  The index must be included also, like item1, item2 but there will be a different result for each order number if that makes sense - this person bought 4 items but someone else could buy 2).

    Can someone give me a good way to do this?  I tried to loop through the query sort, but it does not work for me.  I also tried making a list but no dice.  It seems that it should be so simple.

    Thank you

    Red

    It seems that you overwrite rather than allow adding to your string variable.

    Take one resembles the quick example below.  Note that I have not tested this code.

    http://www.example.com/page.cfm? » >

  • Loop through the list, search for text

    If I'm a loop in a list and try to find the text that I am looking to make a selection, how could it achieve that?

    < cfif = text "TheTextI'mLookingFor > < / cfif >?"

    you would use the function find of FindNoCase.

    http://help.Adobe.com/en_US/ColdFusion/9.0/CFMLRef/WSc3ff6d0ea77859461172e0811cbec22c24-7E 7c.html

  • How to make a loop through a list to get all the SelectedItems?

    Here is my code, but the loop is to return all items (items selected and deselected no)

    lstMarks in my ListBox.
    var markslist:String;

    for (var i: int = 0; i < marks.length; i ++) {}
    markslist = & markslist = ', ' + lstMarks.selectedItem.mymarks;
    Text1. Text = markslist;
    }

    If anyone can help. I need to get only the selecteditems in the comma delimited by the string.

    THX

    The forum feeds Media table unless you put spaces around them. Try:
    marksList is marksList + selectedMarks [i] .mymarks;.

    Tracy

  • Step by step through a list of variables

    Hello

    How can step through a list of variables without a long list of "If"? Each var gets a string that consists of one or more paragraphs that are used to populate a text box. The var is selected in a hierarchical list box.

    Example:

    If (selectedValue == 1) {var TTHCov = dialogObject.TTHCov1;}

    } ElseIf (selectedValue == 2) {var TTHCov = dialogObject.TTHCov2;}

    } ElseIf (selectedValue == 3) {var TTHCov = dialogObject.TTHCov3;}

    } ElseIf (selectedValue == 4) {var TTHCov = dialogObject.TTHCov4;}

    } ElseIf (selectedValue == 5) {var TTHCov = dialogObject.TTHCov5;}

    } ElseIf (selectedValue == 6) {var TTHCov = dialogObject.TTHCov6;}

    } ElseIf (selectedValue == 7) {var TTHCov = dialogObject.TTHCov7;}

    } ElseIf (selectedValue == 8) {var TTHCov = dialogObject.TTHCov8;}

    } ElseIf (selectedValue == 9) {var TTHCov = dialogObject.TTHCov9;}

    } ElseIf (selectedValue == 10) {var TTHCov = dialogObject.TTHCov10;}

    } ElseIf (selectedValue == 11) {var TTHCov = dialogObject.TTHCov11;}

    } ElseIf (selectedValue == 12) {var TTHCov = dialogObject.TTHCov12;}

    } ElseIf (selectedValue == 13) {var TTHCov = dialogObject.TTHCov13;}

    } ElseIf (selectedValue == 14) {var TTHCov = dialogObject.TTHCov14;}

    } ElseIf (selectedValue == 15) {var TTHCov = dialogObject.TTHCov15;}

    } ElseIf (selectedValue == 16) {var TTHCov = dialogObject.TTHCov16;}

    } ElseIf (selectedValue == 17) {var TTHCov = dialogObject.TTHCov17;}

    } ElseIf (selectedValue == 18) {var TTHCov = dialogObject.TTHCov18;}

    } ElseIf (selectedValue == 19) {var TTHCov = dialogObject.TTHCov19;}

    } ElseIf (selectedValue == 20) {var TTHCov = dialogObject.TTHCov20;}

    } ElseIf (selectedValue == 21) {var TTHCov = dialogObject.TTHCov21;}

    } ElseIf (selectedValue == 22) {var TTHCov = dialogObject.TTHCov22;}

    } ElseIf (selectedValue == 23) {var TTHCov = dialogObject.TTHCov23;}

    } ElseIf (selectedValue == 24) {var TTHCov = dialogObject.TTHCov24;}

    } ElseIf (selectedValue == 25) {var TTHCov = dialogObject.TTHCov25;}

    } ElseIf (selectedValue == 26) {var TTHCov = dialogObject.TTHCov26;}

    } ElseIf (selectedValue == 27) {var TTHCov = dialogObject.TTHCov27;}

    } ElseIf (selectedValue == 28) {var TTHCov = dialogObject.TTHCov28;}

    } ElseIf (selectedValue == 29) {var TTHCov = dialogObject.TTHCov29;}

    } ElseIf (selectedValue == 30) {var TTHCov = dialogObject.TTHCov30;}

    } ElseIf (selectedValue == 31) {var TTHCov = dialogObject.TTHCov31;}

    } ElseIf (selectedValue == 32) {var TTHCov = dialogObject.TTHCov32;}

    } ElseIf (selectedValue == 33) {var TTHCov = dialogObject.TTHCov33;}

    } ElseIf (selectedValue == 34) {var TTHCov = dialogObject.TTHCov34;}

    } ElseIf (selectedValue == 35) {var TTHCov = dialogObject.TTHCov35;}

    } ElseIf (selectedValue == 36) {var TTHCov = dialogObject.TTHCov36;}

    } ElseIf (selectedValue == 37) {var TTHCov = dialogObject.TTHCov37;}

    } ElseIf (selectedValue == 38) {var TTHCov = dialogObject.TTHCov38;}

    } ElseIf (selectedValue == 39) {var TTHCov = dialogObject.TTHCov39;}

    } ElseIf (selectedValue == 40) {var TTHCov = dialogObject.TTHCov40;}

    }

    Hi there, your list values are stored in an object type, right?

    So, for example if you have your data listed as follows:

    var TTH = {"TTHCov1": "Value1"}

    "TTHCov2": "Value2",.

    ....}

    By using a loop with the declaration, you can browse the entire object

    for (var obj in TTH) {}

    If (selectedValue is {TTH [obj])}

    It's the value selected within the data object

    }

    }

    I hope this helps!

  • database loops through query?

    access to a field in a table inidcates that rows in 2 related tables and it must be in a query.

    all the 3 tables share a field: pgID. It is the primary key of the first table and a field in the other 2.

    the first query finds the lines linked by a variable: pgfeat

    < cfquery name = "gtpgsfeat" datasource = "mydb" >
    SELECT pgID
    Pages
    WHERE pgfeat = 1
    < / cfquery >

    I then loop through the query to create a list of all the rows that are returned by the query

    < cfoutput >
    < cfloop query = "gtpgsfeat" >
    < ISDefined ('catz') cfif >
    < cfset catz = "#catz #, #gtpgsfeat.pgID # ' >
    < cfelse >
    < cfset catz = ' #gtpgsfeat.pgID # ' >
    < / cfif >
    < / cfloop >
    < / cfoutput >

    I then apply to a query to the linked tables

    < cfquery name = "gtpgsfeat1" datasource = "mydb" dbtype = "ODBC" >
    SELECT pages.*, pg_cont.*, pg_text.*
    PAGES, pg_cont, pg_text
    WHERE (pages.pgID IN (#catz #)) AND (pg_cont.pgID (#catz #)) AND (pg_text.pgID (#catz #));
    < / cfquery >

    the problem. the second query loops itself - times the recordcount of first request - and I get the same time data the recordcount of the first query.

    with a recordcount of 3 for the first query, I get a recordcout of 27 (3 X 3 X 3) for the second query...

    example:

    Abe

    Cathy

    John

    Abe

    Cathy

    John

    Abe

    Cathy

    John

    ? what I'm missing here

    TNX in advance

    Ranger says:

    ? what I'm missing here

    A basic understanding of programming to relational database better than I can tell from your post.  I heard good things about the "Teach yourself SQL in 10 minutes" book by Ben Forta and "Database Design for mere mortals" by Michael Hernandez.  They show you basic JOIN syntax as in this example where you combine all the tables in one record without multiplying all the lines as the code you attempts where made.

    
         SELECT
              pages.*,
              pg_cont.*,
              pg_text.*
         FROM
              pages INNER JOIN
              pg_cont ON (pages.pgID = pg_contID) INNER JOIN
              pg_text ON (pages.pgID = pg_test.pgID)
         WHERE
              pgfeat = 1
    
    

    P.S. using the * shortcut in your clause SELECT can cause hard to debug problems if your database table designs are never changed.

  • How to loop through DataGrid (ArrayCollection, DataProvider collection)

    I need to loop through a collection ArrayCollection DataProvider or DataGrid (not sure which is best) so that I can insert information in a database through ColdFusion.

    The data grid has three columns: ID, item and quantity.  I have a table that contains these same fields.  The DataGrid control is pre-filled with a list of items.  The user can then enter the quantity of items in the DataGrid.  I then want to store this information in my table.  In ColdFusion, I would accomplish this through CFLOOP, however, in Flex I want to loop through the data grid so that I can get all the items and the quantities that the user has updated.

    I guess I have to do a loop in ActionScript, but I don't know how to do that.  Can anyone provide a suggestion and example code?

    Thanks again!

    Lee

    If this post answers your question or assistance, please mark it as such.

    Here ya go:



    http://www.Adobe.com/2006/mxml '.
    creationComplete = "init (); » >
     
        Import mx.collections.ArrayCollection;
         
    public void init (): void {}
    var ac:ArrayCollection = new ArrayCollection([)
    {Field1: "my one - item a field", Field2: "my field two - point one"},
    {Field1: "my field one - point two", Field2: "my field two - point two"},
    {Field1: "my one - three field element", Field2: "my field two - point three"},
    ]);
    for each {(var point: Object en ac)}
    for each {(var: objet field àle point)}
    trace (Field);
    }
    }
    }
    ]]>
     

  • How to loop through the CSV file

    Hello

    I want to loop through each column in a CSV file.
    And while the closure of each column, I want to loop every line starting with line 2 St.

    I wrote the code below, but it's a loop in the lines from rank 1.
    How can I start the loop from the 2nd row in the CSV file?
    (see code below)

    Can someone tell me how to proceed?

    THX




    <!-Download and read the file CSV - TXT->
    < cffile action = "read" variable = "C:\Documents and Settings\user\Desktop\EM-CSV\test.csv" file = "csvfile" >

    <!-browse the CSV - TXT file on line breaks and insert into the database->
    < table border = "1" >


    < cfloop index = list 'index' = "' #csvfile # ' delimiters =" #chr (10) ##chr (13) #">"

    <!-< cfoutput > #listgetAt('#index#',1, ',') # < / cfoutput > < br >->
    < b >
    < td > < cfoutput #index # > < / cfoutput > < table >
    < td > < cfoutput > #listgetAt('#index#',2, ',') # < / cfoutput > < table >
    < td > < cfoutput > #listgetAt('#index#',3, ',') # < / cfoutput > < table >
    < /tr >

    < / cfloop >
    < /table >

    Hi Like2Flex,

    The problem is that coldfusion does not see

    list = "a, b, c, d.

    as a list of 9 things you expect. He just sees 4 elements a, b, c and d because Coldfusion does not include two delimiters next to each other.

    A solution to the problem is to manually insert a space between two delimiters that are side by side. Here is an example of such a solution




    length of the list: #listlen (list) #

  • To loop through the structure of table - using xpath

    Hello

    My logic to BPEL process is as follows:
    a. extract the data in the variable - receiveMessageInputVariable
    The variable 'receiveMessageInputVariable' has in turn of the data in the table structure. (a set of elements)
    b. to transform the data to the target structure
    c. call the target of the link partner to store data in variable 'ServiceInputVariable '.
    The variable "ServiceInputVariable" structure is similar to "receiveMessageInputVariable".

    In the BPEL process "in the process of" level - I have catch-all exception handler - which must send the list of "elements" that failed in a BPEL proceeding.

    i. If my body of the email 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 recovers only the first record in the table item_number structure successfully. But don't get the other records in the table.

    II. Similarly, I want to print all the elements (such as received) to be available in the body of the email in the following model:

    < % ' Save a "% >
    < % bpws:getVariableData('receiveMessageInputVariable','XXINV_ITEM_PAY_ROW_TYPE','/ns4:XXINV_ITEM_PAY_ROW_TYPE/ITEMLINE/ITEMLINE_ITEM[1]/ITEM_NUMBER') % >
    < % ' < br / > "% >".
    < % 'Save two -' % >
    < % bpws:getVariableData('receiveMessageInputVariable','XXINV_ITEM_PAY_ROW_TYPE','/ns4:XXINV_ITEM_PAY_ROW_TYPE/ITEMLINE/ITEMLINE_ITEM[2]/ITEM_NUMBER') % >
    ....
    ..
    < % "Nth record" - % >
    < % bpws:getVariableData('receiveMessageInputVariable','XXINV_ITEM_PAY_ROW_TYPE','/ns4:XXINV_ITEM_PAY_ROW_TYPE/ITEMLINE/ITEMLINE_ITEM[N]/ITEM_NUMBER') % >

    Please suggest a syntax suitable in my body of the email - which can loop through all the itemline_item table and print all item_numbers.
    (pseudocode below)

    because me in 1... ORA: countNodes (bpws:getVariableData('receiveMessageInputVariable','XXINV_ITEM_PAY_ROW_TYPE','/ns4:XXINV_ITEM_PAY_ROW_TYPE/ITEMLINE/ITEMLINE_ITEM/ITEM_NUMBER'))
    loop
    < % ' article number-"% > < % bpws:getVariableData('i') % >".
    < % APO: getVariableData ('receiveMessageInputVariable', 'XXINV_ITEM_PAY_ROW_TYPE','/ ns4:XXINV_ITEM_PAY_ROW_TYPE/ITEMLINE/ITEMLINE_ITEM/ITEM_NUMBER')% >)
    end loop;


    Thank you
    Shakur

    Hi Shema

    Try the following approach. It can work for you

    1. create an XSD for HTML content








    2. create a XSL, can be that you must do manually, as JDev will not support transformations to HTML. This XSL will map your input XML to HTML file.
    3. create a variable in BPEL type in the XSD above
    4. use assign activity to assign the XSL transformation to the variable set to step #3


    5 copy the variable in the variable of email body



    Query = "" / EmailPayload/ns8: Content / ns8:ContentBody "/ >"

    Basically, the approach described above converts your entry to a value of string whose content is a complete HTML, and you'll use only one value to be assigned to the body of the email.

    Note: Please change the names of Variable/XPATH Expressions / / the name element from the XSL names etc. According to your BPEL file

    Hope this helps you

    Concerning
    LOC.

  • Error in the loop on the list

    Looping on a series of lists created from form fields generates an error in one of the fields on the form was left blank. The form is a list of the dates of the event start and end times. An event can have a number of times.

    When the end time is uncertain, we leave the field blank. However, this therefore reduces the list created from #form.endtime # for lists do not match and there is an error message:

    "Invalid list index 2.
    In the function ListGetAt (list, index [, delimiters]), the index value, 2, is not valid as the first argument (this list has 1 elements). Valid indexes are in the range 1 through the number of elements in the list. »

    How do you get around this problem? TX.

    yoman,

    No need for separate forms. Use a meter to number each group of domain names



    Then loop through the fields in form on your action page




    ... other fields


    UPDATE EventDates
    EventDate SET = "#EventDate #",...

    WHERE EventDateID = #EventDateID #.

    You must validate the values or use cfqueryparam

  • Loops through Excel spreadsheets

    Hello

    I tried to loop through spreadsheets and Excel doc by increasing the grip of the worksheet. But unfortunately, that doesn't seem to be possible and I got an error.

       ExcelRpt_SetWorksheetAttribute(rawDataWorkSheetHandle,ER_WS_ATTR_NAME,"Analysis Data");
        __caErrChk(ExcelRpt_SetWorksheetAttribute(rawDataWorkSheetHandle+1,ER_WS_ATTR_NAME,"something"));
    

    Is it somehow possible to do? I do not have a handle for each worksheet in my workbook of haven...

    Thank you!

    Hello

    Like it or not, you need to obtain the handle of the worksheet if you want to access the attributes of worksheet.
    There is a function called ExcelRpt_GetWorksheetFromIndex to do this.

    This function returns the handle of the worksheet if you provide the 1-based index.
    Take care you need to call CA_DiscardObjHandle after you are finished with this worksheet.

    So the two functions above should be inside your loop.

  • To loop through a range of data

    Hi guys

    I have this set of numbers. 54 55 56 58 59 61 64 66. I want to loop through this set of numbers to give an array of result of 54 55 56 0 58 59 0 61 0 0 64 0 66.

    Simply, I'm trying to insert a zero in the interval + 1 white in this series of numbers. I couldn't find out how.

    Please help me thanks

    See you soon

    PX

    Hi pengxin,.

    See the image as an attachment.

    Mike

  • The desktop icons are not open with a double or click context - programs can still start through the list of programs.

    Original title : Double click on icon it does not open and when I right click it Office of the menu drop-down does not appear.

    Programs can always be started through the list of programs.

    Hello

    ·         Were there recent changes made on the computer before the show?

    ·         You are able to add a shortcut on the desktop?

    I suggest you run this Microsoft Fixit tool and check if it helps.

    Difficulty of broken desktop shortcuts and common system maintenance tasks

    http://support.Microsoft.com/mats/system_maintenance_for_windows/en-us

Maybe you are looking for