- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-29-2016 07:50 AM
Hi ServiceNow Community,
I've read through these forums to see if anyone else has had this problem, but can't seem to find anything relating to it.
I'm trying to produce a database view using the a where clause to the effect of (WHERE [field] IS NULL). There's no documentation on this on the wiki for this so I'm hoping to find some experience with this within the userbase.
As a test I'm trying to create a view of alm_hardware, where parent is null. When I execute "Try It", the page refreshes and I'm actually sent back to the list of database views, indicating that some error occured but isn't displayed.
My error log found in the system logs is :
java.lang.StringIndexOutOfBoundsException: String index out of range: -1
Caused by error in Script Include: 'ViewUtil' at line 22
19: isValid : function(current) {
20: var dbi = GlideDBConfiguration.getDBI(current.name);
21: var view = new GlideDBView(dbi, current.name);
==> 22: var v = view.isValidView();
23: dbi.close();
24: return v;
25: },
java.lang.String.substring(String.java:1937)
com.glide.database_views.WhereClause.addName(WhereClause.java:147)
com.glide.database_views.WhereClause.toSQL(WhereClause.java:59)
com.glide.database_views.DatabaseViewJoin.getSQL(DatabaseViewJoin.java:166)
com.glide.db.DBView.isValid(DBView.java:274)
com.glide.db.DBView.isValidView(DBView.java:256)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:597)
org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:255)
org.mozilla.javascript.ScriptRuntime.call(ScriptRuntime.java:1227)
org.mozilla.javascript.gen.c14999.call(sys_script_include.88c44dd10a0a3c19012e96fdcbe13d16:22)
org.mozilla.javascript.ScriptRuntime.call(ScriptRuntime.java:1227)
org.mozilla.javascript.gen.c15023.call(<refname>:6)
org.mozilla.javascript.gen.c15023.exec(<refname>)
com.glide.script.ScriptEvaluator.execute(ScriptEvaluator.java:233)
com.glide.script.ScriptEvaluator.evaluateString(ScriptEvaluator.java:105)
com.glide.script.ScriptEvaluator.evaluateString(ScriptEvaluator.java:72)
com.glide.script.ScriptEvaluator.evaluateString(ScriptEvaluator.java:63)
com.glide.script.Evaluator.evaluateString(Evaluator.java:91)
com.glide.script.GlideRhinoHelper.evaluateAsString(GlideRhinoHelper.java:130)
com.glide.script.ActionScript.conditionalEval(ActionScript.java:83)
com.glide.script.ActionScript.execute(ActionScript.java:69)
com.glide.script.ActionScriptProcessor.processScript(ActionScriptProcessor.java:125)
com.glide.script.Action.process(Action.java:115)
com.glide.ui.RedirectTransaction.invokeAction(RedirectTransaction.java:418)
com.glide.ui.RedirectTransaction.handleActions(RedirectTransaction.java:387)
com.glide.ui.RedirectTransaction.inboundActions(RedirectTransaction.java:223)
com.glide.ui.RedirectTransaction.process(RedirectTransaction.java:92)
com.glide.ui.GlideServletUITransaction.process(GlideServletUITransaction.java:68)
com.glide.processors.Processor.runProcessor(Processor.java:402)
com.glide.processors.Processor.processTransaction(Processor.java:192)
com.glide.processors.ProcessorRegistry.process(ProcessorRegistry.java:146)
com.glide.ui.GlideServletTransaction.process(GlideServletTransaction.java:36)
com.glide.ui.GlideServlet$1.run(GlideServlet.java:414)
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
java.lang.Thread.run(Thread.java:682)
Attached is an example of my view.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-28-2016 01:37 PM
Hi Jordan,
I am wondering, could you attach a BEFORE QUERY DB RULE to the database view 'table'?
Along the lines of:
Database View Table Where Clause to contain NULL
Best Regards
Tony
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-28-2016 01:37 PM
Hi Jordan,
I am wondering, could you attach a BEFORE QUERY DB RULE to the database view 'table'?
Along the lines of:
Database View Table Where Clause to contain NULL
Best Regards
Tony
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-29-2016 06:24 AM
Thanks Tony. I don't have a chance to really test it this week. It's been a while since I've solved this problem in a different way.
It seems like a great solution, thanks for bringing it to my attention. I'm going to suggest this as the answer just so that people can take a look at this in the future if they're searching for it.