Invalid Numeric Operation Value passed to Minimum() function

Ok, hello to all again, it's been a while since I have posted here. I have come to a point that is making me hit my head onto the desk repeatedly. I am parsing a file with "the offset of" function. I get all the data and put it into a variable. The data is as follows:

(0,0,0,0,0),(1,1,1,1,1),(-1,-1,-1,-1,-1),(2,2,2,2,2),(-1,0,1,2,1),(2,1,0,-1,0),(0,-1,0,1,0),(1,2,1,0,1),(0,1,2,2,2),(1,0,-1,-1,-1),(0,1,1,2,2),(1,0,0,-1,-1),(0,0,-1,0,0),(1,1,2,1,1),(-1,0,0,0,-1),(2,1,1,1,2),(0,-1,-1,-1,0),(1,2,2,2,1),(-1,-1,0,-1,-1),(2,2,1,2,2),(-1,-1,0,1,2),(2,2,1,0,-1),(0,1,0,1,0),(1,0,1,0,1),(-1,0,-1,0,-1),(2,1,2,1,2),(0,-1,0,-1,0),(1,2,1,2,1),(-1,-1,-1,0,0),(2,2,2,1,1),(0,0,0,1,2),(1,1,1,0,-1),(0,1,2,1,0),(1,0,-1,0,1),(-1,0,1,0,-1),(2,1,0,1,2),(0,0,1,1,2),(1,1,0,0,-1),(0,0,-1,-1,0),(1,1,2,2,1),(-1,0,-1,-1,0),(2,1,2,2,1),(0,1,1,1,0),(1,0,0,0,1),(0,-1,-1,0,-1),(1,2,2,1,2),(-1,0,0,-1,0),(2,1,1,2,1),(0,1,0,-1,-1),(1,0,1,2,2)

I then am trying to use the "min" function on this data to find well the minumum value. It is failing with the following:

