Thread: RE: [Arsperl-users] question regarding the query() method
Brought to you by:
jeffmurphy
|
From: Sean G. <msg...@co...> - 2005-04-27 14:11:17
|
It is because your query is bad -- it should be 'Login Name' =3D "Some =
User"
If you are creating it in perl it should be "'Login Name' =3D \"Some =
User\""
Fields are always surrounded in single quotes while character data is in
double quotes.
Please note -- you must use the label of the field and not the database =
name
when creating your query. This has got me several times because =
everything
else seems to use the database name.
Thanks,
Sean=20
-----Original Message-----
From: ars...@ar...
[mailto:ars...@ar...] On Behalf Of the sign will be =
that
life is awesome
Sent: Wednesday, April 27, 2005 6:16 AM
To: 'ars...@ar...'
Subject: [Arsperl-users] question regarding the query() method
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 :
my @entries =3D $remedy_form->query(
-query =3D> '("Login Name" =3D "some_user")'
);
this returns an array of field headers but no entries.
i've verified that the 'Login Name' field exists under that name in the =
form
'Login Name' =3D> 240000005
I suspect that I'm not understanding how to properly phrase a remedy =
query
and apologize if that is the case here. invoking query() with no =
arguments
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
properly
format a filter on the query itself.
does anyone see anything boneheaded i'm doing here? i've tried various
quoting
styles for the query, such as "(\"Login Name\" =3D \"some_user\")", =
'Login
name'
and 'Login' instead of 'Login Name' and omitting the spaces between the
field
name and the '=3D' in the query as well as removing the parentheses =
around the
query but none of those seem to work for me. directly using
ars_GetListEntry
acts identically.
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.
the deconstructed qualifier as returned by ars_perl_qualifier() looks =
like
$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'
}
};
using the standard $all qualifier of "1=3D1" returns
$VAR1 =3D {
'oper' =3D> 'rel_op',
'rel_op' =3D> {
'left' =3D> {
'value' =3D> 1
},
'right' =3D> {
'value' =3D> 1
},
'oper' =3D> '=3D=3D'
}
};
( using "1=3D1" returns all entries properly, as does "1<2" and other =
queries
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 =
feed
to the qualifier constructor, tho the examples i've seen in the mailing =
list
seem to match up with what i'm trying to do )
a little stumped :) - thanks much for any help!
- tom
-------------------------------------------------------
SF.Net email is sponsored by: Tell us your software development plans!
Take this survey and enter to win a one-year sub to SourceForge.net
Plus IDC's 2005 look-ahead and a copy of this survey
Click here to start! http://www.idcswdc.com/cgi-bin/survey?id=3D105hix
_______________________________________________
Arsperl-users mailing list
Ars...@ar...
https://lists.sourceforge.net/lists/listinfo/arsperl-users
|
|
From: Mark V. <mva...@ev...> - 2005-04-27 14:34:15
|
I believe the "Login Name" should be surrounded by single quotes, not double quotes. Mark Vaughan Programmer III =20 Direct: +1 303 802 2426 Cell: +1 303 601 4434 Fax: +1 303 802 1420 mar...@ev... Evolving Systems, Inc.=20 9777 Mt. Pyramid Court, Suite 100, Englewood, CO USA 80112 www.evolving.com -----Original Message----- From: ars...@ar... [mailto:ars...@ar...] On Behalf Of the sign will be that life is awesome Sent: Wednesday, April 27, 2005 4:16 AM To: ars...@ar... Subject: [Arsperl-users] question regarding the query() method 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 : my @entries =3D $remedy_form->query( -query =3D> '("Login Name" =3D "some_user")' ); this returns an array of field headers but no entries. i've verified that the 'Login Name' field exists under that name in the form 'Login Name' =3D> 240000005 I suspect that I'm not understanding how to properly phrase a remedy query and apologize if that is the case here. invoking query() with no arguments 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 properly format a filter on the query itself. does anyone see anything boneheaded i'm doing here? i've tried various quoting 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 field 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_GetListEntry acts identically. 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. the deconstructed qualifier as returned by ars_perl_qualifier() looks like $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' } }; using the standard $all qualifier of "1=3D1" returns $VAR1 =3D { 'oper' =3D> 'rel_op', 'rel_op' =3D> { 'left' =3D> { 'value' =3D> 1 }, 'right' =3D> { 'value' =3D> 1 }, 'oper' =3D> '=3D=3D' } }; ( using "1=3D1" returns all entries properly, as does "1<2" and other queries 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 feed to the qualifier constructor, tho the examples i've seen in the mailing list seem to match up with what i'm trying to do ) a little stumped :) - thanks much for any help! - tom ------------------------------------------------------- SF.Net email is sponsored by: Tell us your software development plans! Take this survey and enter to win a one-year sub to SourceForge.net Plus IDC's 2005 look-ahead and a copy of this survey Click here to start! http://www.idcswdc.com/cgi-bin/survey?id=3D105hix _______________________________________________ Arsperl-users mailing list Ars...@ar... https://lists.sourceforge.net/lists/listinfo/arsperl-users This e-mail and any attachments may be confidential and/or legally privil= eged. If you have received this e-mail and you are not a named addressee,= please inform Evolving Systems TIS at ti...@ev... and then delete t= he e-mail from your system. If you are not a named addressee you must not= use, disclose, distribute, copy, print or rely on this e-mail. To ensure= regulatory compliance and for the protection of our clients and business= , Evolving Systems may monitor and read e-mails sent to and from its serv= ers. Although Evolving Systems routinely screens for viruses, addressees = should scan this e-mail and any attachments for viruses. Evolving Systems= makes no representation or warranty as to the absence of viruses in this= e-mail or any attachments.=20 Registered Office: 9777 Mt. Pyramid Ct Suite 100, Englewood, CO 80112 |
|
From: Carey M. B. <bla...@gm...> - 2005-04-27 14:50:56
|
Mark,
That was my first thought too. But is it very hard to read the following Pe=
rl:
-query =3D> '("Login Name" =3D "some_user")'
Is that:
<single>(<single><single>Login Name<single><single> =3D
<double>someuser<double>)<single>
or
<single>(<double>Login Name<double> =3D <double>someuser<double>)<single>
or=20
<single>(<double>Login Name<double> =3D
<single><single>someuser<single><single>)<single>
or
etc...
All I can say is that my cursor appears to count the values as one
double quote around the Login Name field name. (not sure if that is a
function of the many layers of email processing or not.)
But it is hard to read it that way when you know what should be there
given ARS syntax and Perl syntax. Which is why I was trying to break
down the way it should be instead of just point fixing this query
condition.
It would actually be a nice add to the ARSPerl docs to include a
search example using:
Field labels (yea.. that takes some work)
Field DB names
Field ID values
And the host of "values" too. (Char, Integer, Data/Time, Real, etc..)
Would there be any interest in having a "ARSPerl sample form" with
some sample scripts that go with it?
--=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, Mark Vaughan <mva...@ev...> wrote:
> I believe the "Login Name" should be surrounded by single quotes, not
> double quotes.
>=20
> Mark Vaughan
>=20
> Programmer III
>=20
> Direct: +1 303 802 2426
>=20
> Cell: +1 303 601 4434
>=20
> Fax: +1 303 802 1420
>=20
> mar...@ev...
>=20
> Evolving Systems, Inc.
>=20
> 9777 Mt. Pyramid Court, Suite 100, Englewood, CO USA 80112
>=20
> www.evolving.com
>=20
>=20
> -----Original Message-----
> From: ars...@ar...
> [mailto:ars...@ar...] On Behalf Of the sign will be
> that life is awesome
> Sent: Wednesday, April 27, 2005 4:16 AM
> To: ars...@ar...
> Subject: [Arsperl-users] question regarding the query() method
>=20
> 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
> form
>=20
> 'Login Name' =3D> 240000005
>=20
> I suspect that I'm not understanding how to properly phrase a remedy
> query
> and apologize if that is the case here. invoking query() with no
> arguments
> 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
> properly
> format a filter on the query itself.
>=20
> does anyone see anything boneheaded i'm doing here? i've tried various
> quoting
> 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
> field
> 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_GetListEntry
> 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
> like
>=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
> queries
> 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
> feed
> to the qualifier constructor, tho the examples i've seen in the mailing
> list
> seem to match up with what i'm trying to do )
>=20
> a little stumped :) - thanks much for any help!
>=20
> - tom
>=20
> -------------------------------------------------------
> SF.Net email is sponsored by: Tell us your software development plans!
> Take this survey and enter to win a one-year sub to SourceForge.net
> Plus IDC's 2005 look-ahead and a copy of this survey
> Click here to start! http://www.idcswdc.com/cgi-bin/survey?id=3D105hix
> _______________________________________________
> Arsperl-users mailing list
> Ars...@ar...
> https://lists.sourceforge.net/lists/listinfo/arsperl-users
> This e-mail and any attachments may be confidential and/or legally privil=
eged. If you have received this e-mail and you are not a named addressee, p=
lease inform Evolving Systems TIS at ti...@ev... and then delete the e=
-mail from your system. If you are not a named addressee you must not use, =
disclose, distribute, copy, print or rely on this e-mail. To ensure regulat=
ory compliance and for the protection of our clients and business, Evolving=
Systems may monitor and read e-mails sent to and from its servers. Althoug=
h Evolving Systems routinely screens for viruses, addressees should scan th=
is e-mail and any attachments for viruses. Evolving Systems makes no repres=
entation or warranty as to the absence of viruses in this e-mail or any att=
achments.
>=20
> Registered Office: 9777 Mt. Pyramid Ct Suite 100, Englewood, CO 80112
>=20
>=20
> -------------------------------------------------------
> SF.Net email is sponsored by: Tell us your software development plans!
> Take this survey and enter to win a one-year sub to SourceForge.net
> Plus IDC's 2005 look-ahead and a copy of this survey
> Click here to start! http://www.idcswdc.com/cgi-bin/survey?id=105hix
> _______________________________________________
> Arsperl-users mailing list
> Ars...@ar...
> https://lists.sourceforge.net/lists/listinfo/arsperl-users
>
|
|
From: Mark V. <mva...@ev...> - 2005-04-27 15:15:57
|
Carey,
Here are the two ways with <s> meaning single quote (')and <d> meaning
double quote ("):
Using surrounding single quotes:
<s>(\<s>Login Name\<s> =3D <d>some user<d>)<s>
Using surrounding double quotes:
<d>(<s>Login Name<s> =3D \<d>some user\<d>)<d>
I hope this helps :)
Mark
Mark Vaughan
Programmer III
=20
Direct: +1 303 802 2426
Cell: +1 303 601 4434
Fax: +1 303 802 1420
mar...@ev...
Evolving Systems, Inc.=20
9777 Mt. Pyramid Court, Suite 100, Englewood, CO USA 80112
www.evolving.com
-----Original Message-----
From: ars...@ar...
[mailto:ars...@ar...] On Behalf Of Carey Matthew
Black
Sent: Wednesday, April 27, 2005 8:50 AM
To: ars...@ar...
Subject: Re: [Arsperl-users] question regarding the query() method
Mark,
That was my first thought too. But is it very hard to read the following
Perl:
-query =3D> '("Login Name" =3D "some_user")'
Is that:
<single>(<single><single>Login Name<single><single> =3D
<double>someuser<double>)<single>
or
<single>(<double>Login Name<double> =3D <double>someuser<double>)<single>=
or=20
<single>(<double>Login Name<double> =3D
<single><single>someuser<single><single>)<single>
or
etc...
All I can say is that my cursor appears to count the values as one
double quote around the Login Name field name. (not sure if that is a
function of the many layers of email processing or not.)
But it is hard to read it that way when you know what should be there
given ARS syntax and Perl syntax. Which is why I was trying to break
down the way it should be instead of just point fixing this query
condition.
It would actually be a nice add to the ARSPerl docs to include a
search example using:
Field labels (yea.. that takes some work)
Field DB names
Field ID values
And the host of "values" too. (Char, Integer, Data/Time, Real, etc..)
Would there be any interest in having a "ARSPerl sample form" with
some sample scripts that go with it?
--=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, Mark Vaughan <mva...@ev...> wrote:
> I believe the "Login Name" should be surrounded by single quotes, not
> double quotes.
>=20
> Mark Vaughan
>=20
> Programmer III
>=20
> Direct: +1 303 802 2426
>=20
> Cell: +1 303 601 4434
>=20
> Fax: +1 303 802 1420
>=20
> mar...@ev...
>=20
> Evolving Systems, Inc.
>=20
> 9777 Mt. Pyramid Court, Suite 100, Englewood, CO USA 80112
>=20
> www.evolving.com
>=20
>=20
> -----Original Message-----
> From: ars...@ar...
> [mailto:ars...@ar...] On Behalf Of the sign will be
> that life is awesome
> Sent: Wednesday, April 27, 2005 4:16 AM
> To: ars...@ar...
> Subject: [Arsperl-users] question regarding the query() method
>=20
> 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
> form
>=20
> 'Login Name' =3D> 240000005
>=20
> I suspect that I'm not understanding how to properly phrase a remedy
> query
> and apologize if that is the case here. invoking query() with no
> arguments
> 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
> properly
> format a filter on the query itself.
>=20
> does anyone see anything boneheaded i'm doing here? i've tried
various
> quoting
> styles for the query, such as "(\"Login Name\" =3D \"some_user\")",
'Login
> name'
> and 'Login' instead of 'Login Name' and omitting the spaces between
the
> field
> name and the '=3D' in the query as well as removing the parentheses
around
> the
> query but none of those seem to work for me. directly using
> ars_GetListEntry
> 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
> like
>=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
> queries
> 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
> feed
> to the qualifier constructor, tho the examples i've seen in the
mailing
> list
> seem to match up with what i'm trying to do )
>=20
> a little stumped :) - thanks much for any help!
>=20
> - tom
>=20
> -------------------------------------------------------
> SF.Net email is sponsored by: Tell us your software development plans!
> Take this survey and enter to win a one-year sub to SourceForge.net
> Plus IDC's 2005 look-ahead and a copy of this survey
> Click here to start! http://www.idcswdc.com/cgi-bin/survey?id=3D105hix=
> _______________________________________________
> Arsperl-users mailing list
> Ars...@ar...
> https://lists.sourceforge.net/lists/listinfo/arsperl-users
> This e-mail and any attachments may be confidential and/or legally
privileged. If you have received this e-mail and you are not a named
addressee, please inform Evolving Systems TIS at ti...@ev... and
then delete the e-mail from your system. If you are not a named
addressee you must not use, disclose, distribute, copy, print or rely on
this e-mail. To ensure regulatory compliance and for the protection of
our clients and business, Evolving Systems may monitor and read e-mails
sent to and from its servers. Although Evolving Systems routinely
screens for viruses, addressees should scan this e-mail and any
attachments for viruses. Evolving Systems makes no representation or
warranty as to the absence of viruses in this e-mail or any attachments.
>=20
> Registered Office: 9777 Mt. Pyramid Ct Suite 100, Englewood, CO 80112
>=20
>=20
> -------------------------------------------------------
> SF.Net email is sponsored by: Tell us your software development plans!
> Take this survey and enter to win a one-year sub to SourceForge.net
> Plus IDC's 2005 look-ahead and a copy of this survey
> Click here to start! http://www.idcswdc.com/cgi-bin/survey?id=105hix
> _______________________________________________
> Arsperl-users mailing list
> Ars...@ar...
> https://lists.sourceforge.net/lists/listinfo/arsperl-users
>
-------------------------------------------------------
SF.Net email is sponsored by: Tell us your software development plans!
Take this survey and enter to win a one-year sub to SourceForge.net
Plus IDC's 2005 look-ahead and a copy of this survey
Click here to start! http://www.idcswdc.com/cgi-bin/survey?id=105hix
_______________________________________________
Arsperl-users mailing list
Ars...@ar...
https://lists.sourceforge.net/lists/listinfo/arsperl-users
This e-mail and any attachments may be confidential and/or legally privil=
eged. If you have received this e-mail and you are not a named addressee,=
please inform Evolving Systems TIS at ti...@ev... and then delete t=
he e-mail from your system. If you are not a named addressee you must not=
use, disclose, distribute, copy, print or rely on this e-mail. To ensure=
regulatory compliance and for the protection of our clients and business=
, Evolving Systems may monitor and read e-mails sent to and from its serv=
ers. Although Evolving Systems routinely screens for viruses, addressees =
should scan this e-mail and any attachments for viruses. Evolving Systems=
makes no representation or warranty as to the absence of viruses in this=
e-mail or any attachments.=20
Registered Office: 9777 Mt. Pyramid Ct Suite 100, Englewood, CO 80112
|
|
From: Carey M. B. <bla...@gm...> - 2005-04-27 15:03:59
|
Sean, Ok.. So ars_GetListEntry does not use field Labels, but the OO ARS::form()->query() does, because the form() object is view aware. An interesting bit of info to keep in mind. But in my local version of the ARSPerl docs I see some statements like: The online docs say this about the openForm() method " The vui parameter currently does nothing, but it will eventually alter the field labels that you can pass into form->get() form->set(), etc. The form parameter is the name of the form you wish to open (e.g. "User"). Upon successful completion this call returns a new ARS::form object. " So this feature may depend on the version of the OO layer your using. (or maybe the docs are just stale.) But just as a side note on when you choose what name to use in your programming, think about stability of your code too. Field Labels are the most likely name to change over time. Field DB names are the next most likely name to change. Field ID's almost NEVER change. (only lately possible via a "unsupported utility", and it has it's limitations.) So if you can read the "ugly" field ID's in your code, then you are much less likely to have your scripts break "randomly" at some point down the road. I guess you could also create a special view (maybe call it "ARSPerl") and just as a development rule never change the labels on that view, and always reference that view in your code. But that seems like a waste full overhead instead of just using a field ID. (You could even build a local hash to translate the local "field name" to the fields' id too.) --=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, Sean Garrison <msg...@co...> wrote: > It is because your query is bad -- it should be 'Login Name' =3D "Some Us= er" >=20 > If you are creating it in perl it should be "'Login Name' =3D \"Some User= \"" >=20 > Fields are always surrounded in single quotes while character data is in > double quotes. >=20 > Please note -- you must use the label of the field and not the database n= ame > when creating your query. This has got me several times because everythi= ng > else seems to use the database name. >=20 > Thanks, >=20 > Sean >=20 > -----Original Message----- > From: ars...@ar... > [mailto:ars...@ar...] On Behalf Of the sign will be th= at > life is awesome > Sent: Wednesday, April 27, 2005 6:16 AM > To: 'ars...@ar...' > Subject: [Arsperl-users] question regarding the query() method >=20 > 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 > properly > format a filter on the query itself. >=20 > does anyone see anything boneheaded i'm doing here? i've tried various > quoting > 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 > field > 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_GetListEntry > 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 >=20 > ------------------------------------------------------- > SF.Net email is sponsored by: Tell us your software development plans! > Take this survey and enter to win a one-year sub to SourceForge.net > Plus IDC's 2005 look-ahead and a copy of this survey > Click here to start! http://www.idcswdc.com/cgi-bin/survey?id=3D105hix > _______________________________________________ > Arsperl-users mailing list > Ars...@ar... > https://lists.sourceforge.net/lists/listinfo/arsperl-users >=20 > ------------------------------------------------------- > SF.Net email is sponsored by: Tell us your software development plans! > Take this survey and enter to win a one-year sub to SourceForge.net > Plus IDC's 2005 look-ahead and a copy of this survey > Click here to start! http://www.idcswdc.com/cgi-bin/survey?id=105hix > _______________________________________________ > Arsperl-users mailing list > Ars...@ar... > https://lists.sourceforge.net/lists/listinfo/arsperl-users > |
|
From: Richard H. <rl...@ls...> - 2005-04-27 15:17:54
|
Carey, -----Original Message----- But in my local version of the ARSPerl docs I see some statements like: The online docs say this about the openForm() method " The vui parameter currently does nothing, but it will eventually alter the field labels that you can pass into form->get() form->set(), etc. The form parameter is the name of the form you wish to open (e.g. "User"). Upon successful completion this call returns a new ARS::form object. " So this feature may depend on the version of the OO layer your using. (or maybe the docs are just stale.) The way I read this is that the VUI acts as a "mask" to filter which fields are visible. The usual rules about field ids and labels still apply. Still makes me cuss sometimes when *almost* all the external/internal labels are the same and just one or two are "subtly" different (different caps, spacing etc)!!! Cheers, Richard. |
|
From: Richard H. <rl...@ls...> - 2005-04-27 15:57:04
|
With all this discussion about remembering which symbols to use when
(i.e. when assembling qualifiers or embedding field-ids ), I thought I'd
share the way I generate reports/emails etc from Remedy. Precisely because
of the differences between inner/outer labels and the need to add new fields
to reports or change column order or sort order, what I do now is to hold
the fields of interest in a table which is traversed automatically (e.g. for
ars_GetListEntryWithFields() calls) and also for the subsequent formatting.
For example, for a "helpdesk" schema, you could have:
My @field_tab = (
[ 'Userid', 'User ID', [1,1], undef ],
[ 'Create Date', undef, [2,1], \&fix_date ],
[ 'Description', undef, undef, undef],
:
:
etc
);
Before showing how this is used, I'll explain what each row contains. There
are four fields in each line:
1) Internal name of the field
2) External name of the field (will be later used as a column header
when HTML/spreadsheet is generated). If the same as (1), then undef is used.
3) Sort specifier. If undef, then this field is ignored for sort
purposes but otherwise the number pair specifies the sort order and whether
this field should be sorted up or down
4) Lastly there is a function pointer that (if not undef) refers to a
perl function that will be called on each "ticket" to post-process a
particular field (e.g. to turn 111181810 into "July 10th ..."). No fixup
means that the field's contents are emitted verbatim.
OK, to find the "tickets" matching some $qualifier using GLEWF, I put (with
ctrl, schema, fids having their normal meaning):
my @ticket_list = ars_GetListEntryWithFields(
$ctrl
$schema,
$qualifier,
0,
0,
[
map {
$fids->{$_->[0]}
} grep {
defined($_->[0])
} @field_tab
],
map {
($fids->{$_->[0]}, $_->[2]->[1])
} sort {
$a->[2]->[0] <=> $b->[2]->[0]
} grep {
defined($_->[2])
} @field_tab
);
OK, so far we have a list of matches generated from the @field_tab above and
the choice of fields to use/sort on is kept separate from the query itself
so different queries can be handled by using alternative field tables. The
gain here is when the boss comes in and says, "No, I want this column here
and that one there and the whole thing sorted on such-and-such". All you do
is change the order of the rows in the table above and (maybe) change the
sort specifiers (Adding / Deleting rows has the obvious effect as does
commenting out some lines during testing).
Next, displaying the results. I do (more or less (using the Perl CGI module
to get HTML shortcuts)):
First the column headers are extracted from the field table (using the
"default" mechanism I mentioned above)
my @rows;
push @rows, Tr(
{
-class => 'odd',
},
th(
[
map {
$_->[1] || $_->[0]
} @field_tab
]
)
);
Then the "meat" is emitted by traversing the @ticket_list, and for each one,
the @field_tab to pick out and (possibly) post-process the value.
for (my $i = 0; $i < scalar(@ticket_list); $i += 2) {
my ($ticket_no, $ticket_props) = @ticket_list[$i, $i + 1];
my @this_row;
foreach my $f (@$field_tab) {
my ($arLabel, $webLabel, $sortKey, $fixup) = @$f;
next unless ($arLabel);
my $value = $ticket_props->{$fids->{$arLabel}};
$value = $fixup->($q, $value) if ($fixup);
push @this_row, $value;
}
push @this_row, a(
{
-title=>"Show full details of ticket $ticket_no",
-target=>"_new",
-href=> SOME URL ...
},
'... more',
);
push @rows, Tr(
td(\@this_row)
);
}
The @rows structure is then emitted using the table() function.
----------------------
If this wasn't clear, please let me know.
Cheers,
Richard.
|