ARS-Simple

 view release on metacpan or  search on metacpan

examples/generate_fid_hash.pl  view on Meta::CPAN


print "Enter the name of the Remedy form: ";
my $form = <STDIN>;
chomp $form;

#----------
my $sql = qq{select
f.fieldName,
f.fieldID,
decode(FOption, 1, 'Required ', 2, 'Optional ', 3, 'System RO', '*Unknown*'),
decode(datatype, 0, 'AR_DATA_TYPE_NULL', 1, 'AR_DATA_TYPE_KEYWORD', 2, 'AR_DATA_TYPE_INTEGER', 3, 'AR_DATA_TYPE_REAL', 4, 'AR_DATA_TYPE_CHAR', 5, 'AR_DATA_TYPE_DIARY', 6, 'AR_DATA_TYPE_ENUM', 7, 'AR_DATA_TYPE_TIME', 8, 'AR_DATA_TYPE_BITMASK', 9, 'AR_...
c.maxlength
from arschema a
join field f
on f.schemaid = a.schemaid and datatype < 30 and f.fieldID != 15
left outer join field_char c
on c.schemaid = f.schemaid and c.fieldid = f.fieldID
where a.name = '$form'
order by 1};


my $m = $ars->get_SQL({ sql => $sql });

### Sample data for 'User' form
# my $m = {

examples/generate_fid_hash.pl  view on Meta::CPAN

    if (length($row->[0]) > $max_len)
    {
        $max_len = length($row->[0]);
    }
}

# Construct the hash
my $fid_hash = "# Label/FID hash for form '$form'\n\%fid = (\n";
foreach my $row (@{ $m->{rows} })
{
    $fid_hash .= sprintf("    '%s'%s=> %10d,\t\t# %s type=%s %d\n", $row->[0], ' ' x ($max_len + 1 - length($row->[0])), $row->[1], $row->[2], $row->[3], $row->[4]);
}
$fid_hash .= "    );\n";

$CLIP->Set($fid_hash);
print "$fid_hash\nFormatted data copied to clipboard\n";

examples/get_data_by_label.pl  view on Meta::CPAN


# Dump detail of all User form records

my $ars = ARS::Simple->new({
        server   => 'dev_machine',
        user     => 'greg',
        password => 'password',
        });

%fid = (
        'CreateDate'               => 3,            # System RO type=AR_DATA_TYPE_TIME
        'LastModifiedBy'           => 5,            # System RO type=AR_DATA_TYPE_CHAR 254
        'ModifiedDate'             => 6,            # System RO type=AR_DATA_TYPE_TIME
        'RequestID'                => 1,            # System RO type=AR_DATA_TYPE_CHAR 15
        'Creator'                  => 2,            # Required  type=AR_DATA_TYPE_CHAR 254
        'FullName'                 => 8,            # Required  type=AR_DATA_TYPE_CHAR 254
        'FullTextLicenseType'      => 110,          # Required  type=AR_DATA_TYPE_ENUM
        'LicenseType'              => 109,          # Required  type=AR_DATA_TYPE_ENUM
        'LoginName'                => 101,          # Required  type=AR_DATA_TYPE_CHAR 254
        'Status'                   => 7,            # Required  type=AR_DATA_TYPE_ENUM
        'ApplicationLicense'       => 122,          # Optional  type=AR_DATA_TYPE_CHAR 0
        'ApplicationLicenseType'   => 115,          # Optional  type=AR_DATA_TYPE_CHAR 254
        'AssignedTo'               => 4,            # Optional  type=AR_DATA_TYPE_CHAR 254
        'ComputedGrpList'          => 119,          # Optional  type=AR_DATA_TYPE_CHAR 255
        'DefaultNotifyMechanism'   => 108,          # Optional  type=AR_DATA_TYPE_ENUM
        'EmailAddress'             => 103,          # Optional  type=AR_DATA_TYPE_CHAR 255
        'FlashboardsLicenseType'   => 111,          # Optional  type=AR_DATA_TYPE_ENUM
        'FromConfig'               => 250000003,    # Optional  type=AR_DATA_TYPE_CHAR 3
        'GroupList'                => 104,          # Optional  type=AR_DATA_TYPE_CHAR 255
        'UniqueIdentifier'         => 179,          # Optional  type=AR_DATA_TYPE_CHAR 38
        'AssetLicenseUsed'         => 220000002,    # *Unknown* type=AR_DATA_TYPE_INTEGER
        'ChangeLicenseUsed'        => 220000003,    # *Unknown* type=AR_DATA_TYPE_INTEGER
        'HelpDeskLicenseUsed'      => 220000004,    # *Unknown* type=AR_DATA_TYPE_INTEGER
        'NumberofLicenseAvailable' => 220000000,    # *Unknown* type=AR_DATA_TYPE_INTEGER
        'SLALicenseUsed'           => 220000001,    # *Unknown* type=AR_DATA_TYPE_INTEGER
        );

my $data = $ars->get_data_by_label({
        form        => 'User',
        query       => '1=1',
        lfid        => \%fid,
        max_returns => 50,
        });

print Dumper($data), "\n";

html/Simple.html  view on Meta::CPAN

<?xml version="1.0" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rev="made" href="mailto:" />
</head>

<body style="background-color: white">



<ul id="index">
  <li><a href="#NAME">NAME</a></li>
  <li><a href="#VERSION">VERSION</a></li>



( run in 0.793 second using v1.01-cache-2.11-cpan-2398b32b56e )