lookupguests
Description
lookupguests looks up guests in the database based on the fields passed. All fields are optional, but you need to use at least one in order to get any results. All the fields are used to filter the guests table, with the exception of <fields>, which can contain a different list of fields. In the case of the <fields>, tag, fields are identified using g for the guests table, a for address table and l for the addlink table, as shown below:
Example:
<func>lookupguests</func><first_name>matt</first_name><fields>g.guest_no, g.first_name, a.address</fields>
If the <fields> tag is not passed, the default is returned, as described below.
Note: If there are multiple address matches, a record is returned for each match. The area_code and phone are used to search both phone numbers of a particular address.
Note: When a photo is returned, the format is an encoded binary string that must be decoded to produce a JPEG.
lookupguests also supports lookup by second guests and the <crit> tag.
Example:
<func>lookupguests</func><firstname2>marge</firstname2><lastname2>simpson</lastname2>
Returns the following:
<rs:data><z:row guest_no='5001000' first_name='HOMER' last_name='SIMPSON' birth_date='1960-01-01T00:00:00' address_id='3001000' area_code='(505)' phone='751-0633' area_cod2='( )'
phone2=')) 'address='1337 E GUSDORF ROAD' city='TAOS' state='NM '
zip='87571'/><z:row guest_no='5001000' first_name='HOMER' last_name='SIMPSON'
birth_date='1960-01-01T00:00:00' address_id='736000000'area_code='505 ' phone='751-0633' area_cod2=' ' phone2=' ' address='1337 E GUSDORF ROAD' city='TAOS' state='NM '
zip='87571'/><z:row guest_no='655000000' first_name='HOMER' last_name='SIMPSON'
birth_date='1954-01-01T00:00:00' address_id='165000000' area_code='(417)' phone='856-1234' area_cod2=' ' phone2=' ' address='1234 Evergreen Terrace' city='Springfield' state='MO '
zip='65807'/></rs:data>
But the same call with an added <crit></crit> field,
<func>lookupguests</func><firstname2>marge</firstname2><lastname2>simpson</lastname2><crit><e_mail>homer@siriusware.com</e_mail></crit>
Returns the following:
<rs:data><z:row guest_no='655000000' first_name='HOMER'last_name='SIMPSON'
birth_date='1954-01-01T00:00:00' address_id='165000000'area_code='(417)' phone='856-1234' area_cod2=' ' phone2=' ' address='1234 Evergreen Terrace' city='Springfield' state='MO '
zip='65807'/></rs:data>
Note: The<crit> functionality gets parsed and added to the statement without much processing or checking. If you pass <crit><badfield>1</badfield></crit>, badfield='1' is added to the SQL statement, which fails.
Input fields
XML tag | Description |
<first_name> | Optional. Guest first name. |
<last_name> | Optional. Guest last name. |
<firstname2> | Optional. Used to look up guests by the second guest in the guest record. |
<lastname2> | Optional. Used to look up guests by the second guest in the guest record. |
<crit> | Optional. Used to pass in additional fields from the guests and/or address tables. |
<birth_date> | Optional. Guest birth date. Must be in YYYY-mm-dd format. |
<address> | Optional. Guest address line 1. |
<address2> | Optional. Guest address line 2. |
<city> | Optional. Guest city. |
<state> | Optional. Guest state. |
<zip> | Optional. Guest zip. |
<area_code> | Optional. Guest area code. Must be in (xxx) format – e.g., (303). |
<fields> | Optional. Other fields to be returned. Note on the <fields> tag. |
<getphoto> | Optional. Boolean indicating whether lookupguests returns a photo. |
Return fields
The fields shown in the table are returned by default.
Field | Description |
guest_no | Guest number. |
first_name | Guest first name. |
last_name | Guest last name. |
birth_date | Guest birth date. |
address_id | Guest address ID. |
area_code | Guest area code. |
phone | Guest phone. |
area_cod2 | Guest area code 2. |
phone2 | Guest phone 2. |
address | Guest address. |
city | Guest city. |
state | Guest state. |
zip | Guest zip. |
address.phone_ext | Phone extension |
Address.phone2_ext | Secondary phone extension |
Examples
Example invocation:
<func>lookupguests</func><first_name>matt</first_name>
<last_name>messinger</last_name>
Example return string:
OK :…recordset
<rs:data>
<z:row guest_no='14000001' first_name='MATT' last_name='MESSINGER'
birth_date='1970-01-01T00:00:00' address_id='1000001'
area_code='(505)' phone='751-0633' area_cod2='( )' phone2=' - '
address='122 N MAIN STREET TEST' city='GUNNISON' state='CO '
zip='81230'/>
</rs:data>
See also