Listview sometimes can't access {{i}}

  • Goal: I want to use {{i}} within a listview to return a description and reference data stored in various sources.

  • Steps: I've been able to debug that {{i}} does render properly when I'm not using a transformer in a listview. However, when I want to use the value i to transform into a specific value (see the screenshot red box), it doesn't work. When I just reference i directly, it works (blue box).

  • Details: Here's a snippet of my transformer (edit: transformer not in the Retool term, but referring to the code snippet below I have within my component):

{{tempWasteRows.value.slice(i * 10, (i === 0 ? (i * 10) + 4 : (i * 10) + 10)).map((row, index) => `9B${index + 1}: ` + [
        (row.erg ? "ERG#: " + row.erg : ""),
        (row.codes?.slice(6, row.codes?.length).length > 0 ? `${row.codes?.slice(6, row.codes?.length).join(", ")}` : ""),
        (row.profile_num?.length > 0 ? `${row.profile_num}` : ""),
        (row.container_size?.length > 0 ? `${row.container_size}` : ""),
        (row.additional_info?.length > 0 ? `${row.additional_info}` : ""),
        (row.th ? "TOTAL HALOGEN:" : "")
    ].filter(Boolean).join(", ").toUpperCase()).join("\n") }}

Why is this not working and how can I use i (in the screenshot example above, it should be the value 1) in my transformer?

{{i}} is only passed in the scope of the components. Transformers are outside of the component. You will have to pass the value you want someother way. Perhaps with "additional scope" to your query that has the transformer

Hey thanks for the response. I have the transformer in the value of the component (which is a text component in this example above, you can see on the right side of the screenshot). I haven't had issues previously with it, so I'm wondering if there's something unique about the component or use in this transformer. You can see in the first listview element that everything works just fine, but for "Page 2", it's not rendering.

Resolved! It was an issue with how I wrote the transformer.