Fred,
 
It works.  Thank you, thank you.
 
Chinh.

--- On Thu, 7/8/10, Fred Bennett <fbenn...@bellind.com> wrote:


From: Fred Bennett <fbenn...@bellind.com>
Subject: Re: [Arsperl-users] Need Help: Qualification String "LIKE"
To: "'ARSperl User Discussion'" <arsperl-users@arsperl.org>
Date: Thursday, July 8, 2010, 4:55 PM



a HA!  I think I see the problem.
 
Hello Chinh,
 
When using the 'ars_GetListEntry...' there is one thing this API call is rather 
particular about.
 
You need to enclose that specific API call in parentheses.  For instance; I 
wrote a short script below for you, which uses a 'LIKE' search from the User 
record as a 'Leading' search.  If I were to leave out the parentheses, I 
receive output similar to this:
 
C:\Temp\>UserLookup.pl MyServer.belltechlogix.com loginname password "j"
 
Odd number of elements in hash assignment at C:\Temp\UserLookup.pl line 30.
juser                    User, Joe              Floating  
ju...@belltechlogix.com   Email     Current
 
Yaaaaay!
1
C:\Temp\>
 
The script is listed below.
**NOTE: In my environment, we changed the 'Login ID' field to 'Login Name' on 
the User form.  If you want to try this on your server you may need to verify 
the name of this field and change the $searchField value to "Login ID".
 
#####################################
#  Author:  Fred Bennett                            #
#  Date:  7/8/2010                                     #
# Purpose: Example script for Chinh Do      #
############ Start of Script #############
#!c:/perl/bin/perl.exe
use ARS;
use warnings;
 

# Syntax = c:\Temp\UserLookup.pl Server Login Password "Search String"
 
# Identify the Arguments -
my $serverName=$ARGV[0];
my $loginName=$ARGV[1];
my $passWord=$ARGV[2];
my $searchString=$ARGV[3];
 
# Set the variables - incase you want to use this with other forms/fields -

my $schemaName="User";
my $searchField="Login Name";

my $countOfNoChg=0;
 
# Log into the Server.
$c = ars_Login("$serverName", "$loginName", "$passWord");
if (!$c) {print("Could not connect to ARS ($ars_errstr)\n");exit(1);}
 
 
# Build the LIKE Search String -
    (my $q  = ars_LoadQualifier($c, "$schemaName", "'$searchField' LIKE 
\"$searchString%\"")) ||  die $ars_errstr; 

# Get the list of records - NOTE - this will only return 100.  If you want 
unlimited, change the '100' to '0' - 
    (%entries = ars_GetListEntry($c, "$schemaName",$q,100,0))||  die 
$ars_errstr;
# Sort by the Request ID field -
    foreach $Request_ID (sort keys %entries) 
    {
# Pull information for the individual entry -
       %entries = ars_GetEntry($c, "$schemaName",$Request_ID);
# Show what record returned - 
       print $Request_ID."\n";
 
#### I use the below section for verification/validation output -
       $targetEntryID = $Request_ID; 
 
# Count the number of records returned -
 $countOfNoChg++;
 
    }
# If any records are found, give us a 'Yaaaaay!'  We're going to Hawaii... -
    if ($targetEntryID) { print "\nYaaaaay!\n"; }
     
    else {
# If no records are found, give us a big ole 'Boooooo!' -     
    print ("Boooooo!\n");
     }
# Show how many records we counted (if any) -
    print ($countOfNoChg."\n");

############ Start of Script #############
 
I hope this helps.
 
Thanks,

-Fred Bennett 
Bell TechLogix
IT Application Development
fbenn...@bellind.com
 



From: Chinh Do [mailto:chinh...@yahoo.com] 
Sent: Thursday, July 08, 2010 12:45 PM
To: ARSperl User Discussion
Subject: Re: [Arsperl-users] Need Help: Qualification String "LIKE"







Thank you for your fast response.  I tried this but produces no record:
 
my $qual1 = "'536870914' LIKE \"%-N-%\"";
my $qual2 = ars_LoadQualifier( $ctrl, $User_schema, $qual1 ) || die $arr_errstr;
my @entries = ars_GetListEntry($ctrl, $User_schema, $qual2,0,0) || die 
$arr_errstr;
 
Can you find out some thing is missing from my coding?  But it works fine on 
the online form for advanced search.
 
Also, where I can find the next generated number for the form key?
 
Chinh.

--- On Thu, 7/8/10, Thilo Stapff <thilo.sta...@apprologic.de> wrote:


From: Thilo Stapff <thilo.sta...@apprologic.de>
Subject: Re: [Arsperl-users] Need Help: Qualification String "LIKE"
To: "ARSperl User Discussion" <arsperl-users@arsperl.org>
Date: Thursday, July 8, 2010, 10:19 AM


Use the field ID instead of "User Ident", e.g.

'536870912' LIKE "%-N-%"


Regards,
Thilo Stapff





On 08.07.2010 17:05, Chinh Do wrote:
> I need to search all fields that have this string "-N-" in the middle,
> for examples, "123-N-abc" and "4759ABC-N-Bill". Using Oracle SQL, I can
> code "...fieldname LIKE '%-N-%' ". I tried "my $qual1 = "'User Ident'
> LIKE \"%-N-%\"" but it does not work.
> How do I code the qualification string using ARSPerl to get the same
> result as using "LIKE"?
> Thank you,
> Chinh.
>
>
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by Sprint
> What will you do first with EVO, the first 4G phone?
> Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
>
>
>
>
>
> --
> Arsperl-users mailing list
> Arsperl-users@arsperl.org
> https://lists.sourceforge.net/lists/listinfo/arsperl-users


------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first


--
Arsperl-users mailing list
Arsperl-users@arsperl.org
https://lists.sourceforge.net/lists/listinfo/arsperl-users

-----Inline Attachment Follows-----


------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
-----Inline Attachment Follows-----




--
Arsperl-users mailing list
Arsperl-users@arsperl.org
https://lists.sourceforge.net/lists/listinfo/arsperl-users
------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first

--
Arsperl-users mailing list
Arsperl-users@arsperl.org
https://lists.sourceforge.net/lists/listinfo/arsperl-users

Reply via email to