Please use our GitHub Issues page for all new support inquiries. If you need to contact us directly, please e-mail [email protected]

I am trying to export data from a spreadsheet using the script from the "Export" file called Print-TrialDurations.rb. The names of the columns in my spreadsheet are id, trial, section, and looks. What I really want is the duration of each "look" but I need to know what trial and section those looks were in. I'm getting the following error:


NoMethodError: undefined method `trial' for #<rcell:0x1480569> method_missing at org/jruby/ method_missing at file:/C:/Users/Emma/AppData/Local/datavyu/app/datavyu-1.3.6-jfx.jar!/Datavyu_API.rb:278 (root) at <script>:28 each at org/jruby/ (root) at <script>:27 each at org/jruby/ (root) at <script>:20

See line 20 of C:\Users\Emma\Desktop\export_times.rb: infiles.each do |infile| See line 27 of C:\Users\Emma\Desktop\export_times.rb: trial_cells.each do |tc| See line 28 of C:\Users\Emma\Desktop\export_times.rb: row = [tc.ordinal, tc.duration, tc.trial, tc.section, tc.look] # get values for row of data

I'm using Windows 10, Datavyu 1.3.6.

asked 30 Apr '17, 00:15

EmmaKS's gravatar image

accept rate: 0%


To simplify the error message, the script is failing to find a code called "trial" in your trial_cells. Is this a code in your trial column?

Since you mentioned you have several columns, you may need to fetch the cells corresponding to those columns to get their codes. For example, you have tc.section and tc.look but those commands will fail if the trial_cell "tc" does not have codes "section" and "look".

If you need to get cells from another column and match them with trial cells, you can follow the example in lines 23 and 24 to fetch the column and cells, respectively. You would want to do this for each of your columns. Then, inside your loop, at each iteration you would want to use some attribute of your trial_cell "tc" to find the associated cell from the list of cells in each of those columns.

Here is an excerpt of the export script with additional lines of code:

  trial_col = get_column('Trial') # get trial column
  trial_cells = trial_col.cells # get trial cells
  section_col = get_column('Section')
  section_cells = section_col.cells
  look_col = get_column('Look')
  look_cells = look_col.cells

# Iterate over trial cells trial_cells.each do |tc| matching_section_cell = section_cells.find{ |x| tc.contains(x) } matching_look_cell = look_cells.find{ |x| tc.contains(x) } row = [tc.ordinal, matching_section_cell.ordinal, matching_look_cell.duration] # get values for row of data data << row.join(',') # add row of data end

Here, I'm using the find function to find a specific cell from the list of section and look cells. I specify the condition to use to find the cell inside the curly braces; in this example, I look for the cell contained by the trial_cell "tc". The find function will return the first cell that matches that condition, so it is important to specify appropriate matching criteria. If I wanted to match by the ordinal number, I would use:

matching_section_cell = section_cells.find{ |x| x.ordinal == tc.ordinal } 
I hope this gets you closer to what you need.
permanent link

answered 02 May '17, 04:13

Shohan%20Hasan's gravatar image

Shohan Hasan ♦♦
accept rate: 14%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 30 Apr '17, 00:15

question was seen: 3,189 times

last updated: 02 May '17, 04:13

powered by OSQA