ycv005
How to look out for particular value in the For loop of the Phoenix HTML.
Like I only want to fetch out the 2nd candidate_pipeline from the @candidate_pipelines. How to do that? Your response will be highly appreciable. Note- Inside my for loop, the variable are depended on candidate_pipeline.
<%= for candidate_pipeline <- @candidate_pipelines do %>
<%= form_for get_candidate_update_changeset(candidate_pipeline), "#", [class: "d-inline", phx_change: "update_candidate_stage"], fn f -> %>
<input type="hidden" value="<%= candidate_pipeline.id %>" name="candidate_id"/>
<%= select f, :job_stage_id, Enum.map(@job_stages, &{&1.name, &1.id}), [class: "custom-select custom-select-sm"] %>
<% end %>
<% end %>
Trending in Questions
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
Hello,
I know there is an approach for handling lists that allows for optimized traversal, but I can’t recall the specific method (somet...
New
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
Documentation
While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
So my question is quite simple and i have found no conclusive answer on forum, google or AI.
Should we use :erlang.float for Integer to ...
New
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
If a change or preparation module uses Ash.Changeset.get_argument/2 or Ash.Query.get_argument/2 (or any of the other get_argument functio...
New
Other Trending Topics
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
Hi there! We created Gust: A task orchestrator inspired by Airflow.
For those who have never heard about Aiflow, it’s a Python-based wor...
New
Hi everyone!
The first release candidate for the Expert language server project is now available!
We’ve published a press release detai...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixirconf-us
- #ai
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #hex
- #security











Showing Posts 1 to 10- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
LostKobrakai
Look for the part about “filters”.
ycv005
Can you give me example to how to fetch out nth index value from the For Loop?
LostKobrakai
You can’t but you can use
Enum.with_indexto add indexes to your list of items.ycv005
I have used the
Enum.atbut the problem is that I can’t then use the attribute of the candidate_pipe. For example, then I can’t use the candidate_pipeline.id. Could you solve the above part either by anyway? Note- I have the index value.Or there is something like this-
<%= candidate_pipeline = @candidate_pipelines[index] %>. So that values which will be stores into the variable and further I can access attribute values like candidate_pipeline.id.kokolegorille
It is not the functional way to proceed.
There are no loops, and using index to get Enum.at is not really efficient.
Something like taking each 2 elements should be done with filter.
What do You really want to do?
ycv005
I want to fetch out the particular element present at a index value from @candidate_pipelines to a variable. With the help of this variable I can access value like variable.attribute. Mainly, I want to access all parameter that are available at the particular index value of the @candidate_pipelines.
kokolegorille
When You use for, each element of @candidate_pipelines is going to be treated. You don’t need to lookup with an index, because it should be the current element.
Or did I miss something?
ycv005
That’s what I have done- iterating over the enumerable but I want only 1 at a time that is present at a index, don’t want to iterate over list/enumerable.
kokolegorille
You already get one element at a time with this.
ycv005
Yes, You are right but the problem is that I don’t want other values. It is wastage of time, resource and unwanted value are getting as output. For example- I want only 2nd element but it is iterating over the whole due to which extra data from other index are geeting as output which I don’t want.