X ++以报表的形式传递当前选定的记录 [英] X++ passing current selected records in a form for your report

查看:87
本文介绍了X ++以报表的形式传递当前选定的记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图使这个问题听起来尽可能清楚.

I am trying to make this question sound as clear as possible.

基本上,我已经创建了一个报告,现在它作为菜单项按钮存在,以便该报告可以从表单中运行.

Basically, I have created a report, and it now exists as a menuitem button so that the report can run off the form.

我想做的是能够多选择记录,然后当我单击我的按钮来运行报告时,当前选择的记录将传递到出现的对话框形式(过滤器屏幕)中.

What I would like to do, is be able to multi-select records, then when I click on my button to run my report, the current selected records are passed into the dialog form (filter screen) that appears.

我尝试使用与SaleLinesEdit表单相同的方法来执行此操作,但没有成功.

I have tried to do this using the same methods as with the SaleLinesEdit form, but had no success.

如果有人能指出正确的方向,我将不胜感激.

If anyone could point me in the right direction I would greatly appreciate it.

推荐答案

这是我用于此问题的解决方案;

Here is the resolution I used for this issue;

报表中的两个方法,以便在表单上多选字段时,将值传递到过滤器对话框;

Two methods on the report so that when fields are multi-selected on forms, the values are passed to the filter dialog;

private void setQueryRange(Common _common)
    {
    FormDataSource              fds;

    LogisticsControlTable       logisticsTable;

    QueryBuildDataSource        qbdsLogisticsTable;
    QueryBuildRange             qbrLogisticsId;
    str                         rangeLogId;

    set                         logIdSet    = new Set(Types::String);

    str addRange(str _range, str _value, QueryBuildDataSource _qbds, int _fieldNum, Set _set    =       null)
    {
        str             ret = _range;
        QueryBuildRange qbr;
        ;

        if(_set && _set.in(_Value))
        {
            return ret;
        }

        if(strLen(ret) + strLen(_value) + 1 > 255)
        {
            qbr = _qbds.addRange(_fieldNum);
            qbr.value(ret);
            ret = '';
        }

        if(ret)
        {
            ret += ',';
        }

        if(_set)
        {
            _set.add(_value);
        }

        ret += _value;
        return ret;
    }
    ;

    switch(_common.TableId)
    {
        case tableNum(LogisticsControlTable):

            qbdsLogisticsTable = element.query().dataSourceTable(tableNum(LogisticsControlTable));
            qbrLogisticsId     = qbdsLogisticsTable.addRange(fieldNum(LogisticsControlTable, LogisticsId));

            fds = _common.dataSource();

            for(logisticsTable = fds.getFirst(true) ? fds.getFirst(true) : _common;
                logisticsTable;
                logisticsTable = fds.getNext())
            {
                rangeLogId = addrange(rangeLogId, logisticsTable.LogisticsId, qbdsLogisticsTable, fieldNum(LogisticsControlTable, LogisticsId),logIdSet);
            }

            qbrLogisticsId.value(rangeLogId);
            break;
    }
}

//这将设置查询并获取将其传递到范围内的值,即"SO0001,SO0002,SO000£...

// This set the query and gets the values passing them to the range i.e. "SO0001, SO0002, SO000£...

第二种方法如下;

private void setQueryEnableDS()
{
    Query           queryLocal = element.query();
    ;
}

还需要init方法;

Also on the init method this is required;

public void init()
{
    ;
    super();

    if(element.args() && element.args().dataset())
    {
        this.setQueryRange(element.args().record());
    }
}

希望这对将来遇到我遇到的问题的人有帮助.

Hope this helps in the future for anyone else who has the issue I had.

这篇关于X ++以报表的形式传递当前选定的记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