• Copy table data on Intercompany with X++ code


    Copy table data on Intercompany with X++ code.

    Remark by Jimmy August 03th 2010

    static void Jimmy_CopyTableDataIntercompany(Args _args)
    {
        int               i;
        Test              FromTable,ToTable;
        companyId         formCompany,toCompany;
    
        void buf2Buf(Common  _from,Common  _to)
        {
            DictTable   dictTable = new DictTable(_from.TableId);
            fieldId     fieldId   = dictTable.fieldNext(0);
    
            while (fieldId && ! isSysId(fieldId))
            {
                _to.(fieldId)   = _from.(fieldId);
                fieldId         = dictTable.fieldNext(fieldId);
            }
        }
    ;
        formCompany = "NEW";
        toCompany   = "QCN";
        ChangeCompany(formCompany)
        {
            FromTable = NULL; //must be this code
            FromTable.clear();//must be this code
            while select FromTable
            {
                i++;
                changeCompany(toCompany)
                {
                    ttsbegin;
                    ToTable    = null;//must be this code
                    ToTable.clear();  //must be this code
                    ToTable.initValue();
                    buf2Buf(FromTable,ToTable);
                    ToTable.Qty = i;
                    ToTable.insert();
                    ttscommit;
               }
           }
        }
    }
    /*
        DictTable         dicttable;
        DictField         dictfield;
        int               fieldcnt,i,m;
        fieldId           fieldid;
        Test              FromTable,ToTable;
    ;
        global::buf2Buf(FromTable,ToTable);
        ChangeCompany("New")
        {
            FromTable = null;
            FromTable.clear();
            while select FromTable
            {
                m++;
                dicttable   = new DictTable(FromTable.TableId);
                changeCompany("qcn")
                {
                     ToTable    = null;
                     ToTable.clear();
                     ToTable.initValue();
                     fieldcnt   = dicttable.fieldCnt();
                     for (i = 1; i <= fieldcnt; i++)
                     {
    
                        fieldid   = dicttable.fieldCnt2Id(i);
                        dictfield = new dictfield(FromTable.TableId,fieldid);
                        if (dictfield.id() == fieldname2id(FromTable.TableId,identifierstr(DataAreaId)))
                            continue;
                        else
                            ToTable.(dictfield.id()) =  FromTable.(dictfield.id());
                     }
                     ToTable.Qty = m;
                     ToTable.initValue();
                     ToTable.insert();
                 }
             }
             info(strfmt(int2str(m)));
           
         }
    */
         
    
    
    
    
    
    

  • 相关阅读:
    CSS3盒模型display初探(display:box/display:flex)
    css伪元素研究(::before/::after)
    css后代选择器(div.class中间不带空格)
    css选择器(选择<div>内所有<p>元素)
    text-indent无效解决方案
    控制div位于最上层
    gulp用途
    Webpack打包工具实时更新操作(启用观察者模式)
    CLR/.NET/C#/Visual Studio/ASP.NET各版本之间的关系(转)
    前端打包/自动化构建工具:fis3
  • 原文地址:https://www.cnblogs.com/Fandyx/p/1791256.html
Copyright © 2020-2023  润新知