Condition builder and data types

gpopp
Kilo Expert

Hello!

I have a custom table that contains string fields (among others). I have noticed that for SOME string fields, I have absolutely NOTHING as an operator in the condition builder when I select that field. In others, I have only three choices "is", "Is not", "is anything". A few actually have all of the operators available for a string that I would expect to see from reading the documentation on the wiki:

http://wiki.servicenow.com/index.php?title=Condition_Builder#gsc.tab=0

Can someone explain to me why I'm getting this different behavior for string fields in my table? I need to be able to fashion complex queries against some of these fields and I can't seem to figure out why this is not working. I've looking in the system dictionary and can find no difference between a field that has all 'normal' query operators available and one that does not.

Here's an example of a 'limited' string field:

Condbuilder1.png

Here's an example of a severely 'disenfranchised' string field:

Condbuilde31.png

And here's one that miraculously works as expected:

Condbuilder-working.png

Any clues as to what might be going on would be greatly appreciated!

1 ACCEPTED SOLUTION

gpopp
Kilo Expert

For anyone in the future looking for the answer to this, I believe I have found the root cause.



When I auto created these fields, those that were strings I did NOT assign a size to since the default type is 'String' of length 40. They certainly seemed to create correctly. However, upon further investigation, these fields did NOT default as they do when being entered by hand. They seem to be something called a "Field string" or "Field class" which is derived from the type string but definitely NOT the base type 'String' that we all know and love.



Simply changing the type from blank to 'String' has solved all my problems.


View solution in original post

11 REPLIES 11

LearnerSubho
Mega Guru

Hello,



Could you please provide a snapshot of the dictionary entry of 'Label' field?


Filter option differs based on the field type.


Here, 'Label' could be a special type of OOB field.


Thanks,


Subhankar


Hi Subhankar,



Here's the dictionary entry:


label.png


I just remembered an important detail! (I created this table months ago)



I created the table using the standard gui interface - I went to tables/new and created it. But then, I took all the field names (from another database) and imported them into sys_dictionay using a transform map. In this way, I got all the fields created rather quickly instead of having to enter them all by hand. (Got the idea here:How to automatically create a target table for a data import set?) I bet there's something about this method that created this string 'differently' - but what? The dictionary entry is indistinguishable from another entry that works properly!?!?


gpopp
Kilo Expert

I've now discovered that naming the column 'Label' was a bitterly unfortunate choice. By renaming the column to 'Long Name', the behavior changes and the string now offers up the slightly stunted "Is", "Is Not", "Is Anything" operators. "Label" has special meaning in this context apparently. Still - I want the full gamut of operators.


I tested creating a string the normal (gui) way and the strings I create in this fashion behave properly.


I wish I knew what it was about the direct system-dictionary 'auto' creation that was lacking.