简体   繁体   English

如何将当前日期从一个UniQuery段落传递到另一个

[英]How to pass current date from one UniQuery paragraph to another

How can I pass the current date from one PA to another in UniQuery? 如何在UniQuery中将当前日期从一个PA传递到另一个PA? A colleague taught me the trick of having the date written by cron to a file and using a inline prompt to read it with <<F(HOLD,X.DATE.TODAY,1)>> , but that adds extra parts that can fail and I would rather keep it simple (aka one time the file didn't get updated, oops). 一位同事教我一个技巧,即将cron写入的日期写入文件,并使用内联提示符使用<<F(HOLD,X.DATE.TODAY,1)>>读取<<F(HOLD,X.DATE.TODAY,1)>> ,但这会增加一些可能失败的部分而且我宁愿保持简单(又是一次文件没有更新,哎呀)。

I basically need something like this. 我基本上需要这样的东西。

AE VOC MY.PROCESS.TODAY
001: PA
002: MY.PROCESS ?????

To run my second PA with the current date. 用当前日期运行第二个PA。

AE VOC MY.PROCESS
001: PA
002: SELECT PERSON WITH PER.CHANGE.DATE EQ <<I2,Enter Date:>>

This does work, MY.PROCESS <<F(HOLD,X.DATE.TODAY,1)>> , but is there anyway I could pass the results using something more reliable like DATE() as the argument into the second paragraph? MY.PROCESS <<F(HOLD,X.DATE.TODAY,1)>>但是无论如何,我可以使用更可靠的东西DATE()DATE()将结果传递给第二段吗?

You will likely get answers saying "don't do that in a paragraph", and to some extent that's right - anything except for a simple list of commands can get complicated. 您可能会得到答案,说“不要在段落中这样做”,并且在某种程度上是正确的-除了简单的命令列表外,任何其他操作都会变得很复杂。

That said, the below works for me: 也就是说,以下对我有用:

AE VOC MY.PROCESS
001: PA
002: CLEARPROMPTS
003: SELECT PERSON WITH PER.CHANGE.DATE EQ <<I2,Enter Date:>>

From: https://docs.rocketsoftware.com/nxt/gateway.dll/RKBnew20/unidata/v8.2.1/unidata_userguide_v821.pdf 来自: https : //docs.rocketsoftware.com/nxt/gateway.dll/RKBnew20/unidata/v8.2.1/unidata_userguide_v821.pdf

I use the I option while testing: "The I and S options are similar to the C option. The In option prompts for text if n is not specified, and the Sn option passes the value of n to called paragraphs." 我在测试时使用I选项:“ I和S选项类似于C选项。如果未指定n,则In选项提示输入文本,并且Sn选项将n的值传递给被调用的段落。”

Also read the section just above that "Always prompting with an inline prompt", to explain why CLEARPROMPTS is needed. 另请阅读上方的“始终使用内联提示进行提示”部分,以解释为什么需要CLEARPROMPTS。 Without that, if you don't pass a parameter it will gladly use the last one provided. 否则,如果您不传递参数,它将很乐意使用提供的最后一个参数。

[Edit: to provide BASIC option] Paragraphs are great for really simple things, and there's probably a way to finagle things. [编辑:提供BASIC选项]段落非常适合于非常简单的事情,并且可能存在一种细化这些事情的方法。 But it's a one-line basic program to get something working: 但这是一个单行的基本程序,可以使某些功能正常运行:

EXECUTE "MY.PROCESS ":OCONV(DATE(),"D4/")

Is there a hard requirement that MY.PROCESS.TODAY be a paragraph? 是否有一个硬性要求就是MY.PROCESS.TODAY是一个段落? If you compile and catalog this one-line program as BP MY.PROCESS.TODAY then it will work exactly as needed. 如果将此单行程序编译和分类为BP MY.PROCESS.TODAY,则它将完全根据需要运行。

You could also create a Vitrual Dictionary item that his today's date 您还可以创建一个Vitrual词典项目,以表示他今天的日期

ED DICT PERSON TODAYSDATE ED DICT人员今天

I @DATE D2/ TODAY'S DATE 10L S

Then your select statement becomes: 然后,您的select语句变为:

SELECT PERSON WITH PER.CHANGE.DATE EQ TODAYSDATE 选择PER.CHANGE.DATE EDAY TODAYSDATE的人

This admittedly will run slower than looking at a stored date as it is being calculated against each record queried rather than being stored. 显然,这将比查看存储的日期慢,因为它是针对每个查询的记录而不是存储的记录进行计算的。 If PERSONS is a large file, this might not be a good idea. 如果PERSONS是一个大文件,那么这可能不是一个好主意。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM