Announcing the new Datavyu v1.4.0 with enhanced features, bug fixes, and a new video player for Windows!

We are in the process of migrating away from this forum—feel free to browse existing help topics. For new support inquiries, please reach out to us via email at [email protected]

I'm getting the following error when trying to set a new variable to a database:

@Line -1:'org.jruby.exceptions.RaiseException: undefined method `old_args' for "curvefits":String'

"curvefits" is a variable I created with the createNewVariable function. I made a newcell in that variable and set all the arguments. Any ideas?

**UPDATE. I've attached the script below, which includes the creation of the variable. It's a pretty major script so I didn't want anyone to have to go through it—just trying to understand what the error means because 'old_args' is coming from the API, not my own code.

**UPDATE 2. I figured it out. The script below is now correct.

begin
  dir = File.expand_path("~/Desktop")
  gaitfiledir = "/Gait/"
  gaitfiles = Dir.new(dir + gaitfiledir).entries
  csvfiledir = "/Decision/"
  csvfiles = Dir.new(dir + csvfiledir).entries
  opsfiledir = "/OpenSHAPA/"
  opsfiles = Dir.new(dir + opsfiledir).entries
  puts csvfiles

  for file in opsfiles
    if file.include?(".opf") and file[0].chr != '.'

      puts "LOADING DATABASE: " + opsfiledir+file
      $db,proj = load_db(dir + opsfiledir + file)

      id = getVariable("id") 
      curvefits = createNewVariable("curvefits","hjmu","hjmu5","hjmu95","hjsig","hjsig5","hjsig95","vjmu","vjmu5","vjmu95","vjsig","vjsig5","vjsig95","hamu","hamu5","hamu95","hasig","hasig5","hasig95","vamu","vamu5","vamu95","vasig","vasig5","vasig95")
      idcell = curvefits.make_new_cell()

      #ITERATE THROUGH DECISION FILES AND MATCH DATA
      for entry in csvfiles
        wrotedec = false
        if entry.include?(".csv") and entry[0].chr != '.'
        puts "Loading csv file " + entry      
        f = ""
        infile = File.new(dir + csvfiledir + entry, "r")           
          infile.each_line() do |row|
            f += row
          end
          infile = f.split(/[\r\n]/)
          for row in infile
            columns = row.split(",")
            if columns[0] != "study"              
              if id.cells[0].id == columns[1]
                  if not(wrotedec)
                    puts "Writing Decision Data"
                    idcell.change_arg("hjmu", columns[18])
                    idcell.change_arg("hjmu5", columns[20])
                    idcell.change_arg("hjmu95", columns[21])
                    idcell.change_arg("hjsig", columns[22])
                    idcell.change_arg("hjsig5", columns[24])
                    idcell.change_arg("hjsig95", columns[25])
                    idcell.change_arg("vjmu", columns[43])
                    idcell.change_arg("vjmu5", columns[45])
                    idcell.change_arg("vjmu95", columns[46])
                    idcell.change_arg("vjsig", columns[47])
                    idcell.change_arg("vjsig5", columns[49])
                    idcell.change_arg("vjsig95", columns[50])
                    wrotedec = true
                  end
              end            
            end
          end
        end
      end

      #ITERATE THROUGH GAIT FILES AND MATCH DATA
      for entry in gaitfiles
        wrotedec = false
        if entry.include?(".csv") and entry[0].chr != '.'
        puts "Loading csv file " + entry      
        f = ""
        infile = File.new(dir + gaitfiledir + entry, "r")           
          infile.each_line() do |row|
            f += row
          end
          infile = f.split(/[\r\n]/)
          for row in infile
            columns = row.split(",")
            if columns[0] != "study"              
              if id.cells[0].id == columns[1]
                  if not(wrotedec)
                    puts "Writing Gait Data"
                    idcell.change_arg("hamu", columns[18])
                    idcell.change_arg("hamu5", columns[20])
                    idcell.change_arg("hamu95", columns[21])
                    idcell.change_arg("hasig", columns[22])
                    idcell.change_arg("hasig5", columns[24])
                    idcell.change_arg("hasig95", columns[25])
                    idcell.change_arg("vamu", columns[43])
                    idcell.change_arg("vamu5", columns[45])
                    idcell.change_arg("vamu95", columns[46])
                    idcell.change_arg("vasig", columns[47])
                    idcell.change_arg("vasig5", columns[49])
                    idcell.change_arg("vasig95", columns[50])
                    wrotedec = true
                  end
              end            
            end
          end
        end
      end
      puts #Finished writing
      setVariable("curvefits",curvefits) #don't switch these!!!
      save_db(dir + opsfiledir + file)
      puts "Successfully saved database for S# " + id.cells[0].id
      end
    end

end

asked 02 Mar '12, 06:53

JohnFranchak's gravatar image

JohnFranchak ♦
3964410
accept rate: 17%

closed 03 Mar '12, 01:19

Can you post your script that you are using to create the variable? Also can you list the arguments for your variable?

(02 Mar '12, 10:18) Clinton Clinton's gravatar image

The question has been closed for the following reason "The question is answered, right answer was accepted" by JohnFranchak 03 Mar '12, 01:19


Ok, I figured it out. Stupid mistake. Instead of

setVariable("curvefits",curvefits)

I had:

setVariable(curvefits,"curvefits")

The script I posted is now corrected, and is an example of matching files from multiple directories to openSHAPA files to import data.

permanent link

answered 03 Mar '12, 01:18

JohnFranchak's gravatar image

JohnFranchak ♦
3964410
accept rate: 17%

Follow this question

By Email:

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

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "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:

×1

question asked: 02 Mar '12, 06:53

question was seen: 2,675 times

last updated: 03 Mar '12, 01:19

Related questions

powered by OSQA