urgent help required#<NoMethodError:

  • Thread starter Atul Dongargaonkar
  • Start date
A

Atul Dongargaonkar

prompts5 = ["Span type"]
defaults5 = ["1. Simply supported"]
@t_slab = ["1. Simply supported |2. Interior span |3. End span |4.
Cantilever"]
list5 = [@t_slab]
title5="Please select the type of the span"
@input_tslab = inputbox prompts5, defaults5, list5,title5

kay_array = [1.0, 1.5, 1.3, 0.4]
@ka = kay_array[(@input_tslab).to_i-1]


If "3. End span" is selected by in the UI, following error is
displayed..

Error: #<NoMethodError: undefined method `to_i' for ["3. End span
"]:Array>
 
J

Jesús Gabriel y Galán

prompts5 = ["Span type"]
defaults5 = ["1. Simply supported"]
@t_slab = ["1. Simply supported |2. Interior span |3. End span |4.
Cantilever"]
list5 = [@t_slab]
title5="Please select the type of the span"
@input_tslab = inputbox prompts5, defaults5, list5,title5

kay_array = [1.0, 1.5, 1.3, 0.4]
@ka = kay_array[(@input_tslab).to_i-1]


If "3. End span" is selected by in the UI, following error is
displayed..

Error: #<NoMethodError: undefined method `to_i' for ["3. End span
"]:Array>

Without knowing what inputbox does, it seems from the error message
that it's returning an Array. If you are sure that what you are after
is in the first position of the array, you could do:

@ka = kay_array[@input_tslab.first.to_i-1]

Jesus.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,773
Messages
2,569,594
Members
45,125
Latest member
VinayKumar Nevatia_
Top