zoukankan      html  css  js  c++  java
  • Save the users last values in a dialog

    Had a case then I needed to do a modification to a report with a custom dialog where the user could make some changes to the information that teh report would show.

    I needed the same behavioure as you get from a RunBase class but I needed to use it in a report. Tha solution was to use the xSysLastValue class.

    1 client server public static container getValue(CompanyId _company,
    2 userId _userId, UtilElementType _type, identifiername _elementName
    3 [, identifiername _designName])

    The usage is pretty simple, the parameters is used to identify the correct data. One thing to remember is that if you use this method to retrieve the user data for a dialog in a report for example don't use the reports name as _elementName because you can end up with the user data for the report instead.

    To save the data you use the:

     1 client server public static void putValue(container _value, CompanyId _company,
     2 userId _userId, UtilElementType _type, identifiername _elementName
     3 [, identifiername _designName])
     4 
     5 Example: 
     6 
     7 static void SaveLastValues(Args _args)
     8 {
     9   Dialog      _dlg;
    10   DialogGroup _dlgGroup;
    11   DialogField _dlgField1;
    12   DialogField _dlgField2;
    13   container   _dialogValues;
    14   NoYesId     _choice1;
    15   NoYesId     _choice2;
    16   ;
    17 
    18   _dlg = new dialog();
    19 
    20   _dlgGroup  = _dlg.addGroup("Group");
    21   _dlgField1 = _dlg.addField(typeid(NoYesId),"Choice 1");
    22   _dlgField2 = _dlg.addField(typeid(NoYesId),"Choice 2");
    23 
    24   //Get the previouse values
    25   _dialogValues = xSysLastValue::getValue(curExt(), curUserId(), UtilElementType::Job, "SaveLastValue");
    26 
    27   //Check if we have previouse values
    28   if (_dialogValues != conNull())
    29   {
    30     _dlgField1.value(conPeek(_dialogValues, 1));
    31     _dlgField2.value(conPeek(_dialogValues, 2));
    32   }
    33 
    34   if (_dlg.run())
    35   {
    36     //Save the user choices
    37     _dialogValues = conNull();
    38     _dialogValues += _dlgField1.value();
    39     _dialogValues += _dlgField2.value();
    40 
    41     xSysLastValue::putValue(_dialogValues,curExt(),curUserId(),UtilElementType::Job,"SaveLastValue");
    42 
    43     //Do what ever
    44   }
    45 }
  • 相关阅读:
    Hive之安装
    python3常用内置方法(持续更新中。。。)
    CentOS7下安装Python3及Pip3并保留Python2
    一个爬取52破解的全部帖子地址的简单爬虫
    在windows写入文件中遇到 UnicodeEncodeError: ‘gbk’ codec can’t encode character 错误的解决办法
    我的vim配置
    树莓派命令行模式调整音量
    树莓派更改软件源
    linux连接wifi
    给树莓派挂载移动硬盘或U盘
  • 原文地址:https://www.cnblogs.com/Jinnchu/p/2659708.html
Copyright © 2011-2022 走看看