
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-27-2015 04:45 AM
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<g:evaluate>
var bcc = new GlideRecord('u_bcp_site_departments');
bcc.addQuery('sillyWilly', gs.getUserID());
bcc.query();
</g:evaluate>
<g:evaluate>
var erc = new GlideRecord('u_bcp_site_departments');
erc.addQuery('fooBar', gs.getUserID());
erc.query();
</g:evaluate>
<j:if test="${bcc.next()}">
<p>TEST 1</p>
</j:if>
<j:if test="${erc.next()}">
<p>TEST 2</p>
</j:if>
</j:jelly>
Odd... I'm seeing both TEST 1 and TEST 2.
I must be missing something simple here. These should both fail the "<j:if>" test.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-27-2015 05:05 AM
You can add this property 'glide.invalid_query.returns_no_rows' so that the invalid column name query will start returning no rows.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-27-2015 04:53 AM
I sense you are querying the custom table and hence your field in query should be prefixed by u_
at line 5, it should be "u_sillywilly"
same applicable for fooBar at line 10

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-27-2015 05:00 AM
That was intentional... the point that I've figured out though is that the query() should fail on entering (mistyping) a bad (unknown) field name in the addQuery(). It doesn't though, which stinks.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-27-2015 04:57 AM
So in further testing, I find that if I mistype the field ID, 'sillyWilly' in this example, the query() will return all records. However, if I get the field name correct but pass non-matching parameter, it will fail the query(), which is what I'd expect.
Visual:
// Returns all records, basically ignoring this addQuery. 'fooBar' is NOT a valid field name on the table.
// Result: BAD & UNexpected
erc.addQuery('fooBar', gs.getUserID());
// Returns the correct record(s). 'u_erc_author' IS a valid field name on the table.
// Result: GOOD & expected
erc.addQuery('u_erc_author', gs.getUserID());
// Returns no record(s). 'u_erc_author' IS a valid field name on the table, but does not contain 'poop'.
// Result: GOOD & expected
erc.addQuery('u_erc_author', 'poop');
Conclusion: The query() *should* fail if an incorrect field name is queried against. Sadly though, it doesn't.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-27-2015 05:05 AM
You can add this property 'glide.invalid_query.returns_no_rows' so that the invalid column name query will start returning no rows.