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 }
  • 相关阅读:
    前端,DJ
    打印九九乘法表
    求数组中最大值和最小值
    求数组中最大值和次大值
    数据库 Mysql 使用,优化,索引
    List、Map、Set的区别与联系
    1001个整数,每个数范围1到1000,求出重复的数字。
    一个正整数是否等于因数之和
    滑动验证 和滑动图片验证JS
    cmd中mvn命令,出现No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
  • 原文地址:https://www.cnblogs.com/Jinnchu/p/2659708.html
Copyright © 2011-2022 走看看