Selection Failed in 0:00:09 Invalid Numeric Operation Value passed to Minimum() function is not a number ((0)

So I decided to copy that data and just put it into a variable and try it like that. It works just fine and finds "-1". So, now, I'm dumbfounded at what is the difference. The data posted above is the variable I put it into "logged" out. So when I copy and past this data and put it into another variable it works, but when I take the variable I created from the parsing and put it into "min" it fails. What gives?

So I made a "compare" if statement and of course it fails, but when I remedy the difference and it passes, the "min" still fails.

Why is it allowing me to copy the same data that is logged out from the variable I dumped it in from the parsing, but when I just use the parsing variable it fails? I don't get it and would like to shed some light on this. Please help!

Comments

  • EggplantMattEggplantMatt ForumAdmin admin
    When you read it from the file, it's just a string that resembles a list of lists. When you populate a variable with it from within eggPlant, it's interpreted by the compiler as an actual list of lists. If you read it in and apply the value() function to it, it should work the same way:
    put value(file "/path/to/file") into myvar
    
  • Hmmm, interesting, but doesn't solve my issue. The file doesn't seem to be an issue, but just to check I put "value" before the file I'm parsing. It actually failed instantly saying it couldn't understand "]" which is in the file ALOT. Here is what I am working with.
    put file "~/Documents/reel.txt" into PayList
    	
    	set paycnt to "50"
    	set pcnt to "1"
    	
    	put (the offset of "[PAYLINE_1]" in PayList ) into trash
    	put characters 1 to (trash + 10) of PayList into discardPile
    	delete discardPile from PayList
    	
    	put (the offset of "[PAYLINE_1]" in PayList ) into trash
    	put characters 1 to (trash + 10) of PayList into discardPile
    	delete discardPile from PayList
    	
    	repeat paycnt times
    		
    		put "[PAYLINE_" into pname
    		put pcnt after pname
    		put "]" after pname
    		
    		log "This is the pname:" && pname
    		
    		if pcnt is not "1" then 
    			
    			put (the offset of pname in PayList ) into trash
    			put characters 1 to (trash) of PayList into discardPile
    			delete discardPile from PayList
    			
    		end if
    		
    		add 1 to pcnt
    		
    		set global Reels to "5"
    		
    		set rcnt to "1"
    		
    		put "(" after finalpaylist
    		
    		repeat global Reels times
    			
    			put "REEL_" into rname
    			put rcnt after rname
    			put " = " after rname
    			
    			put (the offset of rname in PayList ) into trash
    			put characters 1 to (trash + 10) of PayList into discardPile
    			
    			put the last two characters of discardPile into payvar
    			
    			delete return from payvar
    			
    			put payvar after finalpaylist
    			put "," after finalpaylist
    			
    			add 1 to rcnt
    			
    			
    			(*log PayList*)
    			
    		end repeat
    		delete last character of finalpaylist
    		put ")" after finalpaylist
    		log finalpaylist
    		put "," after finalpaylist
    		
    	end repeat
    	delete last character of finalpaylist
    	log finalpaylist---this logs out the data that I am trying to find the min value.	
    	put finalpaylist into finalpaylist ---was trying to see if it was a formatting issue	
    	
    	put min(finalpaylist) into minpayline ---fails with the error in the subject of this post
    	
    	log minpayline
    
  • EggplantMattEggplantMatt ForumAdmin admin
    I was under the impression that the only thing the file contained was the list of lists shown in your original post -- if you read in that text and apply the value function to it, it should solve the problem.
  • but if I put the following from the data that is being put into the finalpaylist and copy it and put it into another variable it works just fine.
    put ((0,0,0,0,0),(1,1,1,1,1),(-1,-1,-1,-1,-1),(2,2,2,2,2),(-1,0,1,2,1),(2,1,0,-1,0),(0,-1,0,1,0),(1,2,1,0,1),(0,1,2,2,2),(1,0,-1,-1,-1),(0,1,1,2,2),(1,0,0,-1,-1),(0,0,-1,0,0),(1,1,2,1,1),(-1,0,0,0,-1),(2,1,1,1,2),(0,-1,-1,-1,0),(1,2,2,2,1),(-1,-1,0,-1,-1),(2,2,1,2,2),(-1,-1,0,1,2),(2,2,1,0,-1),(0,1,0,1,0),(1,0,1,0,1),(-1,0,-1,0,-1),(2,1,2,1,2),(0,-1,0,-1,0),(1,2,1,2,1),(-1,-1,-1,0,0),(2,2,2,1,1),(0,0,0,1,2),(1,1,1,0,-1),(0,1,2,1,0),(1,0,-1,0,1),(-1,0,1,0,-1),(2,1,0,1,2),(0,0,1,1,2),(1,1,0,0,-1),(0,0,-1,-1,0),(1,1,2,2,1),(-1,0,-1,-1,0),(2,1,2,2,1),(0,1,1,1,0),(1,0,0,0,1),(0,-1,-1,0,-1),(1,2,2,1,2),(-1,0,0,-1,0),(2,1,1,2,1),(0,1,0,-1,-1),(1,0,1,2,2)) into TotallyDifferentVariable
    
    put min(TotallyDifferentVariable) into minpayline
    
    log minpayline
    

    it finds "-1" without any errors...
  • I have tried that and I get this error...like this right?
    put value(finalpaylist) into finalpaylist
    
    put min(finalpaylist) into minpayline
    
    log minpayline
    

    Selection Failed in 0:00:00 SRUN_InvalidValueExpr Unable to take value of expression '(0,0,0,0,0),(1,1,1,1,1),(-1,-1,-1,-1,-1),(2,2,2...' (reason: Invalid SenseTalk Expression: Syntax Error - can't understand "," at or near character 12)
  • EggplantMattEggplantMatt ForumAdmin admin
    but if I put the following from the data that is being put into the finalpaylist and copy it and put it into another variable it works just fine.
    put ((0,0,0,0,0),(1,1,1,1,1),(-1,-1,-1,-1,-1),(2,2,2,2,2),(-1,0,1,2,1),(2,1,0,-1,0),(0,-1,0,1,0),(1,2,1,0,1),(0,1,2,2,2),(1,0,-1,-1,-1),(0,1,1,2,2),(1,0,0,-1,-1),(0,0,-1,0,0),(1,1,2,1,1),(-1,0,0,0,-1),(2,1,1,1,2),(0,-1,-1,-1,0),(1,2,2,2,1),(-1,-1,0,-1,-1),(2,2,1,2,2),(-1,-1,0,1,2),(2,2,1,0,-1),(0,1,0,1,0),(1,0,1,0,1),(-1,0,-1,0,-1),(2,1,2,1,2),(0,-1,0,-1,0),(1,2,1,2,1),(-1,-1,-1,0,0),(2,2,2,1,1),(0,0,0,1,2),(1,1,1,0,-1),(0,1,2,1,0),(1,0,-1,0,1),(-1,0,1,0,-1),(2,1,0,1,2),(0,0,1,1,2),(1,1,0,0,-1),(0,0,-1,-1,0),(1,1,2,2,1),(-1,0,-1,-1,0),(2,1,2,2,1),(0,1,1,1,0),(1,0,0,0,1),(0,-1,-1,0,-1),(1,2,2,1,2),(-1,0,0,-1,0),(2,1,1,2,1),(0,1,0,-1,-1),(1,0,1,2,2)) into TotallyDifferentVariable
    
    put min(TotallyDifferentVariable) into minpayline
    
    log minpayline
    

    it finds "-1" without any errors...

    That has an extra set of parentheses around it, making it a list of lists. If the value from your file looks like it does in the first post, then I think that you could just say:
    value("(" & valueReadIn & ")") into somevar
    
  • Wow, you sir need a raise. That was exactly what I needed.

    I tried adding the parenthesis without the value function, without you I would of been lost. I knew it was a formatting issue of some sort and that is why I was banging my head against the desk.

    Is there a Customer Satisfaction form I can fill out? I would like to praise you on your quick and painless response. Hopefully persuade them into giving you a pay bump.

    God Speed, Matt, I really appreciate dealing with you every time.
  • Hi,

    is it possible in eggplant to read and execute external script but in the same suite?

    Ronelle
  • EggplantMattEggplantMatt ForumAdmin admin
    I'm not sure I understand the question. EggPlant can run other eggPlant scripts in the same suite just by referring to them by name. So if you have a script called myScript and in it you want to run another script called myOtherScript, you would just put:
    myOtherScript
    
    in myScript. Is that what you mean?
  • Yes to read you can use it as a helper file, to execute you can use the "run" function...hope that helps!
Sign In or Register to comment.