In order to bring you the best possible user experience, this site uses Javascript. If you are seeing this message, it is likely that the Javascript option in your browser is disabled. For optimal viewing of this site, please ensure that Javascript is enabled for your browser.
Login  |   Cloud ERP  |   Home  |   qad.com



  •     QAD Glossary

  • Implementing Calculated Fields
    A calculated field holds a value that is the result of a mathematical operation performed by a program. The calculated field program can be placed in the QXO service PROPATH—that is, defined in start-sess.sh—or run from an AppServer if the calculation requires input from a database. If it is a simple calculation that does not require access to a database, place it in the QXO service PROPATH, as this is faster. If it requires database access, use the AppServer.
    If connecting to a database, calculated fields require correct connection parameters for the AppServer. See QXO Source Applications for details on setting up AppServer parameters.
    You can find sample calculated field programs in < QXOSrvInstallDir >/src/samples. One of those sample programs, samplecalc1.p, is listed here.
     
    define input parameter dataset-handle phDataset.
    define input parameter pcBuffer as character.
    define input parameter pcQueryString as character.
    define output parameter pcResult as character.
    pcResult = string(now).
    delete object phDataset no-error.
    This program is provided as an example of the format that a calculated field program should take. The important part is the signature and the input and output parameters:
    The first parameter is the entire profile message defined as a dataset.
    The second parameter is the name of the buffer in the dataset that is currently in scope.
    The third parameter is the query string for that buffer that locates the exact record in the dataset that is in scope.
    The fourth parameter is the result of the calculation.
    The AppServer Parameter field on the source application configuration contains all the necessary parameters for Progress to connect to the AppServer. A typical set of AppServer parameters might be:
    -AppService qxoappserver -H co9906
    This allows QAD QXtend to access the calculated field program on an AppServer named qxoappserver on the machine co9906. The contents of this field are executed in the code like the following:
    create server hAppServer.
    hAppServer:connect("-AppService qxoappserver -H co9906").
    run value("myprogram.p") on hAppserver (input dataset-handle phProfile by-value, input pcBuffer, input pcQueryString, output output pcResult).
    If you are implementing a calculated field program that accesses the QAD Enterprise Applications databases, the program should use an application server separate from the one defined for QXO. For simple calculated field programs where the logic applied is local to the calculation program, it is safer and faster to locate the program in the normal code base.