QXtend Query Service > Query Service Setup > Direct Connection Setup
  
Direct Connection Setup
When calling the Query Service using a direct connection, you must connect the Progress session to the QXO database. In addition, ensure that the QXO runtime directory is included in the PROPATH.
Example:  
/* Query Service Direct Connection Example */
define variable goQueryServiceEngine as class com.qad.qxtend.qxo.QueryServiceEngine.
define variable hResponse as handle no-undo.
{com/qad/qxtend/qxo/dsQueryServiceRequest.i}
{com/qad/qxtend/qxo/ttException.i}
 
goQueryServiceEngine = new com.qad.qxtend.qxo.QueryServiceEngine().
 
create QueryServiceRequest.
assign
QueryServiceRequest.SourceApplication = "ERP32"
QueryServiceRequest.Profile = "Customer"
QueryServiceRequest.Filter = "cm_addr >= '0100' and cm_addr <= '100'"
QueryServiceRequest.MaxRows = 2.
goQueryServiceEngine:querySourceApplication
(input dataset dsQueryServiceRequest by-reference,
input "QP", /* Domain */
output dataset-handle hResponse).
 
if goQueryServiceEngine:hasExceptions() then do:
goQueryServiceEngine:getAllExceptions(output table ttException).
for each ttException:
message ttException.cDescription view-as alert-box.
end.
end.
else do:
hResponse:write-xml("file","qs.xml",true).
end.
 
delete object goQueryServiceEngine.
In the example, QXtend is connecting to a source application called ERP32, the profile is called Customer, a filter is defined, and the requests can return a maximum of two records. The result of the Query Service is returned in the dataset-handle, hResponse. The dataset is then serialized to the file qs.xml. If you want to analyze the data extracted, parse the dataset dynamically.