Get the index of each item in a liquid for loop

If I'm looping through a collection with a for statement, is there a way to output the index value of each item as well.
Similar to how we have {tag_counter} in regular BC webapps, but I'd like to get the index value of any collection data.
for example:
{% for item in myCollection %}
    1. {{item.name}}
{% endfor %}
But I want the "1." to be the actual index of the item in the object/array.
In the docs there is a filter called 'size' which may do the job but I don't know how to use it as there is no example shown.

Thanks for pointing me in the right direction Liam.
As I noted in the question, I am using the docs, but these docs can be a little overwhelming when first exploring them (which I am).
There are many sections where things could be in and often I'm not entirely sure what I need to look under... case in point - I would not have thought rendering the index value would be under 'Logic Tags'.
Additionally, the docs have broken links, pages fail to load and they are littered with typos and missing info.
Don't get me wrong, I'm very grateful of the docs and they are a great resource, but please don't assume everything is easy if it's documented. Some of us are still learning and are not as familiar with the docs as yourself. I spent a lot of time searching the docs and trying to crack this myself before posting here.

Similar Messages

  • Get the index of a specific item in a Datagrid

    Is their an easy way to get the index of specific item in a datagrid.  So say my DG holds ten items of type foo.  I need to find the index of foo #8. Remember the foo's may not be in orde 1-8 because of sorting or something. 
    Do I just need to run iterate through the rows and find, which matches the object I am looking for?

    Thats it thanks. DG is getting refreshed so old objects don't match up to new objects so have to do it manually.
    Thx.

  • Getting the index of an unbounded item

    Hi there,
    How can i get the index of an unbounded item in an incoming record set message?
    For example, suppose my message looks like this:
    <Root>
    <Record>item_1</Record>
    <Record>item_2</Record>
    <Record>Item_X</Record>
    </Root>
    And i want to know the index of "Item_X" while mapping
    Thanks,
    Yigal.

    Just create a UDF of type queue. The input of UDF is the node you want to access (in your example, Record).
    In the code, use somehing like:
    for (int i=0; i< a.length; i++) {
      <insert logic here>
    And inside the for loop, you can implement the desired logic, and the variable i will have the index of your node (actually it will have index - 1, since its from 0 until a.length-1 ).
    Regards,
    Henrique.

  • Why can't i add playlists to my iPhone from my mac while they are connected? I keep getting the following message "some items (meaning all of them) were not transferred because iTunes match is enabled." This is incredibly frustrating.

    I keep getting the following message "some items (meaning all of them) were not transferred because iTunes match is enabled." when I try to drag and drop a playlist, song, or album to my iPhone. This was NEVER a problem before iTunes match or the last iOS update. So what is the deal? Why can't i just add music to my phone from the mac? There is space on the phone. The only way I have found to get the music i want to the phone is to have it download from the phone. This is not something i want to have to do: go through and manually add every album and recreate a playlist on the phone when its there on the mac. And, even more irritating, since the new update, when the phone is plugged into the mac i can't actually view from the mac what music is on the phone. This is incredibly frustrating and any help would be much appreciated in managing my music libraries for each device.

    Hi,
    You cannot manually manage music with match turned on on your iOS device. If you want to manage music manually, you will need to turn off match on your iPhone.
    Jim

  • Get the index of the current line in use

    Dear All,
    Well how can i get the index of the current line in use?
    this the code I am using :
    Dim i As Integer
    Set oBatchForm = SBO_Application.Forms.GetForm(Form_Id, 1)
    Set oMainMatrix = oBatchForm.Items.Item(Matrix_Id).Specific
    For i = 1 To oMainMatrix.VisualRowCount
        If oMainMatrix.IsRowSelected(i) = True Then
           GB_SelRow = i
            Exit For
        End If
    Next
    Exit Sub
    This code is not working when there is a line in the document type texte.
    please advice.

    Hi Mary,
    this is code in C#.NET which is working fine, try to do same in your code:
    for(int irow=1; irow<=oMatrix.RowCount; irow++)
         if(oMatrix.IsRowSelected(irow))
         SelectRow = irow;
                    break;
    Hope it helps.

  • How to get the index of the minimize point

    Need to get the index of the minimize point, marked as red cycle in the attached word file.
    It is a collected data from different sample devices, so the curve may change a bit each time. But the overall profile is the same, just 2 main peaks.
    I tried to detect the Y difference to see when the difference values change from negative to positive.
    But, there are noise as tiny peak when zoom in, shown in word file. Then tried to use median filter to make it smooth. (Maybe better method should be used.)
    But there are still some bigger regional peak. Any suggestion?
    Is there any labview function or better algorithm can make it. Many thanks for your help.
    Solved!
    Go to Solution.
    Attachments:
    Curve shots(zoom in).doc ‏294 KB
    Sample Data 1.vi ‏22 KB
    Sample Data 2.vi ‏16 KB

    A trick I often use is to sample the data with a much higher speed than needed. Then I apply some simple averaging methods or and median filter. After that I downsample the signal to a adequate rate by averaging x samples. This have been a saver for me more than once. How successful it is depends of noise character type. It just a hint as it may not be applicable in your application 
    Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
    (Sorry no Labview "brag list" so far)

  • Can you calculate multiple text boxes to achieve a total value?  If so how is that done?  I am trying to create a order form where multiple items can be purchased but i would like the values of each item to calculate so I can achieve a total value.

    Can you calculate multiple text boxes to achieve a total value?  If so how is that done?  I am trying to create a order form where multiple items can be purchased but i would like the values of each item to calculate so I can achieve a total value.

    Hi sashby51,
    I've moved your discussion to the PDF Forms forum--the folks who visit this forum regularly should be able to point you in the right direction.
    Best,
    Sara

  • Firefox.exe has encountered a problem and needs to close. We are sorry for the inconvenience. I have been using firefox for years. I installed the latest version of Firefox. It worked fine for several days. Now I get the above message each time I try to s

    firefox.exe has encountered a problem and needs to close. We are sorry for the inconvenience.
    I have been using firefox for years. I installed the latest version of Firefox. It worked fine for several days. Now I get the above message each time I try to start Firefox, even in safe mode. i have checked with latest antivirus softwere also.. i didn't find any thing suspicious.
    == This happened ==
    Every time Firefox opened
    == after loading firefox 3.6.6 ==
    == User Agent ==
    Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/533.4 (KHTML, like Gecko) Chrome/5.0.375.99 Safari/533.4

    I was having this problem few days ago,and I have fixed.Try this steps-If you have AVG antivirus so go on firefox>Tools>Add On and Disable AVG safe search and AVG tool bars too.Then restart computer.

  • How to get the index of a row in dynamically generated list

    Hi,
    I am displaying a list which contains 6 rows using <logic:iterator/>
    If i am changing a text value which is in 3 row, I want to pass that row index to the javascript function.
    I am using IndexId attribute of <logic:iterator> to get the index of a row,but
    It is working fine for Hyperlink buttons, but it is no working for text boxes.
    can any one plz help me..
    Thanks,
    madhu

    madhu,
    Please post your code... It's a bit like asking a mechanic to fix your car blind folded.

  • How to get the index of the word at current cursor position in the word?

    Dear All
    I am implementing a spell checker of my native language in Word. Whenever I run spell checker it start from the first word. How can I make it to start from the current cursor position? How can I get the index of the word at the current cursor position?
    Thanks in advance.
    Dharam Veer Sharma

    hi Dharam Veer Sharma,
    Thanks for sharing the solultion with us.
    It is helpful for others who have the same issue. And if you have any Office developing issue, please feel free to open a new thread.
    Have a nice day.
    Regards & Fei
    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.

  • How to get the index of selected values in SelectManyChoice...

    How to get the index of selected values in SelectManyChoice... the value which i get is coming when i submit the value second time

    By using the given code i get the value of the selected indices, but problem here is i get the value when it get submits at the second time... First time the length of that int array is 0.
    Second time it shows the value two times (i.e) First time submitted value and the second time submitted value. After that it works fine.. I have problem while clicking first time only..
    The Following error also raises.. One multiselect is dependent on other multiselect.
    DF_FACES-60098:Faces lifecycle receives unhandled exceptions in phase PROCESS_VALIDATIONS 3
    java.lang.ArrayIndexOutOfBoundsException: 6
         at oracle.adfinternal.view.faces.model.binding.FacesCtrlListBinding.findObjectFromIndex(FacesCtrlListBinding.java:334)
         at oracle.adfinternal.view.faces.model.binding.FacesCtrlListBinding.getInputValue(FacesCtrlListBinding.java:199)
         at oracle.jbo.uicli.binding.JUCtrlValueBinding.internalGet(JUCtrlValueBinding.java:2416)
         at oracle.jbo.uicli.binding.JUCtrlListBinding.internalGet(JUCtrlListBinding.java:3717)
         at oracle.adfinternal.view.faces.model.binding.FacesCtrlListBinding.internalGet(FacesCtrlListBinding.java:500)
         at oracle.adf.model.binding.DCControlBinding.get(DCControlBinding.java:749)
         at javax.el.MapELResolver.getValue(MapELResolver.java:164)
         at com.sun.faces.el.DemuxCompositeELResolver._getValue(DemuxCompositeELResolver.java:176)
         at com.sun.faces.el.DemuxCompositeELResolver.getValue(DemuxCompositeELResolver.java:203)
         at com.sun.el.parser.AstValue.getValue(Unknown Source)
         at com.sun.el.ValueExpressionImpl.getValue(Unknown Source)

  • How to get the index of subform in dynamic Forms??

    We are creating a Dynamic Form in which there is a field "PAN number" in a block. With the Script, we are replicating the blocks. Suppose there are 10 blocks (hence 10 PAN number fields will be there) and if the user wants to enter the PAN number in any of the blocks, how can we get the index of the block on which a value has been entered?

    Are you sure you are using JTree? (I couldn't find a method named getIndex at all!)
    As I couldn't quite understand what you are getting at, one thing that would be helpful is if you refer to "How to use Trees" in The Java Tutorial:
    http://java.sun.com/docs/books/tutorial/uiswing/components/tree.html

  • How to get the index of a h:column element?

    Hi!
    I'd like to know how to get the index of a <h:column> element.
    Here is the code of what I'm trying to do:
    <h:column>
         <a:commandLink
              value="#{familyAction.familyDocsByPrj}"
              action="#{homeAction.search(ROW_INDEX)}"
              reRender="rightAppPanel" />
    </h:column>When clicking a row, I'd like to make a "search" depending on the selected row.
    Does anybode know how to do that?
    Thanks a lot :)

    Thanks a lot for all your answers! :)
    I finally got to do something with my little knowledge =P
    I created a new class containing all the data needed for the dataTable (including a "String id").
    And that's what I get:
    <h:column>
         <a:commandLink
              value="#{familyAction.familyDocsByPrj.name}"
              action="#{homeAction.search(familyAction.familydocsByPrj.id)}"
              reRender="rightAppPanel" />
    </h:column>

  • Getting the index of a pixel in an indexed image

    Hi,
    Is it possible to get the index of a pixel in an indexed image? I mean, indexed images (GIF, indexed PNG) are like:
    INDEX R G B
    0 234 22 143
    1 9 123 213
    2 56 43 10
    etc.
    I'm wondering if it exists a GET method to retrieve this INDEX, as getRGB() retrieves the sRGB value of a pixel.
    Thanks in advance.

    Raster.getSample:
    import java.awt.image.*;
    import java.io.*;
    import java.net.*;
    import javax.imageio.*;
    public class IndexColorModelTest {
        public static void main(String[] args) throws IOException {
            URL url = new URL("http://forum.java.sun.com/images/reply.gif");
            BufferedImage bi = ImageIO.read(url);
            ColorModel cm = bi.getColorModel();
            if (!(cm instanceof IndexColorModel))
                throw new IOException("ColorModel is " + cm.getClass());
            WritableRaster r = bi.getRaster();
            for(int y=0, uby=r.getHeight(); y<uby; ++y) {
                for(int x=0, ubx=r.getWidth(); x<ubx; ++x) {
                    int sample = r.getSample(x, y, 0); //<<--------<<
                    //if (sample < 100)
                    //    System.out.print(" ");
                    if (sample < 10)
                        System.out.print(" ");
                    System.out.print(sample);
                System.out.println();
    }

  • HT1386 We have more than one computer at home. How do we get the songs from each computer onto one I-Pod?

    We have more than one computer at home. How do we get the songs from each computer onto one I-Pod?

    Copy the songs to a computer that is running iTunes, add those new tracks to the current library, and then synch those tracts to the iPod.
    You might take a look at iTunes Help....

Maybe you are looking for

  • Help Help Mac not working

    Ok so recently i updated my mac from mountain lion 10.8 to 10.8.2 and then i installed windows 7 exceptthe windows 7 install failed and gives the the messaging saying that an unexpected error took olace during the process and then it restarts and giv

  • Click twice on the menu bar to access dropdown menus?

    I recently upgraded to CS5 and have noticed that in order to access the menu items I have to click twice on "File", "Edit", etc to see the drop-down menus.Once I am in the menu bar area I have to continue to click once on each menu heading to see the

  • F110 payment run - split on invoice line item that exceed certain amount

    Dear expert, Now i want to ask is there any ways to configure F110 - payment run to auto checking on whenever the amount of one fi document is more than USD100,000 will auto split to second payment item. *i have already tick individual pmnt on tcode

  • Typographical error found in Event Viewer log for Event 8003. The source is "bowser" not browser.

    I found a typographical error in the Event Viewer log. Error 5/19/2014 1:07:52 AM bowser 8003 None The body of the message is typical of the NetBIOS messages regarding master browser network control... The master browser has received a server announc

  • Mouse Drag Issues.

    I've been having problems with using my mouse to "click and drag". I'm pretty sure that is is not a hardware issue. It happens in multiple apps and general OS navigation. For example I will attempt to click and drag a folder into another. I wont be a