{"action":"created","issue":{"url":"https://api.github.com/repos/orientechnologies/orientdb/issues/5088","labels_url":"https://api.github.com/repos/orientechnologies/orientdb/issues/5088/labels{/name}","comments_url":"https://api.github.com/repos/orientechnologies/orientdb/issues/5088/comments","events_url":"https://api.github.com/repos/orientechnologies/orientdb/issues/5088/events","html_url":"https://github.com/orientechnologies/orientdb/issues/5088","id":110737728,"number":5088,"title":"Error in Function Parsing","user":{"login":"rakeshghodasara","id":13034507,"avatar_url":"https://avatars.githubusercontent.com/u/13034507?v=3","gravatar_id":"","url":"https://api.github.com/users/rakeshghodasara","html_url":"https://github.com/rakeshghodasara","followers_url":"https://api.github.com/users/rakeshghodasara/followers","following_url":"https://api.github.com/users/rakeshghodasara/following{/other_user}","gists_url":"https://api.github.com/users/rakeshghodasara/gists{/gist_id}","starred_url":"https://api.github.com/users/rakeshghodasara/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rakeshghodasara/subscriptions","organizations_url":"https://api.github.com/users/rakeshghodasara/orgs","repos_url":"https://api.github.com/users/rakeshghodasara/repos","events_url":"https://api.github.com/users/rakeshghodasara/events{/privacy}","received_events_url":"https://api.github.com/users/rakeshghodasara/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-10-09T21:19:57Z","updated_at":"2015-10-12T08:28:20Z","closed_at":null,"body":"I have issues with early vs late function evaluation.\r\n\r\nI have a very small Javascript function that returns the local Id of the vertex.  for eg : onlyid(#12:13) should return 13.\r\n\r\nit is written as return(rid.split(\":\")[1]);  This runs fine in the webUI.\r\n\r\nhowever when I execute this from the query console as :  \r\nselect onlyid(@RID) from Class1;\r\n\r\nI get error Error: \r\n\r\nError: com.orientechnologies.orient.core.exception.OStorageException: Error on executing command: sql.select onlyid(@RID) from Class1\r\n\r\nError: java.lang.RuntimeException: com.orientechnologies.orient.core.command.script.OCommandScriptException: Error on parsing script at position #0: Error on execution of the script\r\nScript: onlyid\r\n------^\r\n\r\nError: com.orientechnologies.orient.core.command.script.OCommandScriptException: Error on parsing script at position #0: Error on execution of the script\r\nScript: onlyid\r\n------^\r\n\r\nError: com.orientechnologies.orient.core.exception.OStorageException: TypeError: #19:0 has no such function \"split\" in <eval> at line number 71\r\n\r\nError: com.orientechnologies.orient.core.exception.OStorageException: TypeError: #19:0 has no such function \"split\"\r\n"},"comment":{"url":"https://api.github.com/repos/orientechnologies/orientdb/issues/comments/147327800","html_url":"https://github.com/orientechnologies/orientdb/issues/5088#issuecomment-147327800","issue_url":"https://api.github.com/repos/orientechnologies/orientdb/issues/5088","id":147327800,"user":{"login":"luigidellaquila","id":459289,"avatar_url":"https://avatars.githubusercontent.com/u/459289?v=3","gravatar_id":"","url":"https://api.github.com/users/luigidellaquila","html_url":"https://github.com/luigidellaquila","followers_url":"https://api.github.com/users/luigidellaquila/followers","following_url":"https://api.github.com/users/luigidellaquila/following{/other_user}","gists_url":"https://api.github.com/users/luigidellaquila/gists{/gist_id}","starred_url":"https://api.github.com/users/luigidellaquila/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/luigidellaquila/subscriptions","organizations_url":"https://api.github.com/users/luigidellaquila/orgs","repos_url":"https://api.github.com/users/luigidellaquila/repos","events_url":"https://api.github.com/users/luigidellaquila/events{/privacy}","received_events_url":"https://api.github.com/users/luigidellaquila/received_events","type":"User","site_admin":false},"created_at":"2015-10-12T08:28:20Z","updated_at":"2015-10-12T08:28:20Z","body":"Hi @rakeshghodasara \r\n\r\nI think in WebUI it's receiving a string, so the split() works correctly.\r\nWhen you execute it in a query, it will receive a RID object, that does not have a split method. \r\nMy suggestion is to change your function adding a toString(), eg.\r\n\r\n```\r\n return(rid.toString().split(\":\")[1]); \r\n```"}}