您如何在SysLastValue中找到用户最后使用的打印机 [英] How do you find a user's last used printer in SysLastValue
问题描述
我一直在尝试查找用户最后使用过的打印机的存储位置,以便清除此使用情况数据(因为尽管安装了KB981681,但有几个用户遇到了一个问题,即记住的打印机仍默认使用XPS编写器&打印机可用;只是某些AX表单未默认设置).
I've been trying to find where a user's last used printer is stored so that I can clear this usage data (as a few users have an issue where the remembered printer keeps defaulting to the XPS writer, despite us having KB981681 installed & the printer being available; just not defaulted on certain AX forms).
我知道此数据位于使用情况数据"中的某个位置,可以通过AX浏览该数据:
I know this data's somewhere in the Usage Data, which I can browse via AX:
Microsoft Dynamics AX
> Tools
> Development Tools
> Application Objects
> Usage Data
AOT
> System Documentation
> Tables
> SysLastValue
>(右键单击)> Add-Ins
> Table Browser
AOT
> System Documentation
> Tables
> SysLastValue
> (right click) > Add-Ins
> Table Browser
或通过SQL:
use AXDB
go
select *
from SysLastValue
where userid in
(
select id
from userinfo
where networkalias in ('userid1','userid2')
)
and elementname like '%print%'
and iskernel = 1
但是,到目前为止,我还无法猜测哪个设置保存了上次使用的打印机信息.由于value
字段是图像类型(即斑点),因此我也无法基于值进行搜索.
However so far I've not been able to guess which setting holds the last used printer information. Since the value
field is of type image (i.e. a blob) I also can't search based on value.
任何有关如何找到此设置的建议都会有所帮助.
Any advise on how to find this setting would be helpful.
推荐答案
不幸的是,实际上并没有存储一个最后使用的打印机",因为每个进程都打包并存储了最后使用的打印设置.这是一个示例,说明如何在销售表单中过帐出库单后如何提取上次使用的打印设置.
Unfortunately there really isn't one "last used printer" stored, as much as each process packs and stores the last used print settings. Here is an example of how you can pull the last used print settings after posting a picking slip from the sales form.
static void JobGetPrinterSettingsPickList(Args _args)
{
container lastValues;
SalesFormLetter_PickingList pickList = new SalesFormLetter_PickingList();
SRSPrintDestinationSettings printSettings;
lastValues = xSysLastValue::getValue(curext(), curUserId(), UtilElementType::Class, classStr(SalesFormLetter_PickingList), formStr(SalesTable));
pickList.unpack(lastValues);
printSettings = new SRSPrintDestinationSettings(pickList.printerSettingsFormletter());
info(strFmt("%1", printSettings.printerName()));
info(strFmt("%1", printSettings.printerType()));
}
编辑:啊,我看到您遇到了一个特定问题.检查出现问题的任何对象的打包/解压和版本.这可能是问题所在.或者,如果涉及到几件事,请检查它们是否都是扩展类,并且需要查看父类.
Ah I see you're having a specific issue. Check the pack/unpack and version of whatever object is having the issue. That is likely where the issue is. Or if it's on several things, check if they're all extended classes and you need to look at the parent class.
这篇关于您如何在SysLastValue中找到用户最后使用的打印机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!