Re: [Arsperl-users] question regarding the query() method
Brought to you by:
jeffmurphy
|
From: Carey M. B. <bla...@gm...> - 2005-04-27 13:17:17
|
Tom,
ARS "Advanced Search Bar" syntax goes something like this:
Field names (Current View's Label, or fields DB name) should be in
single quotes. (Or you can use the field ID too.)
Literal strings should be in double quotes.
integers are NOT quoted (double or single)
Spacing really does not matter that much. (Extra white space is
welcome, but sometimes "2AND" may not parse as well as "2 AND". So try
to use some white space or at least parentheses.)
API search strings only differ by this one simple (and easy to trip
over) difference:
The fields DATABASE NAME (Each field has multiple English names,
one for the DB name that is guaranteed to be unique on the form, and
one per view where the field is included for the users reference.)
should be in single quotes.
So if the field id is 240000005 and the fields DB name is 'Login Name'
the following two syntax should do the same thing:
'Login Name' =3D "some user"
vs.
'240000005' =3D "some user"
However, if the fields label (view dependent name) is actually 'Login
Name' and the field's DB name is 'Login' then the first example above
would fail and the second one should work. (and 'Login' =3D "some user"
should also work.)
BTW: Some people like to use the qq function to make keeping track of
the quotes a bit easier.
$query_String =3D qq/('Login Name' =3D "some_user")/
Then try to use:
-query =3D> $query_String
Date time fields are "integer" in nature. (you have likely already
found this.) So 'Create Date' > 0 really means 'Create Date' >
"1/1/1970 12:00:00 AM" (In the client Timezone.) [ Well that is how
the User tool work. The API might be less TZ sensitive.]
Selection fields are "integer in nature. (you have likely already found thi=
s.)=20
'Status' =3D 1 can also be written as 'Status' =3D "Assigned"
Oh, one final thing... I never use the OO interface. It is just one
more thing to "fight with" IMHO. Perl is just to easy to over
complicate with multiple layers in Perl. ARSPerl is fairly straight
forward as a whole. So if the OO interface just does not get the job
done... try the "real ARSPerl" functions. I bet you will have no
problems with them.
I also do not have a copy of your "SHR:People" form so please confirm
field details with your Remedy Administrator via the Admin tool.
HTH.
--=20
Carey Matthew Black
Remedy Skilled Professional (RSP)
ARS =3D Action Request System(Remedy)
Solution =3D People + Process + Tools
Fast, Accurate, Cheap.... Pick two.
Never ascribe to malice, that which can be explained by incompetence.
http://www.fellowshipchurch.com
On 4/27/05, the sign will be that life is awesome <ix...@on...> wrote:
> I'm trying to figure out how to properly use qualifiers via the OO query(=
)
> method on the SHR:People form. my code is below :
>=20
> my @entries =3D $remedy_form->query(
> -query =3D> '("Login Name" =3D "some_user")'
> );
>=20
> this returns an array of field headers but no entries.
>=20
> i've verified that the 'Login Name' field exists under that name in the f=
orm
>=20
> 'Login Name' =3D> 240000005
>=20
> I suspect that I'm not understanding how to properly phrase a remedy quer=
y
> and apologize if that is the case here. invoking query() with no argumen=
ts
> properly returns all entry IDs for the form and i can properly perform a
> get() on the form handle to retrieve the entry - i just can't seem to pro=
perly
> format a filter on the query itself.
>=20
> does anyone see anything boneheaded i'm doing here? i've tried various q=
uoting
> styles for the query, such as "(\"Login Name\" =3D \"some_user\")", 'Logi=
n name'
> and 'Login' instead of 'Login Name' and omitting the spaces between the f=
ield
> name and the '=3D' in the query as well as removing the parentheses aroun=
d the
> query but none of those seem to work for me. directly using ars_GetListE=
ntry
> acts identically.
>=20
> one thing i've noted ( not sure if this is something the C API deals with=
or
> not ) is that you can specify any field name in the qualifier, whether it
> exists or not, and no error is thrown.
>=20
> the deconstructed qualifier as returned by ars_perl_qualifier() looks lik=
e
>=20
> $VAR1 =3D {
> 'oper' =3D> 'rel_op',
> 'rel_op' =3D> {
> 'left' =3D> {
> 'value' =3D> 'Login Name'
> },
> 'right' =3D> {
> 'value' =3D> 'some_user'
> },
> 'oper' =3D> '=3D=3D'
> }
> };
>=20
> using the standard $all qualifier of "1=3D1" returns
>=20
> $VAR1 =3D {
> 'oper' =3D> 'rel_op',
> 'rel_op' =3D> {
> 'left' =3D> {
> 'value' =3D> 1
> },
> 'right' =3D> {
> 'value' =3D> 1
> },
> 'oper' =3D> '=3D=3D'
> }
> };
>=20
> ( using "1=3D1" returns all entries properly, as does "1<2" and other que=
ries
> of that nature, so i think i've at least got the basic syntax down. what=
i'm
> probably not understanding are what types of arguments i'm supposed to fe=
ed
> to the qualifier constructor, tho the examples i've seen in the mailing l=
ist
> seem to match up with what i'm trying to do )
>=20
> a little stumped :) - thanks much for any help!
>=20
> - tom
|