• 导出CSV


    static void ExInventMaterialType(Args _args)

    {

        InventTable                         _invent;

        #AviFiles

        str                                 s,tempStr;

        int                                 i,RecCount;

        container                           c,conFilter = ["Excel Files(*.csv)", "*.csv"];

        SysOperationProgress                simpleProgress;

        TextBuffer                          textBuffer  = new TextBuffer();

        FileIoPermission                    perm;

        counter                             Lines;

        ;

        s = Winapi::getSaveFileName(0, conFilter, "","Save File", "", "");

        if (s)

        {

            select count(RecId) from _invent  where _invent.NJ_MaterialType != "";

            RecCount = _invent.RecId;

            simpleProgress = SysOperationProgress::newGeneral(#aviUpdate, 'Exporting...', RecCount);

            simpleProgress.setCaption("Data Export");

            simpleProgress.setAnimation(#AviFormLetter);

            startlengthyoperation();

            try

            {

                perm = new FileIoPermission(s, "w");

                perm.assert();

                textBuffer.appendText("Itemid,");

                textBuffer.appendText("MaterialType,");

                textBuffer.appendText("\n");

                while select _invent where _invent.NJ_MaterialType != ""

                {

                    //if (StrLen())

     

                    //textBuffer.appendText(strReplace(strfmt("%1,",NJ_Search_Inventory.tagBL),"\n"," "));

                    textBuffer.appendText(strfmt("%1,",_invent.ItemId));

                    textBuffer.appendText(strfmt("%1,",_invent.NJ_MaterialType));

                    /* textBuffer.appendText(strfmt("%1,",NJ_Search_Inventory.ACT_ItemCategoryId));

                    textBuffer.appendText(strfmt("%1,",NJ_Search_Inventory.ACT_ProdShapeID)); */

                    textBuffer.appendText("\n");

                    simpleProgress.incCount();

                    simpleprogress.setText(strfmt("Task: %1/%2", i,RecCount));

                    i++;

                }

                Lines = textBuffer.numLines();

                try

                {

                    if (textBuffer.toFile(s))

                        info(strfmt("¼Ç¼µ¼³öµ½Îļþ %1.¹²µ¼³öÁË %2 ÐмǼ.",s,Lines-1));

                }

                catch ( Exception::Error )

                {

                    error ("Generated file error.");

                }

                CodeAccessPermission::revertAssert();

                }

               

            catch (Exception::Deadlock)

            {

                retry;

            }

        }

    }

  • 相关阅读:
    回归cnblog
    第一篇博文
    apache 配置网站目录,虚拟目录,新端口
    linux 虚拟机设置IP访问外网
    Volist标签 key值的使用
    php header调试,yii2打log
    Yii2 框架下bootstrap 弹窗预览视频等~
    几个简单的css设置问题:div居中,ul li不换行 ,内容超出自动变省略号等
    鼠标右键弹窗(实现重命名等)的设计
    HTML5 Canvas绘图系列之一:圆弧等基础图形的实现
  • 原文地址:https://www.cnblogs.com/perock/p/2182257.html
Copyright © 2020-2023  润新知