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 }
  • 相关阅读:
    [易语言] 六边形扫雷游戏实战开发
    [web开发] 利用微信小程序开发上海大学失物招领平台
    [web开发] Vue + spring boot + echart 微博爬虫展示平台
    [web开发] Vue+Spring Boot 上海大学预约系统开发记录
    [神经网络]一步一步使用Mobile-Net完成视觉识别(一)
    Python中操作ini配置文件
    python操作mySQL数据库
    使用python和selenium写一个百度搜索的case
    功能测试的过程中有关数据安全性的检查点
    python主流测试框架的简介
  • 原文地址:https://www.cnblogs.com/Jinnchu/p/2659708.html
Copyright © 2011-2022 走看看