Query & Dialog Örnekleri 6

Merhaba

static void Query6(Args _args)
{
    CustTable   cust;
    CustTrans   custTrans;

    Query                   q = new Query();
    QueryRun                qr;
    QueryBuildDataSource    qbdsCustTable;
    QueryBuildDataSource    qdbsCustTrans;
    QueryBuildRange         qbrCurrency;
    QueryBuildRange         qbrRiskAmount;
    CurrencyCode            currency;
    Amount                  riskAmount;

    dialog                  d = new Dialog(“Müşteriler”);
    dialogField             dfCurrency;
    dialogField             dfRiskAmount;

    ;
    //Dialog
    dfCurrency = d.addField(typeId(CurrencyCode));
    dfRiskAmount = d.addField(typeId(Amount), “Max risk tutarı :”);

    if(d.run())
    {
        //getFromDialog
        currency    = dfCurrency.value();
        riskAmount  = dfRiskAmount.value();

        //fetch
        qbdsCustTable   = q.addDataSource(tableNum(CustTable));
        qbdsCustTable.addSortIndex(indexNum(CustTable, AccountIdx));
        qbdsCustTable.addSortField(fieldNum(CustTable, Name), SortOrder::Descending);

        qdbsCustTrans   = qbdsCustTable.addDataSource(tableNum(CustTrans));
        qdbsCustTrans.addLink(fieldNum(CustTable, AccountNum), fieldNum(CustTrans, AccountNum));
        qbrCurrency     = qbdsCustTable.addRange(fieldNum(CustTable, Currency));
        qbrRiskAmount   = qbdsCustTable.addRange(fieldNum(CustTable, RiskAmount));

        if(currency)
            qbrCurrency.value(sysQuery::value(currency));

        qbrRiskAmount.value(sysQuery::range(0.01, riskAmount));
        //super ben yazmam

        qr = new QueryRun(q);

        while(qr.next())
        {
            cust = qr.get(tableNum(CustTable));
            custTrans = qr.get(tableNum(CustTrans));
            info(strFmt(“%1     %2      %3      %4″,
                        cust.Name,
                        cust.Currency,
                        cust.RiskAmount,
                        custTrans.AmountMST));
        }

    }
}

 
Comment are closed.